22 #include "CbmRichUtil.h"
25 #include "FairRootManager.h"
31 #include "TProfile2D.h"
39 , fGlobalTracks(nullptr)
41 , fStsTrackMatches(nullptr)
42 , fRichPoints(nullptr)
45 , fRichRingMatches(nullptr)
46 , fRichProjections(nullptr)
47 , fArrayCentrality(nullptr)
56 , imageellipse(nullptr)
60 , ForChristian_P_vs_R(nullptr)
61 , AllPoints2D(nullptr)
62 , AllPoints3D(nullptr)
63 , MC_PdgCodes(nullptr)
64 , MC_All_photons_Pt(nullptr)
65 , MC_Not_Direct_photons_Pt(nullptr)
66 , MC_Direct_photons_Pt(nullptr)
67 , MC_All_photons_P(nullptr)
68 , MC_Not_Direct_photons_P(nullptr)
69 , MC_Direct_photons_P(nullptr)
70 , MC_photons_mother_Pdg(nullptr)
71 , MC_Not_Direct_photons_theta(nullptr)
72 , MC_Not_Direct_photons_theta_vs_rap(nullptr)
73 , MC_Direct_photons_theta(nullptr)
74 , MC_Direct_photons_theta_vs_rap(nullptr)
75 , MC_Direct_photons_Pt_vs_rap(nullptr)
76 , MC_Direct_photons_Pt_vs_rap_est(nullptr)
77 , MC_electrons_Pt_vs_rap_est(nullptr)
78 , MC_Reconstructed_electrons_Pt_vs_rap_est(nullptr)
79 , MC_omega_Pt_vs_rap_est(nullptr)
81 , MC_pi0_Pt_est(nullptr)
82 , MC_pi0_Pt_vs_rap(nullptr)
83 , MC_pi0_Pt_vs_rap_primary(nullptr)
84 , Pi0_pt_vs_rap_est(nullptr)
85 , Pi0_pt_vs_rap_est_primary(nullptr)
86 , MC_pi0_theta(nullptr)
88 , MC_pi0_Rapidity(nullptr)
89 , MC_pi0_theta_vs_rap(nullptr)
90 , MC_leptons_conversion_ZY(nullptr)
91 , MC_leptons_conversion_XY(nullptr)
92 , MC_leptons_conversion_XZ(nullptr)
93 , MC_leptons_from_pi0_start_vertex(nullptr)
94 , MC_leptons_from_pi0_P(nullptr)
96 , MC_eta_Pt_vs_rap(nullptr)
97 , MC_eta_Pt_vs_rap_primary(nullptr)
98 , MC_eta_theta(nullptr)
99 , MC_eta_theta_vs_rap(nullptr)
100 , BoA_electrons(nullptr)
101 , BoA_1d_electrons(nullptr)
102 , A_1d_electrons(nullptr)
103 , B_1d_electrons(nullptr)
104 , A_electrons(nullptr)
105 , B_electrons(nullptr)
106 , NumberOfRings_electrons(nullptr)
107 , AllHits_electrons(nullptr)
108 , dR_electrons(nullptr)
109 , dR2d_electrons(nullptr)
110 , Distance_electron(nullptr)
111 , Distance_positron(nullptr)
112 , Tracks_electrons(nullptr)
113 , Rings_electrons(nullptr)
114 , fhBoverAXYZ(nullptr)
115 , fhBaxisXYZ(nullptr)
116 , fhAaxisXYZ(nullptr)
118 , Test_rings(nullptr)
119 , AllPointsPerPMT(nullptr)
120 , AllPointsPerPixel(nullptr)
123 , AllHitsPerPMT(nullptr)
124 , AllHitsPerPixel(nullptr)
125 , temporarygraph(nullptr)
126 , HitsPerPmtFullPlane(nullptr)
127 , HitsPerPmtFullMiddle(nullptr) {
142 FairRootManager* ioman = FairRootManager::Instance();
143 if (
nullptr == ioman) {
144 Fatal(
"CbmKresConversionGeneral::Init",
"RootManager not instantised!");
147 fMcTracks = (TClonesArray*) ioman->GetObject(
"MCTrack");
149 Fatal(
"CbmKresConversionGeneral::Init",
"No MCTrack array!");
152 fGlobalTracks = (TClonesArray*) ioman->GetObject(
"GlobalTrack");
154 Fatal(
"CbmKresConversionGeneral::Init",
"No GlobalTrack array!");
157 fStsTracks = (TClonesArray*) ioman->GetObject(
"StsTrack");
159 Fatal(
"CbmKresConversionGeneral::Init",
"No StsTrack array!");
164 Fatal(
"CbmKresConversionGeneral::Init",
"No StsTrackMatch array!");
167 fRichPoints = (TClonesArray*) ioman->GetObject(
"RichPoint");
169 Fatal(
"CbmKresConversionGeneral::Init",
"No RichPoint array!");
172 fRichHits = (TClonesArray*) ioman->GetObject(
"RichHit");
174 Fatal(
"CbmKresConversionGeneral::Init",
"No RichHit array!");
177 fRichRings = (TClonesArray*) ioman->GetObject(
"RichRing");
179 Fatal(
"CbmKresConversionGeneral::Init",
"No RichRing array!");
184 Fatal(
"CbmKresConversionGeneral::Init",
"No RichRingMatch array!");
189 Fatal(
"CbmKresConversionGeneral::Init",
"No RichProjection array!");
194 Fatal(
"CbmAnaConversion2::Init",
"No fArrayCentrality array!");
209 for (
int i = 0;
i < nofRichPoints;
i++) {
211 if (point ==
nullptr)
continue;
213 double xPOINT = point->GetX();
214 double yPOINT = point->GetY();
215 double zPOINT = point->GetZ();
227 int nofRichHits =
fRichHits->GetEntriesFast();
228 for (
int i = 0;
i < nofRichHits;
i++) {
230 if (hit ==
nullptr)
continue;
232 double xHIT = hit->
GetX();
233 double yHIT = hit->
GetY();
234 double zHIT = hit->
GetZ();
255 Int_t nofMcTracks =
fMcTracks->GetEntriesFast();
256 for (
int i = 0;
i < nofMcTracks;
i++) {
258 if (mctrack ==
nullptr)
continue;
264 if (TMath::Abs(mctrack->
GetPdgCode()) == 111) {
265 TVector3
v, momentum;
287 if (TMath::Abs(mctrack->
GetPdgCode()) == 221) {
288 TVector3
v, momentum;
303 TVector3
v, momentum;
335 if (TMath::Abs(mctrack->
GetPdgCode()) == 11) {
339 if (motherId == -1)
continue;
341 if (
nullptr == mother)
continue;
343 if (grandmotherId == -1)
continue;
345 if (
nullptr == grandmother)
continue;
346 int mcGrandmotherPdg = grandmother->
GetPdgCode();
347 if (mcGrandmotherPdg == 111) {
361 if (TMath::Abs(mctrack->
GetPdgCode()) == 223) {
373 for (Int_t iTr = 0; iTr < ngTracks; iTr++) {
375 if (
nullptr == gTrack)
continue;
381 if (stsInd < 0)
continue;
383 if (stsTrack ==
nullptr)
continue;
386 if (stsMatch ==
nullptr)
continue;
389 if (stsMcTrackId < 0)
continue;
391 if (mcTrackSTS ==
nullptr)
continue;
395 if (TMath::Abs(mcTrackSTS->
GetPdgCode()) == 11
396 || TMath::Abs(mcTrackSTS->
GetPdgCode()) == 211) {
399 if (richRing ==
nullptr)
continue;
402 if (richMatch ==
nullptr)
continue;
405 if (richMcTrackId < 0)
continue;
407 if (mcTrackRICH ==
nullptr)
continue;
409 if (TMath::Abs(pdgRICH) != 11 && TMath::Abs(pdgRICH) != 211)
continue;
410 if (stsMcTrackId != richMcTrackId)
continue;
415 if (TMath::Abs(pdgSTS) != 11)
continue;
424 if (richInd < 0)
continue;
426 if (richRing ==
nullptr)
continue;
429 if (richMatch ==
nullptr)
continue;
432 if (richMcTrackId < 0)
continue;
434 if (mcTrackRICH ==
nullptr)
continue;
436 if (TMath::Abs(pdgRICH) != 11)
continue;
440 if (stsMcTrackId != richMcTrackId)
continue;
448 for (
int i = 0;
i < nofHits;
i++) {
449 Int_t hitInd = richRing->
GetHit(
i);
451 if (
nullptr == hit)
continue;
470 double p = ringHit.
GetPhi();
486 mcTrackRICH->
GetPt());
489 double minAngle = 0.;
490 double maxAngle = 2 * 3.14159265358979323846;
491 double stepAngle = 0.01;
492 for (
int iH = 0; iH < ringHit.
GetNofHits(); iH++) {
499 for (
double iT = minAngle; iT < maxAngle; iT = iT + stepAngle) {
500 double xEll = a *
cos(iT) *
cos(p) - b *
sin(iT) *
sin(p) + xc;
501 double yEll = a *
cos(iT) *
sin(p) + b *
sin(iT) *
cos(p) + yc;
503 sqrt((xh - xEll) * (xh - xEll) + (yh - yEll) * (yh - yEll));
511 sqrt((xmin - xc) * (xmin - xc) + (ymin - yc) * (ymin - yc))
512 -
sqrt((xh - xc) * (xh - xc) + (yh - yc) * (yh - yc));
514 if (sign < 0) { dr = -Lmin; }
546 gDirectory->mkdir(
"General");
547 gDirectory->cd(
"General");
548 gDirectory->mkdir(
"MC_info");
549 gDirectory->cd(
"MC_info");
553 gDirectory->cd(
"..");
557 gDirectory->cd(
"..");
564 new TH1D(
"MC_All_photons_Pt",
565 "Monte Carlo, all #gamma, p_{t} distribution; p_{t} in GeV/c",
572 "MC_Not_Direct_photons_Pt",
573 "Monte Carlo, #gamma from decays, p_{t} distribution; p_{t} in GeV/c",
580 "MC_Direct_photons_Pt",
581 "Monte Carlo, direct #gamma, p_{t} distribution; p_{t} in GeV/c",
588 new TH1D(
"MC_All_photons_P",
589 "Monte Carlo, all #gamma, p distribution; p in GeV/c",
596 new TH1D(
"MC_Not_Direct_photons_P",
597 "Monte Carlo, #gamma from decays, p distribution; p in GeV/c",
604 new TH1D(
"MC_Direct_photons_P",
605 "Monte Carlo, direct #gamma, p distribution; p in GeV/c",
612 new TH2D(
"MC_Direct_photons_Pt_vs_rap",
613 "Monte Carlo, direct #gamma, p_{t} vs rapidity distribution; "
614 "rapidity y; p_{t} in GeV/c ",
624 new TH2D(
"MC_Direct_photons_Pt_vs_rap_est",
625 "Monte Carlo, direct #gamma, p_{t} vs rapidity distribution; "
626 "rapidity y; p_{t} in GeV/c ",
636 "MC_photons_mother_Pdg",
"MC_photons_mother_Pdg; Id;#", 2500, -10, 2511);
640 new TH1D(
"MC_Not_Direct_photons_theta",
641 "Monte Carlo, #gamma from decays, #theta distribution; "
642 "emission angle #theta in deg;Entries",
649 new TH2D(
"MC_Not_Direct_photons_theta_vs_rap",
650 "Monte Carlo, #gamma from decays, #theta vs rapidity "
651 "distribution; emission angle #theta in deg; rapidity y",
661 new TH1D(
"MC_Direct_photons_theta",
662 "Monte Carlo, direct #gamma, #theta distribution; emission "
663 "angle #theta in deg;Entries",
670 new TH2D(
"MC_Direct_photons_theta_vs_rap",
671 "Monte Carlo, direct #gamma, #theta vs rapidity distribution; "
672 "emission angle #theta in deg; rapidity y",
682 new TH2D(
"MC_electrons_Pt_vs_rap_est",
683 "Monte Carlo, direct e, p_{t} vs rapidity distribution; "
684 "rapidity y; p_{t} in GeV/c ",
694 new TH2D(
"MC_Reconstructed_electrons_Pt_vs_rap_est",
695 "Monte Carlo, reconstructed e, p_{t} vs rapidity "
696 "distribution; rapidity y; p_{t} in GeV/c ",
706 new TH2D(
"MC_omega_Pt_vs_rap_est",
707 "Monte Carlo, #omega, p_{t} vs rapidity distribution; "
708 "rapidity y; p_{t} in GeV/c ",
721 "Monte Carlo, #pi^{0}, p_{t} distribution;p_{t} in GeV/c; Entries",
729 "Monte Carlo, #pi^{0}, p_{t} distribution;p_{t} in GeV/c; Entries",
736 "Monte Carlo, #pi^{0}, p_{t} vs rapidity "
737 "distribution; rapidity y; p_{t} in GeV/c ",
747 new TH2D(
"MC_pi0_Pt_vs_rap_primary",
748 "Monte Carlo, primary #pi^{0}, p_{t} vs rapidity "
749 "distribution; rapidity y; p_{t} in GeV/c ",
759 "Pi0_pt_vs_rap_est; rapidity y; p_{t} in GeV/c ",
769 new TH2D(
"Pi0_pt_vs_rap_est_primary",
770 "Pi0_pt_vs_rap_est_primary; rapidity y; p_{t} in GeV/c ",
780 "Monte Carlo, #pi^{0}, #theta distribution; "
781 "emission angle #theta in deg;Entries",
788 "Monte Carlo, #pi^{0}, #phi distribution; emission "
789 "angle #phi in deg; Entries",
796 new TH1D(
"MC_pi0_Rapidity",
797 "Monte Carlo, #pi^{0}, #rapidity distribution; emission angle "
798 "#phi in deg; Entries",
805 new TH2D(
"MC_pi0_theta_vs_rap",
806 "Monte Carlo, #pi^{0}, #theta vs rapidity distribution; "
807 "emission angle #theta in deg; rapidity y",
817 new TH2D(
"MC_leptons_conversion_ZY",
818 "Start vertices of leptons coming from #gamma; z[cm]; y[cm]",
827 new TH2D(
"MC_leptons_conversion_XY",
828 "Start vertices of leptons coming from #gamma; x[cm]; y[cm]",
837 new TH2D(
"MC_leptons_conversion_XZ",
838 "Start vertices of leptons coming from #gamma; x[cm]; z[cm]",
848 new TH2D(
"MC_leptons_from_pi0_start_vertex",
849 "Start vertices of leptons coming from #pi^{0}; z[cm]; y[cm]",
859 "MC_leptons_from_pi0_P; P_{e} in GeV/c",
868 "Monte Carlo, #eta, p_{t} distribution; p_{t} in GeV/c;Entries",
875 "Monte Carlo, #eta, p_{t} vs rapidity "
876 "distribution; rapidity y; p_{t} in GeV/c ",
886 new TH2D(
"MC_eta_Pt_vs_rap_primary",
887 "Monte Carlo, primary #eta, p_{t} vs rapidity distribution; "
888 "rapidity y; p_{t} in GeV/c ",
898 "Monte Carlo, #eta, #theta distribution; "
899 "emission angle #theta in deg; Entries",
906 new TH2D(
"MC_eta_theta_vs_rap",
907 "Monte Carlo, #eta, #theta vs rapidity distribution; emission "
908 "angle #theta in deg; rapidity y",
919 "ForChristian_P_vs_R; P [GeV]; R [cm]; Nof",
929 "AllPoints2D; X [cm]; Y [cm]; Nof",
939 "AllPoints3D; X [cm]; Y [cm]; Z [cm]",
952 "MC_PdgCodes",
"All PdgCodes from Monte Carlo; PDG code", 3500, 0, 3500);
956 "B/A for electrons; X [cm]; Y [cm]",
966 new TH1D(
"A_1d_electrons",
"A for electrons; A [cm]", 200, 3., 7.);
970 new TH1D(
"B_1d_electrons",
"B for electrons; B [cm]", 200, 3., 7.);
974 new TH1D(
"BoA_1d_electrons",
"BoA for electrons; B/A", 250, 0.5, 1.);
978 new TH1D(
"Tracks_electrons",
"Electron tracks in STS", 3, -0.5, 2.5);
982 new TH1D(
"Rings_electrons",
"Electron tracks in STS+RICH", 3, -0.5, 2.5);
986 "A for electrons; X [cm]; Y [cm]",
996 "B for electrons; X [cm]; Y [cm]",
1006 new TH2D(
"NumberOfRings_electrons",
1007 "Number of rings from electrons; X [cm]; Y [cm]; Nof",
1017 new TH2D(
"AllHits_electrons",
1018 "Hits from electrons after unfolding; X [cm]; Y [cm]; Nof",
1028 new TH1D(
"dR_electrons",
"dR for electrons; dR [cm]", 100, -2., 2.);
1032 "dR for electrons; X [cm]; Y [cm]",
1044 new TProfile2D(
"Distance_electron",
1045 "Distance between projected track and center of the ring "
1046 "for electrons; X [cm];Y [cm]; Nof",
1056 new TProfile2D(
"Distance_positron",
1057 "Distance between projected track and center of the ring "
1058 "for positrons; X [cm];Y [cm]; Nof",
1068 "fhBoverAXYZ; X [cm]; Y [cm]; B/A",
1080 "fhBaxisXYZ; X [cm]; Y [cm]; B [cm]",
1092 "fhAaxisXYZ; X [cm]; Y [cm]; A [cm]",
1104 "fhdRXYZ; X [cm]; Y [cm]; dR [cm]",
1117 new TH2D(
"Test_rings",
"Test_rings", 60, -150, 150, 20, 120, 220);
1121 "AllPointsPerPMT; X [cm]; Y [cm]; Nof",
1130 "AllPointsPerPixel; X [cm]; Y [cm]; Nof",
1139 "AllHitsPerPMT; X [cm]; Y [cm]; Nof",
1148 "AllHitsPerPixel; X [cm]; Y [cm]; Nof",
1158 "AllHits2D; X [cm]; Y [cm]; Nof",
1167 "AllHits3D; X [cm]; Y [cm]; Z [cm]",
1180 "temporarygraph; X [cm]; Y [cm]; Nof",
1189 new TH1D(
"HitsPerPmtFullPlane",
1190 "Number of hits per PMT. Distribution for all PMTs; Nof photons",
1196 new TH1D(
"HitsPerPmtFullMiddle",
1197 "Number of hits per PMT. Distribution for all PMT in "
1198 "y={125#;155}, x={-105#;105}; Nof photons",
1204 fitt =
new TH2D(
"fitt",
"fitt; x; y", 500, -110, 110, 50, 100, 200);