29#include "FairEventHeader.h"
30#include "FairMCPoint.h"
31#include "FairRootManager.h"
32#include "FairRunAna.h"
34#include "FairTrackParam.h"
36#include "TClonesArray.h"
37#include "TDatabasePDG.h"
39#include "TMCProcess.h"
64 string axMinv =
"dN/dM_{ee}/N [GeV/c^{2}]^{-1}";
66 fH.
CreateH2(
"hMomVsAnglePairSignalMc",
"#sqrt{P_{e^{#pm}} P_{e^{#mp}}} [GeV/c]",
"#theta_{e^{+},e^{-}} [deg]",
67 "Counter", 100, 0., 5., 1000, 0., 50.);
69 fH.
CreateH1(
"hMotherPdg", {
"mc",
"acc"},
"Pdg code",
"Particles / Event", 7000, -3500., 3500.);
71 fH.
CreateH2(
"hCandPdgVsMom",
fH.
fAnaStepNames,
"P [GeV/c]",
"Particle",
"Yield/(Event * Bin)", 200, 0., 10., 6, 0.,
75 fH.
CreateH2(
"hBgPairPdg",
fH.
fAnaStepNames,
"PDG of Candidate 1",
"PDG of Candidate 2", ax, 8, 0., 8., 8, 0., 8.);
77 fH.
CreateH2(
"hPmtXY",
fH.
fSrcNames,
"X [cm]",
"Y [cm]",
"Counter", 110, -110, 110, 200, -200, 200);
79 fH.
CreateH2(
"hVertexGammaXZ",
fH.
fAnaStepNames,
"Z [cm]",
"X [cm]", ax, 200, -10., 190., 400, -130., 130.);
80 fH.
CreateH2(
"hVertexGammaYZ",
fH.
fAnaStepNames,
"Z [cm]",
"Y [cm]", ax, 200, -10., 190., 400, -130., 130.);
81 fH.
CreateH2(
"hVertexGammaXY",
fH.
fAnaStepNames,
"X [cm]",
"Y [cm]", ax, 400, -130., 130., 400, -130., 130.);
86 fH.
CreateH2(
"hVertexXZ_misidTof",
fH.
fAnaStepNames,
"Z [cm]",
"X [cm]", ax, 110,
fZ - 10.,
fZ + 100., 100, -50., 50.);
87 fH.
CreateH2(
"hVertexYZ_misidTof",
fH.
fAnaStepNames,
"Z [cm]",
"Y [cm]", ax, 110,
fZ - 10.,
fZ + 100., 100, -50., 50.);
88 fH.
CreateH2(
"hVertexXY_misidTof",
fH.
fAnaStepNames,
"X [cm]",
"Y [cm]", ax, 100, -50., 50., 100, -50., 50.);
95 fH.
CreateH1(
"hNofTopoPairs", {
"gamma",
"pi0"},
"Pair type",
"Pairs/event", 8, 0., 8);
113 fH.
CreateH2(
"hSrcBgPairsEpEm",
fH.
fAnaStepNames,
"mother particle e+",
"mother particle e-", ax, 4, 0., 4., 4, 0.,
116 fH.
CreateH1(
"hEventNumber",
"",
"", 1, 0, 1.);
117 fH.
CreateH1(
"hEventNumberMixed",
"",
"", 1, 0, 1.);
120 fH.
CreateH2(
"hAnnRichVsMom",
fH.
fSrcNames,
"P [GeV/c]",
"RICH ANN output", ax, 100, 0., 10., 100, -1.1, 1.1);
122 fH.
CreateH2(
"hTofM2",
fH.
fSrcNames,
"P [GeV/c]",
"m^{2} [GeV/c^{2}]^{2}", ax, 150, 0., 6., 500, -0.1, 1.0);
128 fH.
CreateH2(
"hTrdLike", {
"El",
"Pi"},
fH.
fSrcNames,
"P [GeV/c]",
"Likelihood output", ax, 100, 0., 6., 100, 0., 1.);
130 fH.
CreateH2(
"hAnnRichVsMomPur", {
"El",
"Bg"},
"P [GeV/c]",
"RICH ANN output", ax, 100, 0., 10., 100, -1.1, 1.1);
131 fH.
CreateH2(
"hTrdElLikePur", {
"El",
"Bg"},
"P [GeV/c]",
"Likelihood output", ax, 100, 0., 10., 100, 0., 1.);
133 fH.
CreateH2(
"hTtCut", {
"all",
"pion",
"truePair"},
fH.
fSrcNames,
"#sqrt{p_{e^{#pm}} p_{rec}} [GeV/c]",
134 "#theta_{e^{+},e^{-}} [deg]", ax, 100, 0., 5., 100, 0., 5.);
135 fH.
CreateH2(
"hStCut", {
"all",
"pion",
"truePair"},
fH.
fSrcNames,
"#sqrt{p_{e^{#pm}} p_{rec}} [GeV/c]",
136 "#theta_{e^{#pm},rec} [deg]", ax, 100, 0., 5., 100, 0., 5.);
137 fH.
CreateH2(
"hRtCut", {
"all",
"pion",
"truePair"},
fH.
fSrcNames,
"#sqrt{p_{e^{#pm}} p_{rec}} [GeV/c]",
138 "#theta_{e^{#pm},rec} [deg]", ax, 100, 0., 5., 100, 0., 5.);
140 fH.
CreateH2(
"hMvdCut", {
"1",
"2"},
fH.
fSrcNames,
"d_{MVD} [cm]",
"P_{e} [GeV/c]", ax, 100, 0., 1., 100, 0., 5.);
141 fH.
CreateH2(
"hMvdXY", {
"1",
"2"},
fH.
fSrcNames,
"X [cm]",
"Y [cm]", ax, 60, -6., 6., 60, -6., 6.);
154 for (std::string comb : {
"PM",
"PP",
"MM"}) {
155 for (std::string cat : {
"",
"_urqmdAll",
"_urqmdEl"}) {
156 string hName =
"hMinvComb" + comb + cat;
162 "M_{ee} [GeV/c^{2}]", ax, 250, 0., 2.5);
164 fH.
CreateH1(
"hMinvBgSource2_elid", {
"gg",
"pipi",
"pi0pi0",
"oo",
"gpi",
"gpi0",
"go",
"pipi0",
"pio",
"pi0o"},
165 "M_{ee} [GeV/c^{2}]", axMinv, 250, 0., 2.5);
167 fH.
CreateH2(
"hMinvPt",
fH.
fSrcNames,
fH.
fAnaStepNames,
"M_{ee} [GeV/c^{2}]",
"P_{t} [GeV/c]", ax, 100, 0., 2., 25, 0.,
171 fH.
CreateH2(
"hPtYPairSignal",
fH.
fAnaStepNames,
"Rapidity",
"P_{t} [GeV/c]", ax, 40, 0., 4., 20, 0., 2.);
174 for (std::string suff : {
"",
"+",
"-"}) {
183 fH.
CreateH1(
"hMomAcc+", {
"sts",
"rich",
"trd",
"tof"},
fH.
fSrcNames,
"P [GeV/c]", ax, 100, 0., 10.);
184 fH.
CreateH1(
"hMomAcc-", {
"sts",
"rich",
"trd",
"tof"},
fH.
fSrcNames,
"P [GeV/c]", ax, 100, 0., 10.);
186 fH.
CreateH1(
"hElMom", {
"all",
"prim"}, {
"mc",
"acc",
"recSts",
"recStsRich",
"recStsRichTrd",
"recStsRichTrdTof"},
187 "P [GeV/c]", ax, 100, 0., 10.);
188 fH.
CreateH1(
"hPiMom", {
"all",
"prim"}, {
"mc",
"acc",
"recSts",
"recStsRich",
"recStsRichTrd",
"recStsRichTrdTof"},
189 "P [GeV/c]", ax, 100, 0., 10.);
190 fH.
CreateH1(
"hProtonMom", {
"all",
"prim"}, {
"mc",
"acc",
"recSts",
"recStsRich",
"recStsRichTrd",
"recStsRichTrdTof"},
191 "P [GeV/c]", ax, 100, 0., 10.);
192 fH.
CreateH1(
"hKaonMom", {
"all",
"prim"}, {
"mc",
"acc",
"recSts",
"recStsRich",
"recStsRichTrd",
"recStsRichTrdTof"},
193 "P [GeV/c]", ax, 100, 0., 10.);
199 fH.
CreateH2(
"hPtY_gTracks",
fH.
fGTrackNames,
"Rapidity",
"P_{t} [GeV/c]", ax, 40, 0., 4., 20, 0., 2.);
200 fH.
CreateH2(
"hPtY_cands",
fH.
fCandNames,
fH.
fAnaStepNames,
"Rapidity",
"P_{t} [GeV/c]", ax, 40, 0., 4., 20, 0., 2.);
201 fH.
CreateH2(
"hTofM2_gTracks",
fH.
fGTrackNames,
"P [GeV/c]",
"m^{2} [GeV/c^{2}]^{2}", ax, 100, 0., 10., 500, -0.1, 1.);
206 fH.
CreateH1(
"hTofPilePdgs_gTracks",
"Particle", ax, 12, 0., 12.);
207 fH.
CreateH2(
"hTofPileHitXY",
fH.
fCandNames,
"X [cm]",
"Y [cm]", ax, 110., -550., 550., 90., -450., 450.);
208 fH.
CreateH2(
"hTofPilePointXY",
fH.
fCandNames,
"X [cm]",
"Y [cm]", ax, 110., -550., 550., 90., -450., 450.);
210 fH.
CreateH2(
"hTofPilePty_cands",
fH.
fCandNames,
"Rapidity",
"P_{t} [GeV/c]", ax, 40, 0., 4., 20, 0., 2.);
214 110., -550., 550., 90., -450.,
216 fH.
CreateH2(
"hTofHitXY", {
"trueid",
"misid",
"truematch",
"mismatch"},
fH.
fGTrackNames,
"X [cm]",
"Y [cm]", ax, 110.,
217 -550., 550., 90., -450., 450.);
219 "#sqrt{dX^{2} + dY^{2}} [cm]", ax, 400., 0., 20.);
221 "Distance [cm]", ax, 100, 0., 10., 200., 0., 50.);
222 fH.
CreateH2(
"hTofHitTrackDist_cands",
fH.
fCandNames,
"P [GeV/c]",
"Distance [cm]", ax, 100, 0., 10., 200., 0., 50.);
226 100, 0., 10., 200., 0., 2.);
231 fH.
CreateH2(
"hPtY_" +
fH.
fCandNames[iP], {
"true",
"misid"},
"Rapidity",
"P_{t} [GeV/c]", ax, 40, 0., 4., 40, 0.,
233 fH.
CreateH2(
"hTofM2_" +
fH.
fCandNames[iP], {
"true",
"misid"},
"P [GeV/c]",
"m^{2} [GeV/c^{2}]^{2}", ax, 100, 0.,
238 fH.
CreateH2(
"hBetaMom", {
"gTracks",
"cands"},
fH.
fCandNames,
"P * Q ",
"beta", ax, 200, -10., 10., 150., 0., 1.5);
239 fH.
CreateH2(
"hBetaMom_allGTracks",
"P * Q ",
"beta", ax, 200, -10., 10., 150., 0., 1.5);
242 fH.
CreateH2(
"hVertexGTrackRZ",
"Z [cm]",
"R [cm]", ax, 1500, -50., 100., 1000, -50., 50.);
248 fH.
CreateH2(
"hPdgVsMom_gTracks", {
"rich",
"trd",
"tof"}, {
"all",
"complete"},
"P [GeV/c]",
"Misid. Particle",
249 "Yield/(Event * Bin)", 200, 0., 10., 6, 0., 6.);
251 fH.
CreateH2(
"hTofM2Calc_gTracks",
fH.
fGTrackNames,
"Time",
"",
"Yield", 100., 5., 15., 4., 0., 4.);
253 "Time (ct) [m]",
"Yield", 100., 0., 10., 100., 5., 15.);
254 fH.
CreateH2(
"hTofTimeVsMom_cands",
fH.
fCandNames,
"P [GeV/c]",
"Time (ct) [m]",
"Yield", 100., 0., 10., 100., 5.,
256 fH.
CreateH2(
"hRichRingTrackDist_gTracks",
fH.
fGTrackNames,
"P [GeV/c]",
"D [cm]",
"Yield", 100., 0., 10., 200., 0.,
262 fH.
CreateH2(
"hChi2VsMom", {
"sts",
"rich",
"trd",
"tof"},
fH.
fCandNames,
"P [GeV/c]",
"#chi^{2}", ax, 100., 0., 10.,
264 fH.
CreateH2(
"hTofTimeVsChi2", {
"sts",
"rich",
"trd",
"tof"},
fH.
fCandNames,
"#chi^{2}",
"Time (ct) [m]", ax, 200., 0.,
267 "#chi^{2}_{1}",
"#chi^{2}_{2}", ax, 200., 0., 20., 200, 0., 20.);
296 FairRootManager* fairRootMan = FairRootManager::Instance();
297 fTofTracks = (TClonesArray*) fairRootMan->GetObject(
"TofTrack");
298 if (
fTofTracks ==
nullptr) { LOG(warning) <<
"LmvmTask::Init : no TofTrack array!"; }
320 cout <<
"========================================================" << endl;
324 LOG(info) <<
"fW = " <<
fW;
328 Fatal(
"LmvmTask::Exec",
"No PrimaryVertex array!");
344 LOG(info) <<
"fCandsTotal.size = " <<
fCandsTotal.size();
351 int nofRichHits =
fRichHits->GetEntriesFast();
352 for (
int iHit = 0; iHit < nofRichHits; iHit++) {
354 if (hit ==
nullptr || hit->
GetRefId() < 0)
continue;
356 if (point ==
nullptr)
continue;
358 if (track ==
nullptr || track->
GetMotherId() < 0)
continue;
377 if ((mct !=
nullptr && cand !=
nullptr) || (mct ==
nullptr && cand ==
nullptr)) {
378 LOG(error) <<
"LmvmTask::FillMomHists: Both mct and cand are [not nullptr] or [nullptr].";
381 bool isMc = (mct !=
nullptr);
385 for (
const string& suff : {string(
""), chargeStr}) {
386 if (suff ==
"0")
continue;
398 int nMcTracks =
fMCTracks->GetEntriesFast();
399 LOG(info) <<
"nMcTracks = " << nMcTracks;
401 for (
int i = 0; i < nMcTracks; i++) {
403 if (mct ==
nullptr)
continue;
405 string chargeStr = (mct->
GetCharge() > 0) ?
"+" :
"-";
407 double mom = mct->
GetP();
414 fH.
FillH1(
"hMomAcc" + chargeStr +
"_sts", src, mom, w);
424 fH.
FillH2(
"hVertexGammaXZ", step,
v.Z(),
v.X());
425 fH.
FillH2(
"hVertexGammaYZ", step,
v.Z(),
v.Y());
426 fH.
FillH2(
"hVertexGammaXY", step,
v.X(),
v.Y());
427 fH.
FillH2(
"hVertexGammaRZ", step,
v.Z(), sqrt(
v.X() *
v.X() +
v.Y() *
v.Y()));
433 if (std::abs(mcPdg) == 11 || mcPdg == 99009911) {
437 if (mother !=
nullptr) mcMotherPdg = mother->
GetPdgCode();
439 if (std::abs(mcPdg) == 11) {
440 fH.
FillH1(
"hMotherPdg_mc", mcMotherPdg);
441 if (isAcc)
fH.
FillH1(
"hMotherPdg_acc", mcMotherPdg);
453 for (
int iMc1 = 0; iMc1 < nMcTracks; iMc1++) {
461 for (
int iMc2 = iMc1 + 1; iMc2 < nMcTracks; iMc2++) {
492 int nofRichHits =
fRichHits->GetEntriesFast();
493 for (
int iH = 0; iH < nofRichHits; iH++) {
495 if (richHit ==
nullptr || richHit->
GetRefId() < 0)
continue;
496 FairMCPoint* pointPhoton =
static_cast<FairMCPoint*
>(
fRichPoints->At(richHit->
GetRefId()));
497 if (pointPhoton ==
nullptr)
continue;
499 if (trackPhoton ==
nullptr || trackPhoton->
GetMotherId() < 0)
continue;
501 if (mct ==
nullptr)
continue;
507 if (
v.Z() < 2.) {
fH.
FillH2(
"hPmtXY", src, richHit->
GetX(), richHit->
GetY(), w); }
514 if (tr ==
nullptr)
return false;
522 int nofMcTracks =
fMCTracks->GetEntriesFast();
524 for (
int i = 0; i < nofMcTracks; i++) {
531 if (std::abs(pdg) == 11 || std::abs(pdg) == 211 || pdg == 2212 || std::abs(pdg) == 321) {
532 string hName = (std::abs(pdg) == 11) ?
"hEl" : (std::abs(pdg) == 211) ?
"hPi" : pdg == 2212 ?
"hProton" :
"hKaon";
534 if (isAccSts)
fH.
FillH1(hName +
"Mom_all_acc", mct->
GetP());
536 if (vertex.Mag() <= 0.1) {
538 if (isAccSts)
fH.
FillH1(hName +
"Mom_prim_acc", mct->
GetP());
544 for (
int i = 0; i < ngTracks; i++) {
546 if (gTrack ==
nullptr)
continue;
552 if (stsInd < 0)
continue;
554 if (stsTrack ==
nullptr)
continue;
556 if (stsMatch ==
nullptr || stsMatch->
GetNofLinks() == 0)
continue;
558 if (stsMcTrackId < 0)
continue;
560 if (mct ==
nullptr)
continue;
565 double p = mct->
GetP();
566 double pt = mct->
GetPt();
573 if (std::abs(pdg) == 11 || std::abs(pdg) == 211 || pdg == 2212 || std::abs(pdg) == 321) {
574 string hName = (std::abs(pdg) == 11) ?
"hEl" : (std::abs(pdg) == 211) ?
"hPi" : pdg == 2212 ?
"hProton" :
"hKaon";
575 fH.
FillH1(hName +
"Mom_all_recSts", p);
576 if (isRich)
fH.
FillH1(hName +
"Mom_all_recStsRich", p);
577 if (isRich && isTrd)
fH.
FillH1(hName +
"Mom_all_recStsRichTrd", p);
578 if (isRich && isTrd && isTof)
fH.
FillH1(hName +
"Mom_all_recStsRichTrdTof", p);
581 fH.
FillH1(hName +
"Mom_prim_recSts", p);
582 if (isRich)
fH.
FillH1(hName +
"Mom_prim_recStsRich", p);
583 if (isRich && isTrd)
fH.
FillH1(hName +
"Mom_prim_recStsRichTrd", p);
584 if (isRich && isTrd && isTof)
fH.
FillH1(hName +
"Mom_prim_recStsRichTrdTof", p);
590 fH.
FillH2(
"hVertexGTrackRZ",
v.Z(), sqrt(
v.X() *
v.X() +
v.Y() *
v.Y()));
602 if (gTrack !=
nullptr) {
CheckMismatches(gTrack, pdg, isElectron, ptcl, w); }
603 if (std::abs(pdg) != 11)
PidVsMom(gTrack, i, pdg, p);
606 fH.
FillH2(
"hRichRingTrackDist_gTracks_" + ptcl, p, richDist);
614 fH.
FillH1(
"hMom_gTracks_" + ptcl, p);
615 fH.
FillH2(
"hPtY_gTracks_" + ptcl, rap, pt);
616 fH.
FillH2(
"hTofM2_gTracks_" + ptcl, p, m2);
619 if (p > 0.3 && p < 1. && m2 > -0.012 && m2 < 0.01) {
621 double pdgBin = (pdg == 11 && isSignal) ? 0.5
622 : (pdg == -11 && isSignal) ? 1.5
623 : (pdg == 11 && !isSignal && isPrim) ? 2.5
624 : (pdg == -11 && !isSignal && isPrim) ? 3.5
625 : (pdg == 11 && !isSignal && !isPrim) ? 4.5
626 : (pdg == -11 && !isSignal && !isPrim) ? 5.5
628 : (pdg == -211) ? 7.5
629 : (pdg == 2212) ? 8.5
631 : (pdg == -321) ? 10.5
633 fH.
FillH1(
"hTofPilePdgs_gTracks", pdgBin);
637 if (!isElectron && !(ptcl2 ==
"plutoEl+" || ptcl2 ==
"plutoEl-" || ptcl2 ==
"urqmdEl+" || ptcl2 ==
"urqmdEl-")) {
638 fH.
FillH1(
"hMom_" + ptcl2 +
"_true", p);
639 fH.
FillH2(
"hPtY_" + ptcl2 +
"_true", rap, pt);
640 fH.
FillH2(
"hTofM2_" + ptcl2 +
"_true", p, m2);
643 && !(ptcl2 ==
"plutoEl+" || ptcl2 ==
"plutoEl-" || ptcl2 ==
"urqmdEl+" || ptcl2 ==
"urqmdEl-")) {
644 fH.
FillH1(
"hMom_" + ptcl2 +
"_misid", p);
645 fH.
FillH2(
"hPtY_" + ptcl2 +
"_misid", rap, pt);
646 fH.
FillH2(
"hTofM2_" + ptcl2 +
"_misid", p, m2);
661 double pdgBin = (pdg == 211) ? 0.5
662 : (pdg == -211) ? 1.5
663 : (pdg == 2212) ? 2.5
665 : (pdg == -321) ? 4.5
668 if (isRichEl)
fH.
FillH2(
"hPdgVsMom_gTracks_rich_all", p, pdgBin);
669 if (isTrdEl)
fH.
FillH2(
"hPdgVsMom_gTracks_trd_all", p, pdgBin);
670 if (isTofEl)
fH.
FillH2(
"hPdgVsMom_gTracks_tof_all", p, pdgBin);
672 if (isRichEl &&
IsInAllDets(gTrack))
fH.
FillH2(
"hPdgVsMom_gTracks_rich_complete", p, pdgBin);
673 if (isTrdEl &&
IsInAllDets(gTrack))
fH.
FillH2(
"hPdgVsMom_gTracks_trd_complete", p, pdgBin);
674 if (isTofEl &&
IsInAllDets(gTrack))
fH.
FillH2(
"hPdgVsMom_gTracks_tof_complete", p, pdgBin);
678 int pdg,
bool isTofEl)
682 if (stsInd < 0)
return;
684 if (stsMatch ==
nullptr || stsMatch->
GetNofLinks() == 0)
return;
686 if (stsMcTrackId < 0)
return;
690 if (tofInd < 0)
return;
692 if (tofHit ==
nullptr)
return;
694 if (tofTrack ==
nullptr)
return;
696 if (tofHitMatch ==
nullptr)
return;
698 if (tofPointIndex < 0)
return;
699 FairMCPoint* tofPoint =
static_cast<FairMCPoint*
>(
fTofPoints->At(tofPointIndex));
700 if (tofPoint ==
nullptr)
return;
701 int tofMcTrackId = tofPoint->GetTrackID();
703 bool isTofMismatch = (tofMcTrackId == stsMcTrackId) ?
false :
true;
704 bool isTofMisid = (std::abs(pdg) == 11 && isTofEl) ?
false : (std::abs(pdg) != 11 && !isTofEl) ?
false :
true;
706 double pointX = tofPoint->GetX();
707 double pointY = tofPoint->GetY();
708 double hitX = tofHit->
GetX();
709 double hitY = tofHit->
GetY();
710 double dX = pointX - hitX;
711 double dY = pointY - hitY;
712 double dR =
sqrt(dX * dX + dY * dY);
715 string hNameId = (!isTofMisid) ?
"_trueid_" + gtString :
"_misid_" + gtString;
716 fH.
FillH2(
"hTofPointXY" + hNameId, pointX, pointY);
717 fH.
FillH2(
"hTofHitXY" + hNameId, hitX, hitY);
718 fH.
FillH1(
"hTofHitPointDist" + hNameId, dR);
719 fH.
FillH2(
"hTofHitTrackDist_gTracks" + hNameId, pMc, dist);
721 string hNameMatch = (!isTofMismatch) ?
"_truematch_" + gtString :
"_mismatch_" + gtString;
722 fH.
FillH2(
"hTofPointXY" + hNameMatch, pointX, pointY);
723 fH.
FillH2(
"hTofHitXY" + hNameMatch, hitX, hitY);
724 fH.
FillH1(
"hTofHitPointDist" + hNameMatch, dR);
725 fH.
FillH2(
"hTofHitTrackDist_gTracks" + hNameMatch, pMc, dist);
728 double eventTime = FairRunAna::Instance()->GetEventHeader()->GetEventTime();
729 Double_t noOffsetTime = tofHit->
GetTime() - eventTime;
730 Double_t t = 0.2998 * noOffsetTime;
732 fH.
FillH2(
"hTofTimeVsMom_gTracks" + hNameId, pMc, t);
733 fH.
FillH2(
"hTofTimeVsMom_gTracks" + hNameMatch, pMc, t);
735 if (!isTofMisid)
fH.
FillH2(
"hTofM2Calc_gTracks_" + gtString, t, 0.5);
736 if (isTofMisid)
fH.
FillH2(
"hTofM2Calc_gTracks_" + gtString, t, 1.5);
737 if (!isTofMismatch)
fH.
FillH2(
"hTofM2Calc_gTracks_" + gtString, t, 2.5);
738 if (isTofMismatch)
fH.
FillH2(
"hTofM2Calc_gTracks_" + gtString, t, 3.5);
741 if (isTofEl && std::abs(pdg) != 11 &&
IsInTofPile(pMc, m2)) {
748 fH.
FillH2(
"hTofPileHitXY_" + candString, hitX, hitY);
749 fH.
FillH2(
"hTofPilePointXY_" + candString, pointX, pointY);
750 fH.
FillH1(
"hTofPileHitPointDist_" + candString, dR);
757 if (tofInd < 0)
return;
759 if (NULL == tofHit)
return;
760 double eventTime = FairRunAna::Instance()->GetEventHeader()->GetEventTime();
761 Double_t noOffsetTime = tofHit->
GetTime() - eventTime;
763 double p = mct->
GetP();
765 double t = 0.2998 * noOffsetTime;
767 double beta = l / (t * 100);
768 fH.
FillH2(
"hBetaMom_gTracks_" + ptcl, q * p, beta);
769 fH.
FillH2(
"hBetaMom_allGTracks", q * p, beta);
776 if (stsInd < 0)
return;
778 if (stsMatch ==
nullptr || stsMatch->
GetNofLinks() == 0)
return;
780 if (stsMcTrackId < 0)
return;
787 vector<CbmStsTrack> stsTracks;
789 stsTracks[0] = *stsTrack;
790 vector<CbmL1PFFitter::PFFieldRegion> vField;
791 vector<float> chiPrim;
793 double chi2 = stsTracks[0].GetChiSq() / stsTracks[0].GetNDF();
807 int nofMismTrackSegmentsAll = 0;
808 int nofMismTrackSegmentsComp = 0;
810 fH.
FillH1(
"hNofMismatches_gTracks_all_" + ptcl, 0.5, w);
811 if (isFull)
fH.
FillH1(
"hNofMismatches_gTracks_complete_" + ptcl, 0.5, w);
813 if (richMatch !=
nullptr) {
815 if (richMcTrackId >= 0)
fH.
FillH1(
"hNofMismatches_gTracks_all_" + ptcl, 1.5, w);
816 if (richMcTrackId >= 0 && richMcTrackId == stsMcTrackId)
fH.
FillH1(
"hChi2_truematch_all_rich_" + ptcl, chi2, w);
817 if (richMcTrackId >= 0 && richMcTrackId != stsMcTrackId) {
818 fH.
FillH1(
"hChi2_mismatch_all_rich_" + ptcl, chi2, w);
819 fH.
FillH1(
"hNofMismatches_gTracks_all_" + ptcl, 2.5, w);
820 nofMismTrackSegmentsAll++;
823 if (richMcTrackId >= 0)
fH.
FillH1(
"hNofMismatches_gTracks_complete_" + ptcl, 1.5, w);
824 if (richMcTrackId >= 0 && richMcTrackId == stsMcTrackId)
825 fH.
FillH1(
"hChi2_truematch_complete_rich_" + ptcl, chi2, w);
826 if (richMcTrackId >= 0 && richMcTrackId != stsMcTrackId) {
827 fH.
FillH1(
"hChi2_mismatch_complete_rich_" + ptcl, chi2, w);
828 fH.
FillH1(
"hNofMismatches_gTracks_complete_" + ptcl, 2.5, w);
829 nofMismTrackSegmentsComp++;
834 if (trdMatch !=
nullptr) {
836 if (trdMcTrackId >= 0)
fH.
FillH1(
"hNofMismatches_gTracks_all_" + ptcl, 3.5, w);
837 if (trdMcTrackId >= 0 && trdMcTrackId == stsMcTrackId)
fH.
FillH1(
"hChi2_truematch_all_trd_" + ptcl, chi2, w);
838 if (trdMcTrackId >= 0 && trdMcTrackId != stsMcTrackId) {
839 fH.
FillH1(
"hNofMismatches_gTracks_all_" + ptcl, 4.5, w);
840 fH.
FillH1(
"hChi2_mismatch_all_trd_" + ptcl, chi2, w);
841 nofMismTrackSegmentsAll++;
844 if (trdMcTrackId >= 0)
fH.
FillH1(
"hNofMismatches_gTracks_complete_" + ptcl, 3.5, w);
845 if (trdMcTrackId >= 0 && trdMcTrackId == stsMcTrackId)
fH.
FillH1(
"hChi2_truematch_complete_trd_" + ptcl, chi2, w);
846 if (trdMcTrackId >= 0 && trdMcTrackId != stsMcTrackId) {
847 fH.
FillH1(
"hNofMismatches_gTracks_complete_" + ptcl, 4.5, w);
848 fH.
FillH1(
"hChi2_mismatch_complete_trd_" + ptcl, chi2, w);
849 nofMismTrackSegmentsComp++;
856 if (tofPoint !=
nullptr) {
857 int tofMcTrackId = tofPoint->GetTrackID();
858 if (tofMcTrackId >= 0)
fH.
FillH1(
"hNofMismatches_gTracks_all_" + ptcl, 5.5, w);
859 if (tofMcTrackId >= 0 && tofMcTrackId == stsMcTrackId)
fH.
FillH1(
"hChi2_truematch_all_tof_" + ptcl, chi2, w);
860 if (tofMcTrackId >= 0 && tofMcTrackId != stsMcTrackId) {
861 fH.
FillH1(
"hNofMismatches_gTracks_all_" + ptcl, 6.5, w);
862 fH.
FillH1(
"hChi2_mismatch_all_tof_" + ptcl, chi2, w);
863 nofMismTrackSegmentsAll++;
866 if (tofMcTrackId >= 0)
fH.
FillH1(
"hNofMismatches_gTracks_complete_" + ptcl, 5.5, w);
867 if (tofMcTrackId >= 0 && tofMcTrackId == stsMcTrackId)
868 fH.
FillH1(
"hChi2_truematch_complete_tof_" + ptcl, chi2, w);
869 if (tofMcTrackId >= 0 && tofMcTrackId != stsMcTrackId) {
870 fH.
FillH1(
"hNofMismatches_gTracks_complete_" + ptcl, 6.5, w);
871 fH.
FillH1(
"hChi2_mismatch_complete_tof_" + ptcl, chi2, w);
872 nofMismTrackSegmentsComp++;
878 fH.
FillH1(
"hNofMismatchedTrackSegments_all_" + ptcl, nofMismTrackSegmentsAll + 0.5, w);
879 if (isFull)
fH.
FillH1(
"hNofMismatchedTrackSegments_complete_" + ptcl, nofMismTrackSegmentsComp + 0.5, w);
881 bool isTrueId = (std::abs(pdg) == 11 && isElectron) ?
true : (std::abs(pdg) != 11 && !isElectron) ?
true :
false;
882 double binX = nofMismTrackSegmentsComp + 0.5;
883 double binY = (isTrueId ==
true) ? 0.5 : 1.5;
885 fH.
FillH2(
"hMatchId_gTracks_" + ptcl, binX, binY, w);
890 if (gTrack ==
nullptr)
return false;
893 if (stsInd < 0)
return false;
895 if (stsTrack ==
nullptr)
return false;
900 if (richInd < 0 || trdInd < 0 || tofInd < 0)
return false;
905 if (richRing ==
nullptr || trdTrack ==
nullptr || tofHit ==
nullptr)
return false;
916 for (
int iGTrack = 0; iGTrack < ngTracks; iGTrack++) {
920 if (gTrack ==
nullptr)
continue;
923 if (cand.
fStsInd < 0)
continue;
925 if (stsTrack ==
nullptr)
continue;
943 bool isRichRT = (cand.
fRichInd < 0) ?
false :
true;
946 if (richRing ==
nullptr) isRichRT =
false;
951 bool isTrdRT = (cand.
fTrdInd < 0) ?
false :
true;
954 if (trdTrack ==
nullptr) isTrdRT =
false;
959 bool isTofRT = (cand.
fTofInd < 0) ?
false :
true;
962 if (tofHit ==
nullptr) isTofRT =
false;
966 if (isRichRT || isTrdRT || isTofRT) {
970 LOG(info) <<
"fSTCands.size = " <<
fSTCands.size();
971 LOG(info) <<
"fRTCands.size = " <<
fRTCands.size();
984 for (
int iGTrack = 0; iGTrack < nGTracks; iGTrack++) {
992 if (gTrack ==
nullptr)
continue;
996 if (cand.
fStsInd < 0)
continue;
998 if (stsTrack ==
nullptr)
continue;
1011 if (NULL != tofHit) {
1012 double eventTime = FairRunAna::Instance()->GetEventHeader()->GetEventTime();
1013 Double_t noOffsetTime = tofHit->
GetTime() - eventTime;
1014 cand.
fTime = 0.2998 * noOffsetTime;
1025 if (stsMatch ==
nullptr || stsMatch->
GetNofLinks() == 0)
continue;
1029 if (mcTrack1 ==
nullptr)
continue;
1032 const FairTrackParam*
richProj =
static_cast<FairTrackParam*
>(
fRichProj->At(iGTrack));
1035 if (std::abs(mcTrack1->
GetPdgCode()) == 211) {
1050 if (richRing ==
nullptr || trdTrack ==
nullptr || tofHit ==
nullptr || tofTrack ==
nullptr)
continue;
1069 LOG(info) <<
"fTTCands.size = " <<
fTTCands.size();
1070 LOG(info) <<
"fCands.size = " <<
fCands.size();
1079 for (
size_t iC1 = 0; iC1 < nCand - 1; iC1++) {
1082 for (
size_t iC2 = iC1 + 1; iC2 < nCand; iC2++) {
1086 if (cand1.IsMcSignal()) w =
fW *
MinvScale(cand1.fMassSig);
1087 else if (cand2.IsMcSignal())
1089 bool isSameEvent = (cand1.fEventNumber == cand2.fEventNumber);
1092 if (!isSameEvent && cand1.IsMcSignal() && cand2.IsMcSignal())
1095 if (cand1.IsCutTill(step) && cand2.IsCutTill(step)) {
1099 if (cand1.fCharge * cand2.fCharge < 0) {
1102 cout <<
"LmvmTask::CombinatorialPairs(): e+e- same event (all). w = " << w
1108 if (cand1.fCharge < 0 && cand2.fCharge < 0) {
1111 cout <<
"LmvmTask::CombinatorialPairs(): e-e- same event (all). w = " << w
1117 if (cand1.fCharge > 0 && cand2.fCharge > 0) {
1120 cout <<
"LmvmTask::CombinatorialPairs(): e+e+ same event (all). w = " << w
1128 if (!cand1.IsMcSignal() && !cand2.IsMcSignal()) {
1130 if (cand1.fCharge * cand2.fCharge < 0)
fH.
FillH1(
"hMinvCombPM_urqmdAll_sameEv", step, pRec.
fMinv, w);
1131 else if (cand1.fCharge < 0 && cand2.fCharge < 0)
1132 fH.
FillH1(
"hMinvCombMM_urqmdAll_sameEv", step, pRec.
fMinv, w);
1133 else if (cand1.fCharge > 0 && cand2.fCharge > 0)
1134 fH.
FillH1(
"hMinvCombPP_urqmdAll_sameEv", step, pRec.
fMinv, w);
1137 if (cand1.fCharge * cand2.fCharge < 0)
fH.
FillH1(
"hMinvCombPM_urqmdAll_mixedEv", step, pRec.
fMinv, w);
1138 else if (cand1.fCharge < 0 && cand2.fCharge < 0)
1139 fH.
FillH1(
"hMinvCombMM_urqmdAll_mixedEv", step, pRec.
fMinv, w);
1140 else if (cand1.fCharge > 0 && cand2.fCharge > 0)
1141 fH.
FillH1(
"hMinvCombPP_urqmdAll_mixedEv", step, pRec.
fMinv, w);
1146 if (!cand1.IsMcSignal() && !cand2.IsMcSignal() && std::abs(cand1.fMcPdg) == 11
1147 && std::abs(cand2.fMcPdg) == 11) {
1149 if (cand1.fCharge * cand2.fCharge < 0)
fH.
FillH1(
"hMinvCombPM_urqmdEl_sameEv", step, pRec.
fMinv, w);
1150 else if (cand1.fCharge < 0 && cand2.fCharge < 0)
1151 fH.
FillH1(
"hMinvCombMM_urqmdEl_sameEv", step, pRec.
fMinv, w);
1152 else if (cand1.fCharge > 0 && cand2.fCharge > 0)
1153 fH.
FillH1(
"hMinvCombPP_urqmdEl_sameEv", step, pRec.
fMinv, w);
1156 if (cand1.fCharge * cand2.fCharge < 0)
fH.
FillH1(
"hMinvCombPM_urqmdEl_mixedEv", step, pRec.
fMinv, w);
1157 else if (cand1.fCharge < 0 && cand2.fCharge < 0)
1158 fH.
FillH1(
"hMinvCombMM_urqmdEl_mixedEv", step, pRec.
fMinv, w);
1159 else if (cand1.fCharge > 0 && cand2.fCharge > 0)
1160 fH.
FillH1(
"hMinvCombPP_urqmdEl_mixedEv", step, pRec.
fMinv, w);
1171 for (
auto& cand : cands) {
1172 cand.ResetMcParams();
1176 if (stsMatch ==
nullptr || stsMatch->
GetNofLinks() == 0)
continue;
1178 if (cand.fStsMcTrackId < 0)
continue;
1180 if (mct ==
nullptr)
continue;
1186 if (cand.IsMcSignal()) {
1187 int nMcTracks =
fMCTracks->GetEntries();
1188 for (
int iMc2 = 0; iMc2 < nMcTracks; iMc2++) {
1190 if (mct2->
GetMotherId() == cand.fMcMotherId && iMc2 != cand.fStsMcTrackId) {
1192 cand.fMassSig = pKin.
fMinv;
1201 if (richMatch ==
nullptr)
continue;
1206 if (trdMatch ==
nullptr)
continue;
1210 if (cand.fTofInd < 0)
continue;
1212 if (tofHit ==
nullptr)
continue;
1214 if (tofHitMatch ==
nullptr)
continue;
1216 if (tofPointIndex < 0)
continue;
1217 FairMCPoint* tofPoint =
static_cast<FairMCPoint*
>(
fTofPoints->At(tofPointIndex));
1218 if (tofPoint ==
nullptr)
continue;
1219 cand.fTofMcTrackId = tofPoint->GetTrackID();
1225 for (
auto& cand : topoCands) {
1226 cand.ResetMcParams();
1227 if (cand.fStsInd < 0)
continue;
1229 if (stsMatch ==
nullptr || stsMatch->
GetNofLinks() == 0)
continue;
1231 if (cand.fStsMcTrackId < 0)
continue;
1233 if (mct ==
nullptr)
continue;
1249 double indM = candM.
IsMcGamma() ? 0.5 : (candM.
IsMcPi0() ? 1.5 : (std::abs(candM.
fMcPdg) == 211) ? 2.5 : 3.5);
1250 double indP = candP.
IsMcGamma() ? 0.5 : (candP.
IsMcPi0() ? 1.5 : (std::abs(candP.
fMcPdg) == 211) ? 2.5 : 3.5);
1251 fH.
FillH2(
"hSrcBgPairsEpEm", step, indP, indM);
1257 fH.
FillH2(
"hSrcBgPairs",
static_cast<int>(step) + 0.5,
static_cast<double>(bgSrc) + 0.5);
1260 string hName =
"hMinvBgSource2_elid_";
1262 if (std::abs(candP.
fMcPdg) == 11) {
1269 else if (std::abs(candM.
fMcPdg) == 211)
1280 else if (std::abs(candM.
fMcPdg) == 211)
1291 else if (std::abs(candM.
fMcPdg) == 211)
1299 else if (std::abs(candP.
fMcPdg) == 211) {
1303 else if (std::abs(candM.
fMcPdg) == 211)
1314 else if (std::abs(candM.
fMcPdg) == 211)
1329 double stepBin =
static_cast<double>(step) + 0.5;
1334 int absPdg = std::abs(pdg);
1335 double pdgBin = (absPdg == 11 && cand.
IsMcSignal()) ? 0.5
1337 : (absPdg == 211) ? 2.5
1338 : (absPdg == 2212) ? 3.5
1339 : (absPdg == 321) ? 4.5
1353 fH.
FillH1(
"hNofBgTracks", stepBin);
1357 if (mctrack !=
nullptr) {
1360 fH.
FillH2(
"hVertexGammaXZ", step,
v.Z(),
v.X());
1361 fH.
FillH2(
"hVertexGammaYZ", step,
v.Z(),
v.Y());
1362 fH.
FillH2(
"hVertexGammaXY", step,
v.X(),
v.Y());
1363 fH.
FillH2(
"hVertexGammaRZ", step,
v.Z(), sqrt(
v.X() *
v.X() +
v.Y() *
v.Y()));
1367 double srcBin = 0.0;
1371 else if (std::abs(pdg) == 211)
1373 else if (pdg == 2212)
1375 else if (std::abs(pdg) == 321)
1381 fH.
FillH2(
"hBgSrcTracks", stepBin, srcBin);
1382 if (std::abs(cand.
fMcPdg) == 11)
fH.
FillH2(
"hCandElSrc", stepBin, srcBin);
1391 double pdgBinX = (std::abs(pdgX) == 11 && candP.
IsMcSignal()) ? 0.5
1392 : (std::abs(pdgX) == 11 && !candP.
IsMcSignal()) ? 1.5
1393 : (std::abs(pdgX) == 211) ? 2.5
1394 : (pdgX == 2212) ? 3.5
1395 : (pdgX == 321) ? 4.5
1396 : (pdgX == 3112 or pdgX == 3222) ? 5.5
1397 : (std::abs(pdgX) == 13) ? 6.5
1399 double pdgBinY = (std::abs(pdgY) == 11 && candM.
IsMcSignal()) ? 0.5
1400 : (std::abs(pdgY) == 11 && !candM.
IsMcSignal()) ? 1.5
1401 : (std::abs(pdgY) == 211) ? 2.5
1402 : (pdgY == 2212) ? 3.5
1403 : (pdgY == 321) ? 4.5
1404 : (pdgY == 3112 or pdgY == 3222) ? 5.5
1405 : (std::abs(pdgY) == 13) ? 6.5
1408 fH.
FillH2(
"hBgPairPdg", step, pdgBinX, pdgBinY);
1422 if (w < 0) LOG(warning) <<
"LmvmTask::FillPairHists(): Signal mass < 0!";
1439 if (isMismatch) {
fH.
FillH1(
"hMinvBgMatch_mismatch", step, parRec.
fMinv); }
1442 if (std::abs(candP.
fMcPdg) == 11 && std::abs(candM.
fMcPdg) == 11)
1444 if (std::abs(candP.
fMcPdg) != 11 || std::abs(candM.
fMcPdg) != 11)
1445 fH.
FillH1(
"hMinvBgMatch_trueMatchNotEl", step, parRec.
fMinv);
1452 if ((mct !=
nullptr && cand !=
nullptr) || (mct ==
nullptr && cand ==
nullptr)) {
1453 LOG(error) <<
"LmvmTask::GetPidString: Both mct and cand are [not nullptr] or [nullptr].";
1462 if (isMcSignal && pdg == -11) pidString =
fH.
fCandNames[0];
1463 else if (isMcSignal && pdg == 11)
1465 else if (!isMcSignal && pdg == -11)
1467 else if (!isMcSignal && pdg == 11)
1469 else if (pdg == 211)
1471 else if (pdg == -211)
1473 else if (pdg == 2212)
1475 else if (pdg == 321)
1477 else if (pdg == -321)
1492 else if (pdg == 211)
1494 else if (pdg == -211)
1496 else if (pdg == 2212)
1498 else if (pdg == 321)
1500 else if (pdg == -321)
1507 else if (pdg == 211)
1509 else if (pdg == -211)
1511 else if (pdg == 2212)
1513 else if (pdg == 321)
1515 else if (pdg == -321)
1534 for (
const auto& cand :
fCands) {
1535 double w = (cand.IsMcSignal()) ?
fW : 1.;
1537 if (cand.fStsMcTrackId >= 0) mcTrack =
static_cast<CbmMCTrack*
>(
fMCTracks->At(cand.fStsMcTrackId));
1539 double mom = mcTrack->
GetP();
1543 if (cand.IsCutTill(step)) {
1546 if (mcTrack !=
nullptr)
CheckTofId(mcTrack, cand, step, pdg);
1556 fH.
FillH2(
"hChi2VsMom_sts_" + pidString, cand.fMomentum.Mag(), cand.fChi2Sts, w);
1557 fH.
FillH2(
"hChi2VsMom_rich_" + pidString, cand.fMomentum.Mag(), cand.fChi2Rich, w);
1558 fH.
FillH2(
"hChi2VsMom_trd_" + pidString, cand.fMomentum.Mag(), cand.fChi2Trd, w);
1560 fH.
FillH2(
"hTofTimeVsChi2_sts_" + pidString, cand.fChi2Sts, cand.fTime, w);
1561 fH.
FillH2(
"hTofTimeVsChi2_rich_" + pidString, cand.fChi2Rich, cand.fTime, w);
1562 fH.
FillH2(
"hTofTimeVsChi2_trd_" + pidString, cand.fChi2Trd, cand.fTime, w);
1564 fH.
FillH2(
"hChi2Comb_StsRich_" + pidString, cand.fChi2Sts, cand.fChi2Rich, w);
1565 fH.
FillH2(
"hChi2Comb_StsTrd_" + pidString, cand.fChi2Sts, cand.fChi2Trd, w);
1566 fH.
FillH2(
"hChi2Comb_RichTrd_" + pidString, cand.fChi2Rich, cand.fChi2Trd, w);
1568 fH.
FillH2(
"hTofTimeVsMom_cands_" + pidString, cand.fMomentum.Mag(), cand.fTime, w);
1569 fH.
FillH2(
"hTofHitTrackDist_cands_" + pidString, cand.fMomentum.Mag(), cand.fTofDist, w);
1576 double p = cand.fMomentum.Mag();
1577 double m = cand.fMass;
1579 double beta = r /
sqrt(1. + r * r);
1580 double q = (cand.fCharge > 0) ? 1 : (cand.fCharge < 0) ? -1. : 0.;
1581 fH.
FillH2(
"hBetaMom_cands_" + ptcl, q * p, beta);
1585 for (
const auto& candP :
fCands) {
1586 if (candP.fCharge < 0)
continue;
1588 (candP.fStsMcTrackId >= 0) ?
static_cast<CbmMCTrack*
>(
fMCTracks->At(candP.fStsMcTrackId)) :
nullptr;
1589 for (
const auto& candM :
fCands) {
1590 if (candM.fCharge > 0)
continue;
1593 (candM.fStsMcTrackId >= 0) ?
static_cast<CbmMCTrack*
>(
fMCTracks->At(candM.fStsMcTrackId)) :
nullptr;
1599 if (candP.IsCutTill(step) && candM.IsCutTill(step))
FillPairHists(candP, candM, pMC, pRec, step);
1610 double pt = mct->
GetPt();
1616 double pdgBin = (pdg == 11 && cand.
IsMcSignal()) ? 0.5
1618 : (pdg == 11 && !cand.
IsMcSignal() && isPrim) ? 2.5
1619 : (pdg == -11 && !cand.
IsMcSignal() && isPrim) ? 3.5
1620 : (pdg == 11 && !cand.
IsMcSignal() && !isPrim) ? 4.5
1621 : (pdg == -11 && !cand.
IsMcSignal() && !isPrim) ? 5.5
1622 : (pdg == 211) ? 6.5
1623 : (pdg == -211) ? 7.5
1624 : (pdg == 2212) ? 8.5
1625 : (pdg == 321) ? 9.5
1626 : (pdg == -321) ? 10.5
1628 fH.
FillH1(
"hTofPilePdgs_cands", step, pdgBin);
1630 fH.
FillH2(
"hTofPilePty_cands_" + pidString, rap, pt);
1635 fH.
FillH2(
"hVertexXZ_misidTof", step,
v.Z(),
v.X());
1636 fH.
FillH2(
"hVertexYZ_misidTof", step,
v.Z(),
v.Y());
1637 fH.
FillH2(
"hVertexXY_misidTof", step,
v.X(),
v.Y());
1638 fH.
FillH2(
"hVertexRZ_misidTof", step,
v.Z(), sqrt(
v.X() *
v.X() +
v.Y() *
v.Y()));
1651 if (mct !=
nullptr) {
1654 fH.
FillH1(
"hMomRatio_cands_" + pidString, step, rat);
1655 fH.
FillH2(
"hMomRatioVsMom_cands_" + ptcl, step, mct->
GetP(), rat);
1661 for (
auto& candP :
fCands) {
1662 if (candP.fCharge < 0)
continue;
1663 for (
auto& candM :
fCands) {
1664 if (candM.fCharge > 0)
continue;
1668 candM.fIsGammaCut =
false;
1669 candP.fIsGammaCut =
false;
1678 string hcut = name +
"_all";
1679 string hcutPion = name +
"_pion";
1680 string hcutTruePair = name +
"_truePair";
1682 vector<LmvmDataAngMomInd> dataV;
1684 vector<LmvmCand>& tpCands =
fSTCands;
1693 LOG(error) <<
"LmvmTask::CheckTopologyCut cut is not defined.";
1696 for (
auto& cand :
fCands) {
1699 for (
size_t iM = 0; iM < tpCands.size(); iM++) {
1701 if (tpCands[iM].fCharge != cand.fCharge) {
1703 dataV.emplace_back(pRec.
fAngle, tpCands[iM].fMomentum.Mag(), iM);
1707 double minAng = 360.;
1709 for (
size_t i = 0; i < dataV.size(); i++) {
1710 if (minAng > dataV[i].fAngle) {
1711 minAng = dataV[i].fAngle;
1716 cand.SetIsTopologyCutElectron(cut,
true);
1720 cand.SetIsTopologyCutElectron(cut, isCut);
1723 double sqrt_mom = TMath::Sqrt(cand.fMomentum.Mag() * dataV[minInd].fMom);
1724 int cutCandInd = dataV[minInd].fInd;
1725 int stsInd = tpCands[cutCandInd].fStsInd;
1726 if (stsInd < 0)
continue;
1727 int pdgAbs = std::abs(tpCands[cutCandInd].fMcPdg);
1728 int motherId = tpCands[cutCandInd].fMcMotherId;
1730 fH.
FillH2(hcut, cand.fMcSrc, sqrt_mom, minAng,
fW);
1731 if (pdgAbs == 211)
fH.
FillH2(hcutPion, cand.fMcSrc, sqrt_mom, minAng,
fW);
1732 if (cand.IsMcSignal()) {
1733 if (motherId == cand.fMcMotherId)
fH.
FillH2(hcutTruePair, cand.fMcSrc, sqrt_mom, minAng,
fW);
1736 if (motherId != -1 && motherId == cand.fMcMotherId)
fH.
FillH2(hcutTruePair, cand.fMcSrc, sqrt_mom, minAng,
fW);
1744 size_t nCand =
fCands.size();
1745 for (
size_t iP = 0; iP < nCand; iP++) {
1748 if (src != cand.
fMcSrc)
continue;
1751 bool isAdded =
false;
1754 for (
int i = 0; i < 3; i++) {
1755 if (isAdded)
continue;
1756 vector<LmvmCand>& cands =
fSTCands;
1757 double binNum = 4.5;
1766 for (
const auto& candT : cands) {
1774 if (isAdded)
continue;
1776 for (
size_t iM = 0; iM <
fCands.size(); iM++) {
1783 if (isAdded)
continue;
1785 int nofStsPoints = 0;
1786 int nofMcTracks =
fMCTracks->GetEntriesFast();
1787 for (
int iMc = 0; iMc < nofMcTracks; iMc++) {
1791 int eventId = FairRun::Instance()->GetEventHeader()->GetMCEntryNumber();
1797 if (nofStsPoints == 0)
fH.
FillH1(name, 0.5);
1798 if (nofStsPoints >= 1 && nofStsPoints <= 3)
fH.
FillH1(name, 1.5);
1799 if (nofStsPoints >= 4 && nofStsPoints <= 5)
fH.
FillH1(name, 2.5);
1800 if (nofStsPoints >= 6)
fH.
FillH1(name, 3.5);
1832 if (stsTrack ==
nullptr)
return;
1836 double mvd1x = 0., mvd1y = 0., mvd2x = 0., mvd2y = 0.;
1839 if (mvdHit ==
nullptr)
return;
1841 mvd1x = mvdHit->
GetX();
1842 mvd1y = mvdHit->
GetY();
1845 mvd2x = mvdHit->
GetX();
1846 mvd2y = mvdHit->
GetY();
1849 double mvd1r =
sqrt(mvd1x * mvd1x + mvd1y * mvd1y);
1850 double mvd2r =
sqrt(mvd2x * mvd2x + mvd2y * mvd2y);
1861 vector<LmvmDataXYInd> mvdV;
1862 vector<LmvmDataXYInd> candV;
1864 for (
int iHit = 0; iHit <
fMvdHits->GetEntriesFast(); iHit++) {
1866 if (mvdHit !=
nullptr && mvdHit->
GetStationNr() == mvdStationNum) {
1867 mvdV.emplace_back(mvdHit->
GetX(), mvdHit->
GetY(), iHit);
1871 for (
size_t iC = 0; iC <
fCands.size(); iC++) {
1874 if (stsTrack ==
nullptr)
continue;
1877 if (candHit !=
nullptr && candHit->
GetStationNr() == mvdStationNum) {
1878 candV.emplace_back(candHit->
GetX(), candHit->
GetY(), iC);
1884 for (
size_t iC = 0; iC < candV.size(); iC++) {
1886 double minD = 9999999.;
1888 for (
size_t iH = 0; iH < mvdV.size(); iH++) {
1890 if (d2 < 1.e-9)
continue;
1892 minMvdInd = mvdV[iH].fInd;
1896 double dmvd =
sqrt(minD);
1901 if (hitMatch !=
nullptr) {
1903 int mcMvdHitPdg = TMath::Abs(mct1->
GetPdgCode());
1906 int stsMotherId = -2;
1909 stsMotherId = (mct2 !=
nullptr) ? mct2->
GetMotherId() : -2;
1912 bin = (mvdMotherId != -1 && mvdMotherId == stsMotherId) ? 0.5 : 1.5;
1914 bin = (mvdMotherId == stsMotherId && mcMvdHitPdg == 11) ? 0.5 : 1.5;
1924 if (mvdStationNum == 1) cand.
fIsMvd1Cut = isMvdCut;
1925 else if (mvdStationNum == 2)
1933 for (
const auto& cand :
fCands) {
1936 if (stsTrack ==
nullptr)
continue;
1939 if (mvdHit1 ==
nullptr)
continue;
1942 for (
int iMvd = 0; iMvd < nofMvdHits; iMvd++) {
1944 if (hitMatch ==
nullptr)
continue;
1951 fH.
FillH1(
"hMvdMcDist_2", cand.fMcSrc, d,
fW);
1960 if (vertexMag < fZ + 0.1 && vertexMag >
fZ - 0.1)
return true;
1967 TDirectory* oldir = gDirectory;
1968 TFile* outFile = FairRootManager::Instance()->GetOutFile();
1969 if (outFile !=
nullptr) {
1973 gDirectory->cd(oldir->GetPath());
@ kMvd
Micro-Vertex Detector.
@ kTrd
Transition Radiation Detector.
@ kTof
Time-of-flight Detector.
@ kSts
Silicon Tracking System.
Creates CbmLitMCTrack objects.
Data class for a reconstructed hit in the STS.
Data class for STS tracks.
Class for hits in TRD detector.
friend fvec sqrt(const fvec &a)
int32_t GetStsTrackIndex() const
int32_t GetRichRingIndex() const
int32_t GetTofHitIndex() const
int32_t GetTrdTrackIndex() const
void GetChiToVertex(std::vector< CbmStsTrack > &Tracks, std::vector< PFFieldRegion > &field, std::vector< float > &chiToVtx, CbmKFVertex &primVtx, float chiPrim=-1)
Bool_t IsTrdElectron(Int_t globalTrackindex, Double_t momentum)
Identify electron in RICH detector.
Double_t GetTofM2(Int_t globalTrackIndex, Double_t momentum, Double_t eventTime=1000.)
Return TOF m2 value.
Bool_t IsTofElectron(Int_t globalTrackIndex, Double_t momentum, Double_t eventTime=1000.)
Identify electron in RICH detector.
Bool_t IsRichElectron(Int_t globalTrackIndex, Double_t momentum)
Identify electron in RICH detector.
static CbmLitGlobalElectronId & GetInstance()
static CbmLitMCTrackCreator * Instance()
Singleton instance.
const CbmLitMCTrack & GetTrack(int mcEventId, int mcId) const
Return CbmLitMCTrack by its index.
UInt_t GetNofPointsInDifferentStations(ECbmModuleId detId) const
Return number of MC points in different stations for specified detector id.
double GetCharge() const
Charge of the associated particle.
uint32_t GetGeantProcessId() const
int32_t GetMotherId() const
int32_t GetPdgCode() const
double GetRapidity() const
void GetStartVertex(TVector3 &vertex) const
int32_t GetNPoints(ECbmModuleId detId) const
int32_t GetNofLinks() const
const CbmLink & GetMatchedLink() const
virtual int32_t GetStationNr() const
static double GetRingTrackDistance(int globalTrackId)
int32_t GetNofMvdHits() const
int32_t GetMvdHitIndex(int32_t iHit) const
int32_t GetNofStsHits() const
double GetDistance() const
double GetPidLikeEL() const
double GetPidLikePI() const
bool IsCutTill(ELmvmAnaStep step) const
bool IsChi2PrimaryOk(double chi2Prim)
bool IsMvdCutOk(int stationNum, double dmvd, double mom)
bool IsTopologyCutOk(ELmvmTopologyCut cut, double mom1, double mom2, double minAngle)
bool IsGammaCutOk(double minv)
bool IsPtCutOk(double pt)
void CreateH1(const std::string &name, const std::string &axisX, const std::string &axisY, double nBins, double min, double max)
static const std::vector< std::string > fCandNames
void FillH1(const std::string &name, double x, double w=1.)
static const std::vector< std::string > fBgPairSrcNames
void CreateH2(const std::string &name, const std::string &axisX, const std::string &axisY, const std::string &axisZ, double nBinsX, double minX, double maxX, double nBinsY, double minY, double maxY)
static const int fNofBgPairSrc
static const std::vector< std::string > fSrcNames
std::string GetName(const std::string &name, ELmvmAnaStep step)
void FillH2(const std::string &name, double x, double y, double w=1.)
static const std::vector< std::string > fGTrackNames
static const std::vector< ELmvmAnaStep > fAnaSteps
static const int fNofAnaSteps
static const std::vector< std::string > fAnaStepNames
static LmvmKinePar Create(const CbmMCTrack *mctrackP, const CbmMCTrack *mctrackM)
static Double_t GetWeight(const std::string &energy, const std::string &particle)
void CombinatorialPairs()
void CheckGammaConvAndPi0()
std::map< int, int > fNofHitsInRingMap
TClonesArray * fRichRingMatches
FairMCEventHeader * fMCEventHeader
std::vector< LmvmCand > fSTCands
void AssignMcToTopologyCands(std::vector< LmvmCand > &topoCands)
TClonesArray * fMvdHitMatches
TClonesArray * fRichRings
TClonesArray * fTofPoints
bool IsPrimary(double vertexMag)
double MinvScale(double minv)
TClonesArray * fTofHitsMatches
std::vector< LmvmCand > fCandsTotal
TClonesArray * fMvdPoints
void FillPairHists(const LmvmCand &candP, const LmvmCand &candM, const LmvmKinePar &parMc, const LmvmKinePar &parRec, ELmvmAnaStep step)
void BgPairPdg(const LmvmCand &candP, const LmvmCand &candM, ELmvmAnaStep step)
void CalculateNofTopologyPairs(const std::string &name, ELmvmSrc src)
void SetEnergyAndPlutoParticle(const std::string &energy, const std::string &particle)
TClonesArray * fRichPoints
std::vector< LmvmCand > fTTCands
std::vector< LmvmCand > fCands
void TrackSource(const LmvmCand &cand, ELmvmAnaStep step, int pdg)
bool IsInTofPile(double mom, double m2)
void AssignMcToCands(std::vector< LmvmCand > &cands)
void AnalyseGlobalTracks()
void CheckClosestMvdHit(int mvdStationNum, const std::string &hist, const std::string &histQa)
TClonesArray * fTofTracks
bool IsMcTrackAccepted(int mcTrackInd)
TClonesArray * fStsTrackMatches
virtual InitStatus Init()
virtual void Exec(Option_t *option)
void BetaMom(const CbmMCTrack *mct, const CbmGlobalTrack *gTrack, const std::string &ptcl)
TClonesArray * fTrdTracks
std::string GetPidString(const CbmMCTrack *mct, const LmvmCand *cand)
void CheckTofId(const CbmMCTrack *mcTrack, const LmvmCand &cand, ELmvmAnaStep step, int pdg)
T * InitOrFatal(const std::string &name)
void DifferenceSignalAndBg(const LmvmCand &cand)
void FillCandPidValues(const CbmMCTrack *mcTrack, const LmvmCand &cand, ELmvmAnaStep step)
TClonesArray * fTrdTrackMatches
void CheckTopologyCut(ELmvmTopologyCut cut, const std::string &name)
TClonesArray * fGlobalTracks
void CheckTofIdentification(const CbmGlobalTrack *gTrack, const std::string &pidString, double mom, double m2, int pdg, bool isTofEl)
void PidVsMom(const CbmGlobalTrack *gTrack, int iGTrack, int pdg, double mom)
std::vector< LmvmCand > fRTCands
void FillMomHists(const CbmMCTrack *mct, const LmvmCand *cand, ELmvmSrc src, ELmvmAnaStep step)
void FillRichRingNofHits()
void PairSource(const LmvmCand &candP, const LmvmCand &candM, ELmvmAnaStep step, const LmvmKinePar &parRec)
bool IsInAllDets(const CbmGlobalTrack *gTrack)
void CheckMismatches(const CbmGlobalTrack *gTrack, int pdg, bool isElectron, const std::string &ptcl, double weight)
TClonesArray * fStsTracks
static void IsTofElectron(int globalTrackIndex, double momentum, LmvmCand *cand)
static bool IsMcGammaEl(const CbmMCTrack *mct, TClonesArray *mcTracks)
static double Distance(double x1, double y1, double x2, double y2)
static ELmvmSrc GetMcPairSrc(const CbmMCTrack *mctP, const CbmMCTrack *mctM, TClonesArray *mcTracks)
static void IsElectronMc(LmvmCand *cand, TClonesArray *mcTracks, double pionMisidLevel)
static double GetMassScaleQgp(double minv)
static void IsElectron(int globalTrackIndex, double momentum, double momentumCut, LmvmCand *cand)
static ELmvmSrc GetMcSrc(CbmMCTrack *mctrack, TClonesArray *mcTracks)
static void IsTrdElectron(int globalTrackIndex, double momentum, LmvmCand *cand)
static void IsRichElectron(int globalTrackIndex, double momentum, LmvmCand *cand)
static bool IsMismatch(const LmvmCand &cand)
static bool IsGhost(const LmvmCand &cand)
static std::string GetChargeStr(const LmvmCand *cand)
static ELmvmBgPairSrc GetBgPairSrc(const LmvmCand &candP, const LmvmCand &candM)
static double GetMassScaleInmed(double minv)
static bool IsMcSignalEl(const CbmMCTrack *mct)
static void CalculateAndSetTrackParams(LmvmCand *cand, CbmStsTrack *stsTrack, CbmKFVertex &kfVertex)
static double Distance2(double x1, double y1, double x2, double y2)