40 #include <boost/progress.hpp>
43 #include "TLorentzRotation.h"
45 #include "TClonesArray.h"
46 #include "TStopwatch.h"
62 #include "mathUtils.hpp"
63 #include "reportingUtilsRoot.hpp"
64 #include "conversionUtils.hpp"
76 using namespace boost;
81 main(
int argc,
char** argv)
91 isobarDecayVertex::setDebug(
true);
92 decayTopology::setDebug(
true);
93 isobarDecayTopology::setDebug(
true);
94 massDependence::setDebug(
true);
95 diffractiveDissVertex::setDebug(
true);
96 isobarAmplitude::setDebug(
true);
97 isobarHelicityAmplitude::setDebug(
true);
98 isobarCanonicalAmplitude::setDebug(
true);
99 waveDescription::setDebug(
true);
107 cout <<
"before = " << n <<
" " << p << endl;
113 cout <<
"L1 -> " << n <<
" " << p << endl;
117 cout <<
"L2 -> " << p << endl;
121 cout <<
"L3 -> " << p << endl;
128 cout <<
"L -> " << p << endl;
131 printWarn <<
"code disabled, because compilation of PWA2000 is disabled" << endl;
135 TLorentzVector
p(0.5, 0.75, 1, 2);
136 TVector3
n = TVector3(0, 0, 1).Cross(p.Vect());
138 R1.RotateZ(-n.Phi());
139 R1.RotateY(piHalf - n.Theta());
143 cout <<
"R1 -> " << n <<
" " << p << endl;
146 R2.RotateY(-signum(p.X()) * p.Theta());
148 cout <<
"R2 -> " << p << endl;
150 TLorentzRotation L3(-p.BoostVector());
151 cout <<
"L3 -> " << L3 * p << endl;
154 TLorentzRotation L(R1);
155 L.Boost(-p.BoostVector());
156 p = TLorentzVector(0.5, 0.75, 1, 2);
158 cout <<
"L -> " << p << endl;
163 TLorentzVector
p(0.5, 0.75, 1, 2);
167 cout <<
"!!! L -> " << L * p << endl;
172 TLorentzVector beam(1, 0.5, 180, 182);
173 TLorentzVector X (0.5, 0.75, 1, 3);
176 cout <<
"!!! L -> " << L * X << endl;
204 beam->setLzVec(TLorentzVector(0.104385398, 0.0132061851, 189.987978, 189.988058));
205 pi0->setLzVec(TLorentzVector(-0.0761465106, -0.116917817, 5.89514709, 5.89844947));
206 pi1->setLzVec(TLorentzVector(-0.0244305532, -0.106013023, 30.6551865, 30.6556973));
207 pi2->setLzVec(TLorentzVector(0.000287952441, 0.10263611, 3.95724077, 3.96103114));
208 pi3->setLzVec(TLorentzVector(0.0299586212, 0.176440177, 115.703054, 115.703277));
209 pi4->setLzVec(TLorentzVector(0.176323963, -0.0985753246, 30.9972271, 30.9981995));
211 vector<isobarDecayVertexPtr> decayVertices;
212 decayVertices.push_back(vert3);
213 decayVertices.push_back(vert1);
214 decayVertices.push_back(vert2);
215 decayVertices.push_back(vert0);
216 vector<particlePtr> fsParticles;
217 fsParticles.push_back(pi0);
218 fsParticles.push_back(pi1);
219 fsParticles.push_back(pi2);
220 fsParticles.push_back(pi3);
221 fsParticles.push_back(pi4);
225 topo->fillKinematicsDataCache();
228 complex<double> decayAmp = amp.
amplitude();
229 cout <<
"!!! decay amplitude = " << decayAmp << endl;
233 PDGtable.initialize(
"../../keyfiles/key5pi/pdgTable.txt");
235 ifstream eventData(
"testEvents.evt");
237 if (not (eventData >> ev).eof()) {
239 key.
open(
"testAmplitude.key");
240 complex<double> pwa2000amp;
241 key.
run(ev, pwa2000amp,
true);
244 cout <<
"!!! PWA2000 amplitude = " << pwa2000amp << endl;
245 cout <<
"!!! my amplitude = " << decayAmp <<
" vs. PWA2000 amplitude = " << pwa2000amp <<
", "
246 <<
"delta = " << decayAmp - pwa2000amp << endl;
249 printWarn <<
"code disabled, because compilation of PWA2000 is disabled" << endl;
267 vector<isobarDecayVertexPtr> decayVertices;
268 decayVertices.push_back(vert0);
269 vector<particlePtr> fsParticles;
270 fsParticles.push_back(pi0);
271 fsParticles.push_back(pi1);
273 topo->checkTopology();
274 topo->checkConsistency();
275 isobarAmplitude::setDebug (
true);
276 isobarHelicityAmplitude::setDebug (
true);
277 isobarCanonicalAmplitude::setDebug(
true);
280 for (
unsigned int i = 0;
i < 2; ++
i) {
281 amp[
i]->enableBoseSymmetrization(
false);
282 amp[
i]->enableReflectivityBasis (
false);
285 TChain chain(
"rootPwaEvtTree");
286 chain.Add(
"../../../massBins/2004/Q3PiData/template.both/1260.1300/1260.1300.root");
287 chain.GetListOfFiles()->ls();
288 vector<complex<double> > ampValues[2];
290 TClonesArray* prodKinPartNames = 0;
291 TClonesArray* decayKinPartNames = 0;
294 cout <<
"cannot find production and/or decay kinematics particle names "
295 <<
"in input file '" << chain.GetFile()->GetName() <<
"'." << endl;
296 for (
unsigned int i = 0;
i < 2; ++
i)
297 processTree(chain, *prodKinPartNames, *decayKinPartNames, amp[
i], ampValues[i], 2);
298 for (
unsigned int i = 0; i < ampValues[0].size(); ++
i)
299 cout <<
"amplitude[" << i <<
"] = " << ampValues[0][i] <<
" vs. " << ampValues[1][i] <<
"; "
300 <<
"ratio = " << ampValues[0][i] / ampValues[1][i] << endl;
304 const long int maxNmbEvents = 10000;
353 const string newKeyFileName =
"test5pi/charly/sym/1-1+00+rho1700=a11260+=rho770_01_pi+_01_pi-_01_pi-.key";
354 const string oldKeyFileName =
"test5pi/sebastian/sym/1-1++0+pi-_01_rho1700=a11269=pi+_0_rho770_0_pi-.key";
356 const string evtInFileName =
"test5pi/1900.1960.genbod.regen.evt";
357 const string rootInFileName =
"test5pi/1900.1960.genbod.root";
375 const string& inTreeName =
"rootPwaEvtTree";
376 const string& prodKinPartNamesObjName =
"prodKinParticles";
377 const string& prodKinMomentaLeafName =
"prodKinMomenta";
378 const string& decayKinPartNamesObjName =
"decayKinParticles";
379 const string& decayKinMomentaLeafName =
"decayKinMomenta";
380 vector<complex<double> > myAmps;
382 vector<TTree*> inTrees;
383 TClonesArray* prodKinPartNames = 0;
384 TClonesArray* decayKinPartNames = 0;
386 vector<string> rootFileNames(1, rootInFileName);
387 vector<string> evtFileNames;
389 rootFileNames, evtFileNames,
390 inTreeName, prodKinPartNamesObjName, prodKinMomentaLeafName,
391 decayKinPartNamesObjName, decayKinMomentaLeafName,
true)) {
392 printErr <<
"problems opening input files. aborting." << endl;
396 const long int nmbEventsChain = inTrees[0]->GetEntries();
399 TBranch* prodKinMomentaBr = 0;
400 TBranch* decayKinMomentaBr = 0;
401 TClonesArray* prodKinMomenta = 0;
402 TClonesArray* decayKinMomenta = 0;
405 inTrees[0]->SetBranchAddress(prodKinMomentaLeafName.c_str(), &prodKinMomenta, &prodKinMomentaBr );
406 inTrees[0]->SetBranchAddress(decayKinMomentaLeafName.c_str(), &decayKinMomenta, &decayKinMomentaBr);
409 if (not topo->initKinematicsData(*prodKinPartNames, *decayKinPartNames)) {
410 printErr <<
"problems initializing input data. aborting." << endl;
413 const long int nmbEvents = ((maxNmbEvents > 0) ? min(maxNmbEvents, nmbEventsChain)
418 for (
long int eventIndex = 0; eventIndex < nmbEvents; ++eventIndex) {
421 if (inTrees[0]->LoadTree(eventIndex) < 0)
424 prodKinMomentaBr->GetEntry (eventIndex);
425 decayKinMomentaBr->GetEntry(eventIndex);
427 if (not prodKinMomenta or not decayKinMomenta) {
428 printWarn <<
"at least one data array is null pointer: "
429 <<
"prodKinMomenta = " << prodKinMomenta <<
", "
430 <<
"decayKinMomenta = " << decayKinMomenta <<
". "
431 <<
"skipping event." << endl;
435 if (topo->readKinematicsData(*prodKinMomenta, *decayKinMomenta)) {
436 myAmps.push_back((*amp)());
437 if ((myAmps.back().real() == 0) or (myAmps.back().imag() == 0))
438 printWarn <<
"event " << eventIndex <<
": " << myAmps.back() << endl;
439 topo->productionVertex()->productionAmp();
444 printSucc <<
"read " << myAmps.size() <<
" events from file(s) "
445 <<
"'" << rootInFileName <<
"' and calculated amplitudes" << endl;
447 printInfo <<
"myAmps[0] = " << maxPrecisionDouble(myAmps[0]) << endl;
452 PDGtable.initialize(
"../../keyfiles/key5pi/pdgTable.txt");
453 ifstream eventData(evtInFileName.c_str());
456 key.
open(oldKeyFileName);
460 long int countEvent = 0;
461 vector<complex<double> > pwa2kAmps;
462 const unsigned int logInterval = 1000;
463 while ((countEvent < maxNmbEvents) and (not (eventData >> ev).eof())) {
464 complex<double> pwa2kamp;
465 key.
run(ev, pwa2kamp,
true);
466 pwa2kAmps.push_back(pwa2kamp);
469 if (countEvent % logInterval == 0)
470 cout <<
" " << countEvent << endl;
473 printSucc <<
"read " << pwa2kAmps.size() <<
" events from file(s) "
474 <<
"'" << evtInFileName <<
"' and calculated amplitudes" << endl;
477 printInfo <<
"myAmps[0] = " << maxPrecisionDouble(myAmps[0]) <<
" vs. pwa2kAmps[0] = "
478 << maxPrecisionDouble(pwa2kAmps[0]) <<
", abs. delta = "
479 << maxPrecisionDouble(myAmps[0] - pwa2kAmps[0]) <<
", rel. delta = "
480 <<
"(" << maxPrecision((myAmps[0].real() - pwa2kAmps[0].real()) / myAmps[0].real())
481 <<
", " << maxPrecision((myAmps[0].imag() - pwa2kAmps[0].imag()) / myAmps[0].imag())
485 const string outFileName =
"testAmplitudeDiff.root";
486 printInfo <<
"writing comparison plots to " << outFileName << endl;
487 TFile* f = TFile::Open(outFileName.c_str(),
"RECREATE");
488 TH1D* hMyAmpsReal =
new TH1D(
"hMyAmpsReal",
"hMyAmpsReal;Event Number;#Rgothic[Amplitude]", myAmps.size(), -0.5, myAmps.size() - 0.5);
489 TH1D* hMyAmpsImag =
new TH1D(
"hMyAmpsImag",
"hMyAmpsImag;Event Number;#Jgothic[Amplitude]", myAmps.size(), -0.5, myAmps.size() - 0.5);
490 TH1D* hPwa2kAmpsReal =
new TH1D(
"hPwa2kAmpsReal",
"hPwa2kAmpsReal;Event Number;#Rgothic[Amplitude]", pwa2kAmps.size(), -0.5, pwa2kAmps.size() - 0.5);
491 TH1D* hPwa2kAmpsImag =
new TH1D(
"hPwa2kAmpsImag",
"hPwa2kAmpsImag;Event Number;#Jgothic[Amplitude]", pwa2kAmps.size(), -0.5, pwa2kAmps.size() - 0.5);
492 TH1D* hDiffReal =
new TH1D(
"hDiffReal",
"hDiffReal;#Rgothic[Amplitude] Difference;Count", 100000, -1e-7, 1e-7);
493 TH1D* hDiffImag =
new TH1D(
"hDiffImag",
"hDiffImag;#Jgothic[Amplitude] Difference;Count", 100000, -1e-7, 1e-7);
494 TH2D* hCorrReal =
new TH2D(
"hCorrReal",
"hCorrReal;#Rgothic[My Amp];#Rgothic[PWA2000 Amp]", 1000, -2, 2, 1000, -2, 2);
495 TH2D* hCorrImag =
new TH2D(
"hCorrImag",
"hCorrImag;#Jgothic[My Amp];#Jgothic[PWA2000 Amp]", 1000, -2, 2, 1000, -2, 2);
496 for (
unsigned int i = 0;
i < myAmps.size(); ++
i) {
497 hMyAmpsReal->SetBinContent (
i + 1, myAmps[
i].real());
498 hMyAmpsImag->SetBinContent (
i + 1, myAmps[
i].imag());
499 hPwa2kAmpsReal->SetBinContent(
i + 1, pwa2kAmps[
i].real());
500 hPwa2kAmpsImag->SetBinContent(
i + 1, pwa2kAmps[
i].imag());
501 hDiffReal->Fill((pwa2kAmps[
i].real() - myAmps[
i].real()) / pwa2kAmps[
i].real());
502 hDiffImag->Fill((pwa2kAmps[
i].imag() - myAmps[
i].imag()) / pwa2kAmps[
i].imag());
505 hCorrReal->Fill(myAmps[
i].real(), pwa2kAmps[
i].real());
506 hCorrImag->Fill(myAmps[
i].imag(), pwa2kAmps[
i].imag());
512 printWarn <<
"code disabled, because compilation of PWA2000 is disabled" << endl;