20 #include "FairLogger.h"
21 #include "FairRootManager.h"
34 , fRichRingMatches(NULL)
37 , fStsTrackMatches(NULL)
42 , fhTest2_invmass_RICHindex0(NULL)
43 , fhTest2_invmass_RICHindex1(NULL)
44 , fhTest2_invmass_RICHindex2(NULL)
45 , fhTest2_invmass_RICHindex3(NULL)
46 , fhTest2_invmass_RICHindex4(NULL)
52 , fhTest2_invmass_gee_mc(NULL)
53 , fhTest2_invmass_gee_refitted(NULL)
54 , fhTest2_invmass_gg_mc(NULL)
55 , fhTest2_invmass_gg_refitted(NULL)
56 , fhTest2_invmass_all_mc(NULL)
57 , fhTest2_invmass_all_refitted(NULL)
58 , fhTest2_pt_vs_rap_gee(NULL)
59 , fhTest2_pt_vs_rap_gg(NULL)
60 , fhTest2_pt_vs_rap_all(NULL)
61 , fhTest2_startvertexElectrons_gee(NULL)
62 , fhTest2_startvertexElectrons_gg(NULL)
63 , fhTest2_startvertexElectrons_all(NULL)
64 , fhTest2_2rich_invmass_gee_mc(NULL)
65 , fhTest2_2rich_invmass_gee_refitted(NULL)
66 , fhTest2_2rich_invmass_gg_mc(NULL)
67 , fhTest2_2rich_invmass_gg_refitted(NULL)
68 , fhTest2_2rich_invmass_all_mc(NULL)
69 , fhTest2_2rich_invmass_all_refitted(NULL)
70 , fhTest2_2rich_pt_vs_rap_gee(NULL)
71 , fhTest2_2rich_pt_vs_rap_gg(NULL)
72 , fhTest2_2rich_pt_vs_rap_all(NULL)
73 , fhTest2_electrons_pt_vs_p(NULL)
74 , fhTest2_electrons_pt_vs_p_withRICH(NULL)
75 , fhTest2_electrons_pt_vs_p_noRICH(NULL)
76 , fhTest2_3rich_electrons_theta_included(NULL)
77 , fhTest2_3rich_electrons_theta_missing(NULL)
78 , fhTest2_3rich_electrons_thetaVSp_included(NULL)
79 , fhTest2_3rich_electrons_thetaVSp_missing(NULL) {}
85 FairRootManager* ioman = FairRootManager::Instance();
87 Fatal(
"CbmAnaConversion::Init",
"RootManager not instantised!");
90 fRichPoints = (TClonesArray*) ioman->GetObject(
"RichPoint");
92 Fatal(
"CbmAnaConversion::Init",
"No RichPoint array!");
95 fMcTracks = (TClonesArray*) ioman->GetObject(
"MCTrack");
97 Fatal(
"CbmAnaConversion::Init",
"No MCTrack array!");
100 fStsTracks = (TClonesArray*) ioman->GetObject(
"StsTrack");
102 Fatal(
"CbmAnaConversion::Init",
"No StsTrack array!");
107 Fatal(
"CbmAnaConversion::Init",
"No StsTrackMatch array!");
110 fGlobalTracks = (TClonesArray*) ioman->GetObject(
"GlobalTrack");
112 Fatal(
"CbmAnaConversion::Init",
"No GlobalTrack array!");
122 if (
nullptr ==
fPrimVertex) { LOG(fatal) <<
"No PrimaryVertex array!"; }
124 fRichRings = (TClonesArray*) ioman->GetObject(
"RichRing");
126 Fatal(
"CbmAnaConversion::Init",
"No RichRing array!");
131 Fatal(
"CbmAnaConversion::Init",
"No RichRingMatch array!");
141 Double_t invmassSpectra_nof = 800;
142 Double_t invmassSpectra_start = -0.00125;
143 Double_t invmassSpectra_end = 1.99875;
147 "fhTest2_invmass_RICHindex0",
148 "fhTest2_invmass_RICHindex0; invariant mass of 4 e^{#pm} in GeV/c^{2}; #",
154 "fhTest2_invmass_RICHindex1",
155 "fhTest2_invmass_RICHindex1; invariant mass of 4 e^{#pm} in GeV/c^{2}; #",
161 "fhTest2_invmass_RICHindex2",
162 "fhTest2_invmass_RICHindex2; invariant mass of 4 e^{#pm} in GeV/c^{2}; #",
168 "fhTest2_invmass_RICHindex3",
169 "fhTest2_invmass_RICHindex3; invariant mass of 4 e^{#pm} in GeV/c^{2}; #",
175 "fhTest2_invmass_RICHindex4",
176 "fhTest2_invmass_RICHindex4; invariant mass of 4 e^{#pm} in GeV/c^{2}; #",
184 "fhTest2_invmass_gee_mc",
185 "fhTest2_invmass_gee_mc;invariant mass of 4 e^{#pm} in GeV/c^{2};#",
187 invmassSpectra_start,
190 "fhTest2_invmass_gee_refitted",
191 "fhTest2_invmass_gee_refitted;invariant mass of 4 e^{#pm} in GeV/c^{2};#",
193 invmassSpectra_start,
196 new TH1D(
"fhTest2_invmass_gg_mc",
197 "fhTest2_invmass_gg_mc;invariant mass of 4 e^{#pm} in GeV/c^{2};#",
199 invmassSpectra_start,
202 "fhTest2_invmass_gg_refitted",
203 "fhTest2_invmass_gg_refitted;invariant mass of 4 e^{#pm} in GeV/c^{2};#",
205 invmassSpectra_start,
208 "fhTest2_invmass_all_mc",
209 "fhTest2_invmass_all_mc;invariant mass of 4 e^{#pm} in GeV/c^{2};#",
211 invmassSpectra_start,
214 "fhTest2_invmass_all_refitted",
215 "fhTest2_invmass_all_refitted;invariant mass of 4 e^{#pm} in GeV/c^{2};#",
217 invmassSpectra_start,
227 new TH2D(
"fhTest2_pt_vs_rap_gee",
228 "fhTest2_pt_vs_rap_gee;p_{t} in GeV/c; rapidity y",
236 new TH2D(
"fhTest2_pt_vs_rap_gg",
237 "fhTest2_pt_vs_rap_gg;p_{t} in GeV/c; rapidity y",
245 new TH2D(
"fhTest2_pt_vs_rap_all",
246 "fhTest2_pt_vs_rap_all;p_{t} in GeV/c; rapidity y",
258 new TH1D(
"fhTest2_startvertexElectrons_gee",
259 "fhTest2_startvertexElectrons_gee;z in cm;#",
264 new TH1D(
"fhTest2_startvertexElectrons_gg",
265 "fhTest2_startvertexElectrons_gg;z in cm;#",
270 new TH1D(
"fhTest2_startvertexElectrons_all",
271 "fhTest2_startvertexElectrons_all;z in cm;#",
282 "fhTest2_2rich_invmass_gee_mc",
283 "fhTest2_2rich_invmass_gee_mc;invariant mass of 4 e^{#pm} in GeV/c^{2};#",
285 invmassSpectra_start,
288 new TH1D(
"fhTest2_2rich_invmass_gee_refitted",
289 "fhTest2_2rich_invmass_gee_refitted;invariant mass of 4 e^{#pm} "
292 invmassSpectra_start,
295 "fhTest2_2rich_invmass_gg_mc",
296 "fhTest2_2rich_invmass_gg_mc;invariant mass of 4 e^{#pm} in GeV/c^{2};#",
298 invmassSpectra_start,
301 new TH1D(
"fhTest2_2rich_invmass_gg_refitted",
302 "fhTest2_2rich_invmass_gg_refitted;invariant mass of 4 e^{#pm} in "
305 invmassSpectra_start,
308 "fhTest2_2rich_invmass_all_mc",
309 "fhTest2_2rich_invmass_all_mc;invariant mass of 4 e^{#pm} in GeV/c^{2};#",
311 invmassSpectra_start,
314 new TH1D(
"fhTest2_2rich_invmass_all_refitted",
315 "fhTest2_2rich_invmass_all_refitted;invariant mass of 4 e^{#pm} "
318 invmassSpectra_start,
329 new TH2D(
"fhTest2_2rich_pt_vs_rap_gee",
330 "fhTest2_2rich_pt_vs_rap_gee;p_{t} in GeV/c; rapidity y",
338 new TH2D(
"fhTest2_2rich_pt_vs_rap_gg",
339 "fhTest2_2rich_pt_vs_rap_gg;p_{t} in GeV/c; rapidity y",
347 new TH2D(
"fhTest2_2rich_pt_vs_rap_all",
348 "fhTest2_2rich_pt_vs_rap_all;p_{t} in GeV/c; rapidity y",
362 new TH2D(
"fhTest2_electrons_pt_vs_p",
363 "fhTest2_electrons_pt_vs_p;p_{t} in GeV/c; p in GeV/c",
372 new TH2D(
"fhTest2_electrons_pt_vs_p_withRICH",
373 "fhTest2_electrons_pt_vs_p_withRICH;p_{t} in GeV/c; p in GeV/c",
382 new TH2D(
"fhTest2_electrons_pt_vs_p_noRICH",
383 "fhTest2_electrons_pt_vs_p_noRICH;p_{t} in GeV/c; p in GeV/c",
393 new TH1D(
"fhTest2_3rich_electrons_theta_included",
394 "fhTest2_3rich_electrons_theta_included;theta angle [deg];#",
400 new TH1D(
"fhTest2_3rich_electrons_theta_missing",
401 "fhTest2_3rich_electrons_theta_missing;theta angle [deg];#",
407 "fhTest2_3rich_electrons_thetaVSp_included",
408 "fhTest2_3rich_electrons_thetaVSp_included;theta angle [deg];p in GeV/c",
417 "fhTest2_3rich_electrons_thetaVSp_missing",
418 "fhTest2_3rich_electrons_thetaVSp_missing;theta angle [deg];p in GeV/c",
431 gDirectory->mkdir(
"Test2");
432 gDirectory->cd(
"Test2");
436 gDirectory->cd(
"..");
449 for (Int_t
i = 0;
i < ngTracks;
i++) {
451 if (NULL == gTrack)
continue;
455 if (stsInd < 0)
continue;
457 if (stsTrack == NULL)
continue;
460 if (stsMatch == NULL)
continue;
463 if (stsMcTrackId < 0)
continue;
465 if (mcTrack1 == NULL)
continue;
469 TVector3 refittedMomentum;
471 vector<CbmStsTrack> stsTracks;
473 stsTracks[0] = *stsTrack;
474 vector<L1FieldRegion> vField;
475 vector<float> chiPrim;
479 const FairTrackParam* vtxTrack = stsTracks[0].GetParamFirst();
480 vtxTrack->Momentum(refittedMomentum);
486 vector<CbmStsTrack> stsTracks_electron;
487 stsTracks_electron.resize(1);
488 stsTracks_electron[0] = *stsTrack;
489 vector<L1FieldRegion> vField_electron;
490 vector<float> chiPrim_electron;
491 vector<int> pidHypo_electron;
492 pidHypo_electron.push_back(11);
493 fPFFitter_electron.
Fit(stsTracks_electron, pidHypo_electron);
495 stsTracks_electron, vField_electron, chiPrim_electron,
fKFVertex, 3e6);
497 TVector3 refittedMomentum_electron;
498 const FairTrackParam* vtxTrack_electron =
499 stsTracks_electron[0].GetParamFirst();
500 vtxTrack_electron->Momentum(refittedMomentum_electron);
508 if (TMath::Abs(pdg) == 11) {
510 refittedMomentum_electron.Mag());
513 refittedMomentum_electron.Perp(), refittedMomentum_electron.Mag());
517 refittedMomentum_electron.Mag());
532 if (richMatch == NULL) {
537 if (richMcTrackId < 0) {
542 if (mcTrack2 == NULL) {
559 cout <<
"CbmAnaConversionTest2: InvariantMassTest_3RICH - Start..." << endl;
560 cout <<
"CbmAnaConversionTest2: InvariantMassTest_3RICH - "
566 cout <<
"CbmAnaConversionTest2: InvariantMassTest_3RICH - iteration i = "
579 cout <<
"CbmAnaConversionTest2: InvariantMassTest_4epem - not "
580 "matching number of entries!"
585 Bool_t IsPi0 =
false;
603 if (richIndex1 + richIndex2 + richIndex3 + richIndex4 != 3)
continue;
612 if ((motherId1 == motherId2 && motherId3 == motherId4)
613 || (motherId1 == motherId3 && motherId2 == motherId4)
614 || (motherId1 == motherId4
615 && motherId2 == motherId3)) {
618 int grandmotherId1 = -1;
619 int grandmotherId2 = -1;
620 int grandmotherId3 = -1;
621 int grandmotherId4 = -1;
623 int mcMotherPdg1 = -1;
627 int mcGrandmotherPdg1 = -1;
634 if (motherId1 != -1) {
636 if (NULL != mother1) mcMotherPdg1 = mother1->
GetPdgCode();
638 if (grandmotherId1 != -1) {
640 if (NULL != grandmother1)
641 mcGrandmotherPdg1 = grandmother1->
GetPdgCode();
644 if (motherId2 != -1) {
648 if (grandmotherId2 != -1) {
653 if (motherId3 != -1) {
657 if (grandmotherId3 != -1) {
662 if (motherId4 != -1) {
666 if (grandmotherId4 != -1) {
672 if (grandmotherId1 == -1)
continue;
674 if (motherId1 == motherId2 && motherId3 == motherId4) {
677 if ((grandmotherId1 == motherId3 && mcGrandmotherPdg1 == 111)
678 || (motherId1 == grandmotherId3 && mcMotherPdg1 == 111)) {
689 if (pi0start_i.Z() > 1 || pi0start_j.Z() > 1
690 || pi0start_k.Z() > 1 || pi0start_l.Z() > 1)
694 Double_t invmass_mc = 0;
695 Double_t invmass_reco = 0;
708 invmass_mc = params_mc.
fMinv;
709 invmass_reco = params_reco.
fMinv;
724 if (motherId1 == motherId3 && motherId2 == motherId4) {
727 if ((grandmotherId1 == motherId2 && mcGrandmotherPdg1 == 111)
728 || (motherId1 == grandmotherId2 && mcMotherPdg1 == 111)) {
739 if (pi0start_i.Z() > 1 || pi0start_j.Z() > 1
740 || pi0start_k.Z() > 1 || pi0start_l.Z() > 1)
744 Double_t invmass_mc = 0;
745 Double_t invmass_reco = 0;
758 invmass_mc = params_mc.
fMinv;
759 invmass_reco = params_reco.
fMinv;
774 if (motherId1 == motherId4 && motherId2 == motherId3) {
777 if ((grandmotherId1 == motherId2 && mcGrandmotherPdg1 == 111)
778 || (motherId1 == grandmotherId2 && mcMotherPdg1 == 111)) {
789 if (pi0start_i.Z() > 1 || pi0start_j.Z() > 1
790 || pi0start_k.Z() > 1 || pi0start_l.Z() > 1)
794 Double_t invmass_mc = 0;
795 Double_t invmass_reco = 0;
808 invmass_mc = params_mc.
fMinv;
809 invmass_reco = params_reco.
fMinv;
828 if (grandmotherId1 == grandmotherId2
829 && grandmotherId1 == grandmotherId3
830 && grandmotherId1 == grandmotherId4) {
831 if (mcGrandmotherPdg1 != 111)
continue;
847 if (pi0start_i.Z() > 1 || pi0start_j.Z() > 1 || pi0start_k.Z() > 1
848 || pi0start_l.Z() > 1)
851 Double_t invmass_mc = 0;
852 Double_t invmass_reco = 0;
865 invmass_mc = params_mc.
fMinv;
866 invmass_reco = params_reco.
fMinv;
880 cout <<
"########################################################"
888 if (richIndex1 <= 0 && IsPi0) {
910 if (richIndex2 <= 0 && IsPi0) {
932 if (richIndex3 <= 0 && IsPi0) {
954 if (richIndex4 <= 0 && IsPi0) {
988 cout <<
"CbmAnaConversionTest2: InvariantMassTest_2RICH - Start..." << endl;
989 cout <<
"CbmAnaConversionTest2: InvariantMassTest_2RICH - "
995 cout <<
"CbmAnaConversionTest2: InvariantMassTest_2RICH - iteration i = "
1008 cout <<
"CbmAnaConversionTest2: InvariantMassTest_4epem - not "
1009 "matching number of entries!"
1016 TVector3 pi0start_i;
1018 TVector3 pi0start_j;
1020 TVector3 pi0start_k;
1022 TVector3 pi0start_l;
1031 if (richIndex1 + richIndex2 + richIndex3 + richIndex4 != 2)
continue;
1039 if ((motherId1 == motherId2 && motherId3 == motherId4)
1040 || (motherId1 == motherId3 && motherId2 == motherId4)
1041 || (motherId1 == motherId4 && motherId2 == motherId3)) {
1044 int grandmotherId1 = -1;
1045 int grandmotherId2 = -1;
1046 int grandmotherId3 = -1;
1047 int grandmotherId4 = -1;
1049 int mcMotherPdg1 = -1;
1053 int mcGrandmotherPdg1 = -1;
1060 if (motherId1 != -1) {
1062 if (NULL != mother1) mcMotherPdg1 = mother1->
GetPdgCode();
1064 if (grandmotherId1 != -1) {
1066 if (NULL != grandmother1)
1067 mcGrandmotherPdg1 = grandmother1->
GetPdgCode();
1070 if (motherId2 != -1) {
1074 if (grandmotherId2 != -1) {
1079 if (motherId3 != -1) {
1083 if (grandmotherId3 != -1) {
1088 if (motherId4 != -1) {
1092 if (grandmotherId4 != -1) {
1098 if (grandmotherId1 == -1)
continue;
1100 if (motherId1 == motherId2 && motherId3 == motherId4) {
1103 if ((grandmotherId1 == motherId3 && mcGrandmotherPdg1 == 111)
1104 || (motherId1 == grandmotherId3 && mcMotherPdg1 == 111)) {
1116 if (pi0start_i.Z() > 1 || pi0start_j.Z() > 1
1117 || pi0start_k.Z() > 1 || pi0start_l.Z() > 1)
1121 Double_t invmass_mc = 0;
1122 Double_t invmass_reco = 0;
1135 invmass_mc = params_mc.
fMinv;
1136 invmass_reco = params_reco.
fMinv;
1149 if (motherId1 == motherId3 && motherId2 == motherId4) {
1152 if ((grandmotherId1 == motherId2 && mcGrandmotherPdg1 == 111)
1153 || (motherId1 == grandmotherId2 && mcMotherPdg1 == 111)) {
1165 if (pi0start_i.Z() > 1 || pi0start_j.Z() > 1
1166 || pi0start_k.Z() > 1 || pi0start_l.Z() > 1)
1170 Double_t invmass_mc = 0;
1171 Double_t invmass_reco = 0;
1184 invmass_mc = params_mc.
fMinv;
1185 invmass_reco = params_reco.
fMinv;
1198 if (motherId1 == motherId4 && motherId2 == motherId3) {
1201 if ((grandmotherId1 == motherId2 && mcGrandmotherPdg1 == 111)
1202 || (motherId1 == grandmotherId2 && mcMotherPdg1 == 111)) {
1214 if (pi0start_i.Z() > 1 || pi0start_j.Z() > 1
1215 || pi0start_k.Z() > 1 || pi0start_l.Z() > 1)
1219 Double_t invmass_mc = 0;
1220 Double_t invmass_reco = 0;
1233 invmass_mc = params_mc.
fMinv;
1234 invmass_reco = params_reco.
fMinv;
1251 if (grandmotherId1 == grandmotherId2
1252 && grandmotherId1 == grandmotherId3
1253 && grandmotherId1 == grandmotherId4) {
1254 if (mcGrandmotherPdg1 != 111)
continue;
1270 if (pi0start_i.Z() > 1 || pi0start_j.Z() > 1 || pi0start_k.Z() > 1
1271 || pi0start_l.Z() > 1)
1274 Double_t invmass_mc = 0;
1275 Double_t invmass_reco = 0;
1288 invmass_mc = params_mc.
fMinv;
1289 invmass_reco = params_reco.
fMinv;
1301 cout <<
"########################################################"
1316 Int_t nofDaughters = 0;
1319 if (motherId == motherId_temp) nofDaughters++;
1323 return nofDaughters;