28#include "FairMCPoint.h"
29#include "TClonesArray.h"
38#include <boost/assign/list_of.hpp>
43using boost::assign::list_of;
52 : FairTask(
"LitTrackingQA", 1)
56 , fMCTrackCreator(NULL)
63 , fUseConsecutivePointsInSts(true)
84 , fMvdHitMatches(NULL)
88 , fRichProjections(NULL)
89 , fRichRingMatches(NULL)
131 for (UInt_t i = 0; i < trackVariants.size(); i++) {
132 fMcToRecoMap.insert(make_pair(trackVariants[i], multimap<pair<Int_t, Int_t>, Int_t>()));
144 fHM->
H1(
"hen_EventNo_TrackingQa")->Fill(0.5);
145 Int_t eventNum =
fHM->
H1(
"hen_EventNo_TrackingQa")->GetEntries() - 1;
146 std::cout <<
"CbmLitTrackingQa::Exec: event=" << eventNum << std::endl;
159 TDirectory* oldir = gDirectory;
160 TFile* outFile = FairRootManager::Instance()->GetOutFile();
161 if (outFile != NULL) {
165 gDirectory->cd(oldir->GetPath());
176 FairRootManager* ioman = FairRootManager::Instance();
178 Fatal(
"Init",
"CbmRootManager is not instantiated");
184 Fatal(
"Init",
"No MCTrack array!");
187 fGlobalTracks = (TClonesArray*) ioman->GetObject(
"GlobalTrack");
189 Fatal(
"Init",
"No GlobalTrack array!");
195 Fatal(
"Init",
": No MvdPoint array!");
199 Fatal(
"Init",
": No MvdHitMatch array!");
204 fStsTracks = (TClonesArray*) ioman->GetObject(
"StsTrack");
206 Fatal(
"Init",
": No StsTrack array!");
208 fStsMatches = (TClonesArray*) ioman->GetObject(
"StsTrackMatch");
210 Fatal(
"Init",
": No StsTrackMatch array!");
215 fRichRings = (TClonesArray*) ioman->GetObject(
"RichRing");
217 Fatal(
"Init",
"No RichRing array!");
221 Fatal(
"Init",
"No RichProjection array!");
225 Fatal(
"Init",
"No RichRingMatch array!");
230 fMuchMatches = (TClonesArray*) ioman->GetObject(
"MuchTrackMatch");
232 Fatal(
"Init",
"No MuchTrackMatch array!");
237 fTrdMatches = (TClonesArray*) ioman->GetObject(
"TrdTrackMatch");
239 Fatal(
"Init",
"No TrdTrackMatch array!");
246 Fatal(
"Init",
"No TofPoint array!");
248 fTofMatches = (TClonesArray*) ioman->GetObject(
"TofHitMatch");
250 Fatal(
"Init",
"No TofHitMatch array!");
258 vector<string> tmp{
"All",
"Primary",
"Secondary",
"Reference", elMu,
259 "Proton",
"PionPlus",
"PionMinus",
"KaonPlus",
"KaonMinus"};
265 vector<string> tmp{
"All",
"AllReference",
"Electron",
"ElectronReference",
"Pion",
"PionReference"};
272 vector<string> tmp = list_of(
"Electron");
280 vector<string> tmp = list_of(
"Electron");
288 vector<string> tmp = list_of(
"All")(
"TrueMatch")(
"WrongMatch");
326 Int_t nofBins, Double_t minBin, Double_t maxBin,
const string& opt)
328 assert(opt ==
"track" || opt ==
"ring" || opt ==
"track_pid" || opt ==
"ring_pid");
329 vector<string> types = list_of(
"Acc")(
"Rec")(
"Eff");
335 for (UInt_t iCat = 0; iCat < cat.size(); iCat++) {
336 for (Int_t iType = 0; iType < 3; iType++) {
337 string yTitle = (types[iType] ==
"Eff") ?
"Efficiency [%]" :
"Counter";
338 string histName = name +
"_" + cat[iCat] +
"_" + types[iType] +
"_" + parameter;
339 string histTitle = histName +
";" + xTitle +
";" + yTitle;
340 fHM->
Add(histName,
new TH1F(histName.c_str(), histTitle.c_str(), nofBins, minBin, maxBin));
346 const string& yTitle, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX,
347 Int_t nofBinsY, Double_t minBinY, Double_t maxBinY,
const string& opt)
349 assert(opt ==
"track" || opt ==
"ring" || opt ==
"track_pid" || opt ==
"ring_pid");
350 vector<string> types = list_of(
"Acc")(
"Rec")(
"Eff");
356 for (UInt_t iCat = 0; iCat < cat.size(); iCat++) {
357 for (Int_t iType = 0; iType < 3; iType++) {
358 string zTitle = (types[iType] ==
"Eff") ?
"Efficiency [%]" :
"Counter";
359 string histName = name +
"_" + cat[iCat] +
"_" + types[iType] +
"_" + parameter;
360 string histTitle = histName +
";" + xTitle +
";" + yTitle +
";" + zTitle;
362 new TH2F(histName.c_str(), histTitle.c_str(), nofBinsX, minBinX, maxBinX, nofBinsY, minBinY, maxBinY));
368 Int_t nofBins, Double_t minBin, Double_t maxBin)
370 vector<string> types = list_of(
"RecPions")(
"Rec")(
"PionSup");
372 for (Int_t iType = 0; iType < 3; iType++) {
373 string yTitle = (types[iType] ==
"PionSup") ?
"Pion suppression" :
"Counter";
374 string histName = name +
"_" +
fPiSuppCategories[iCat] +
"_" + types[iType] +
"_" + parameter;
375 string histTitle = histName +
";" + xTitle +
";" + yTitle;
376 fHM->
Add(histName,
new TH1F(histName.c_str(), histTitle.c_str(), nofBins, minBin, maxBin));
382 Double_t minBin, Double_t maxBin)
384 TH1F*
h =
new TH1F(name.c_str(),
string(name +
";" + xTitle +
";" + yTitle).c_str(), nofBins, minBin, maxBin);
389 Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY,
392 TH2F*
h =
new TH2F(name.c_str(), (name +
";" + xTitle +
";" + yTitle +
";" + zTitle).c_str(), nofBinsX, minBinX,
393 maxBinX, nofBinsY, minBinY, maxBinY);
399 string type[] = {
"All",
"True",
"Fake",
"TrueOverAll",
"FakeOverAll"};
400 Double_t min[] = {-0.5, -0.5, -0.5, -0.1, -0.1};
401 Double_t max[] = {99.5, 99.5, 99.5, 1.1, 1.1};
402 Int_t bins[] = {100, 100, 100, 12, 12};
403 for (Int_t i = 0; i < 5; i++) {
404 string xTitle = (i == 3 || i == 4) ?
"Ratio" :
"Number of hits";
405 string histName =
"hth_" + detName +
"_TrackHits_" + type[i];
406 CreateH1(histName.c_str(), xTitle,
"Yeild", bins[i], min[i], max[i]);
412 vector<string> histos;
413 Int_t nofDetectors = detectors.size();
414 for (Int_t iDet = 0; iDet < nofDetectors; iDet++) {
416 for (Int_t i = 0; i <= iDet; i++) {
417 histEff += detectors[i];
419 string histNorm = histEff;
420 histos.push_back(
"hte_" + histEff +
"_" + histNorm);
421 for (Int_t i = iDet + 1; i < nofDetectors; i++) {
422 histNorm += detectors[i];
423 histos.push_back(
"hte_" + histEff +
"_" + histNorm);
432 vector<string> detectors;
440 vector<string> names2;
451 names.insert(names1.begin(), names1.end());
452 names.insert(names2.begin(), names2.end());
453 vector<string> nameVector(names.begin(), names.end());
459 set<string> trackVariants;
461 vector<string> detectors;
467 for (UInt_t i = 0; i < detectors.size(); i++) {
468 name += detectors[i];
469 trackVariants.insert(name);
480 for (UInt_t i = 0; i < detectors.size(); i++) {
481 name += detectors[i];
482 trackVariants.insert(name);
485 vector<string> trackVariantsVector(trackVariants.begin(), trackVariants.end());
487 trackVariantsVector.push_back(
"Rich");
489 return trackVariantsVector;
494 set<string> variants;
496 vector<string> detectors;
500 for (UInt_t i = 0; i < detectors.size(); i++) {
501 name += detectors[i];
502 variants.insert(name);
512 for (UInt_t i = 0; i < detectors.size(); i++) {
513 name += detectors[i];
514 variants.insert(name);
517 vector<string> variantsVector(variants.begin(), variants.end());
518 return variantsVector;
523 set<string> trackVariants;
525 vector<string> detectors;
531 for (UInt_t i = 0; i < detectors.size(); i++) {
532 name += detectors[i];
533 if (detectors[i] == detName)
break;
543 Double_t minNofPoints = 0.;
544 Double_t maxNofPoints = 100.;
545 Int_t nofBinsPoints = 100;
551 CreateH1Efficiency(
"hte_Sts_Sts",
"Np",
"Number of points", nofBinsPoints, minNofPoints, maxNofPoints,
"track");
557 string histName =
"hte_Much_" + norm;
561 CreateH1Efficiency(histName,
"Np",
"Number of points", nofBinsPoints, minNofPoints, maxNofPoints,
"track");
570 string histName =
"hte_Trd_" + norm;
574 CreateH1Efficiency(histName,
"Np",
"Number of points", nofBinsPoints, minNofPoints, maxNofPoints,
"track");
583 string histName =
"hte_Tof_" + norm;
599 CreateH1Efficiency(
"hte_Rich_Rich",
"RingNh",
"Number of hits", nofBinsPoints, minNofPoints, maxNofPoints,
"ring");
604 CreateH2Efficiency(
"hte_Rich_Rich",
"RingXcYc",
"X [cm]",
"Y [cm]", 14, -110., 110, 60, -300, 300,
"ring");
611 for (UInt_t iHist = 0; iHist < histoNames.size(); iHist++) {
612 string name = histoNames[iHist];
613 string opt = (name.find(
"Rich") == string::npos) ?
"track" :
"ring";
622 if (name.find(
"Rich") != string::npos) {
638 for (UInt_t iHist = 0; iHist < psVariants.size(); iHist++) {
639 string name =
"hps_" + psVariants[iHist];
672 CreateH1(
"hng_NofGhosts_Sts_Nh",
"Number of hits",
"Yield", nofBinsPoints, minNofPoints, maxNofPoints);
674 CreateH1(
"hng_NofGhosts_Trd_Nh",
"Number of hits",
"Yield", nofBinsPoints, minNofPoints, maxNofPoints);
676 CreateH1(
"hng_NofGhosts_Much_Nh",
"Number of hits",
"Yield", nofBinsPoints, minNofPoints, maxNofPoints);
678 CreateH1(
"hng_NofGhosts_Rich_Nh",
"Number of hits",
"Yield", nofBinsPoints, minNofPoints, maxNofPoints);
679 CreateH2(
"hng_NofGhosts_Rich_RingXcYc",
"X [cm]",
"Y [cm]",
"Ghosts per event", 28, -110., 110, 40, -200, 200);
680 CreateH1(
"hng_NofGhosts_RichStsMatching_Nh",
"Number of hits",
"Yield", nofBinsPoints, minNofPoints, maxNofPoints);
681 CreateH1(
"hng_NofGhosts_RichElId_Nh",
"Number of hits",
"Yield", nofBinsPoints, minNofPoints, maxNofPoints);
682 CreateH1(
"hng_NofGhosts_StsRichMatching_Nh",
"Number of hits",
"Yield", nofBinsPoints, minNofPoints, maxNofPoints);
694 Int_t nofBinsC = 100000;
695 Double_t maxXC = 100000.;
696 CreateH1(
"hno_NofObjects_GlobalTracks",
"Tracks per event",
"Yield", nofBinsC, 1., maxXC);
698 CreateH1(
"hno_NofObjects_StsTracks",
"Tracks per event",
"Yield", nofBinsC, 1., maxXC);
700 CreateH1(
"hno_NofObjects_TrdTracks",
"Tracks per event",
"Yield", nofBinsC, 1., maxXC);
702 CreateH1(
"hno_NofObjects_MuchTracks",
"Tracks per event",
"Yield", nofBinsC, 1., maxXC);
704 CreateH1(
"hno_NofObjects_RichRings",
"Rings per event",
"Yield", nofBinsC, 1., maxXC);
705 CreateH1(
"hno_NofObjects_RichProjections",
"Projections per event",
"Yield", nofBinsC, 1., maxXC);
709 CreateH1(
"hen_EventNo_TrackingQa",
"",
"", 1, 0, 1.);
719 multimap<pair<Int_t, Int_t>, Int_t>& mcRecoMap = (*it).second;
729 for (Int_t iTrack = 0; iTrack < nofGlobalTracks; iTrack++) {
746 Double_t rtDistance = 10;
758 fHM->
H1(
"hng_NofGhosts_Sts_Nh")->Fill(nofHits);
765 fHM->
H1(
"hng_NofGhosts_StsRichMatching_Nh")->Fill(nofHits);
781 fHM->
H1(
"hng_NofGhosts_Trd_Nh")->Fill(nofHits);
796 fHM->
H1(
"hng_NofGhosts_Much_Nh")->Fill(nofHits);
810 fHM->
H1(
"hng_NofGhosts_Rich_Nh")->Fill(nofHits);
818 if (rtDistance < 1.)
fHM->
H1(
"hng_NofGhosts_RichStsMatching_Nh")->Fill(nofHits);
820 Double_t momentumMc = 0.;
821 if (stsTrackMatch != NULL) {
823 if (mcTrack != NULL) momentumMc = mcTrack->
GetP();
826 fHM->
H1(
"hng_NofGhosts_RichElId_Nh")->Fill(nofHits);
833 pair<Int_t, Int_t> stsMCId = {-1, -1}, trdMCId = {-1, -1}, muchMCId = {-1, -1}, richMCId = {-1, -1};
834 list<pair<Int_t, Int_t>> tofMCIds;
846 const vector<CbmLink>& tofMCLinks = tofMatch->
GetLinks();
848 for (vector<CbmLink>::const_iterator tofMCIt = tofMCLinks.begin(); tofMCIt != tofMCLinks.end(); ++tofMCIt) {
849 const FairMCPoint* tofPoint =
static_cast<const FairMCPoint*
>(
fTofPoints->
Get(*tofMCIt));
851 if (tofPoint != NULL) tofMCIds.push_back(pair<Int_t, Int_t>(tofMCIt->GetEntry(), tofPoint->GetTrackID()));
859 string name = (*it).first;
860 multimap<pair<Int_t, Int_t>, Int_t>& mcRecoMap = (*it).second;
861 Bool_t sts = (name.find(
"Sts") != string::npos) ? isStsOk && stsMCId.second != -1 :
true;
862 Bool_t trd = (name.find(
"Trd") != string::npos) ? isTrdOk && stsMCId == trdMCId :
true;
863 Bool_t much = (name.find(
"Much") != string::npos) ? isMuchOk && stsMCId == muchMCId :
true;
864 Bool_t tof = (name.find(
"Tof") != string::npos)
865 ? isTofOk && find(tofMCIds.begin(), tofMCIds.end(), stsMCId) != tofMCIds.end()
867 Bool_t rich = (name.find(
"Rich") != string::npos) ? isRichOk && stsMCId == richMCId :
true;
869 if (sts && trd && much && tof && rich) {
870 pair<pair<Int_t, Int_t>, Int_t> tmp = make_pair(stsMCId, iTrack);
871 mcRecoMap.insert(tmp);
880 Int_t nofRings =
fRichRings->GetEntriesFast();
881 for (Int_t iRing = 0; iRing < nofRings; iRing++) {
886 if (isRichOk && -1 != richMCId.second) {
887 pair<pair<Int_t, Int_t>, Int_t> tmp = make_pair(richMCId, iRing);
898 fHM->
H1(
"hth_Mvd_TrackHits_All")->Fill(nofHits);
903 Int_t nofTrueHits = 0, nofFakeHits = 0;
904 for (Int_t iHit = 0; iHit < nofHits; iHit++) {
907 if (NULL == hitMatch)
continue;
910 const FairMCPoint* point =
static_cast<const FairMCPoint*
>(
fMvdPoints->
Get(0, eventId, pointId));
911 if (NULL == point)
continue;
912 Int_t mcTrackId = point->GetTrackID();
913 if (mcTrackId == stsMcTrackId) {
920 fHM->
H1(
"hth_Mvd_TrackHits_True")->Fill(nofTrueHits);
921 fHM->
H1(
"hth_Mvd_TrackHits_Fake")->Fill(nofFakeHits);
923 fHM->
H1(
"hth_Mvd_TrackHits_TrueOverAll")->Fill(Double_t(nofTrueHits) / Double_t(nofHits));
924 fHM->
H1(
"hth_Mvd_TrackHits_FakeOverAll")->Fill(Double_t(nofFakeHits) / Double_t(nofHits));
935 assert(detName !=
"");
936 string histName =
"hth_" + detName +
"_TrackHits";
946 vector<TH1*> effHistos =
fHM->
H1Vector(
"(hte|hpe)_.*_Eff_.*");
947 Int_t nofEffHistos = effHistos.size();
951 for (Int_t iMCTrack = 0; iMCTrack < nofMcTracks; ++iMCTrack) {
972 Bool_t stsConsecutive =
983 Double_t angle = std::abs(mom.Theta() * 180 / TMath::Pi());
984 Double_t mcP = mcTrack->
GetP();
986 Double_t mcPt = mcTrack->
GetPt();
989 map<string, vector<Double_t>> parMap;
991 vector<Double_t> tmp = list_of(mcP);
994 vector<Double_t> tmp1 = list_of(mcY);
997 vector<Double_t> tmp2 = list_of(mcPt);
1000 vector<Double_t> tmp3 = list_of(angle);
1001 parMap[
"Angle"] = tmp3;
1003 vector<Double_t> tmp4 = list_of(0);
1004 parMap[
"Np"] = tmp4;
1007 vector<Double_t> tmp5 = list_of(boa);
1008 parMap[
"BoA"] = tmp5;
1010 vector<Double_t> tmp5X = list_of(ringX);
1011 parMap[
"RingXc"] = tmp5X;
1013 vector<Double_t> tmp5Y = list_of(std::abs(ringY));
1014 parMap[
"RingYc"] = tmp5Y;
1016 vector<Double_t> tmp6 = list_of(ringX)(ringY);
1017 parMap[
"RingXcYc"] = tmp6;
1019 vector<Double_t> tmp7 = list_of(nofHitsRich);
1020 parMap[
"RingNh"] = tmp7;
1022 vector<Double_t> tmp8 = list_of(mcY)(mcPt);
1024 parMap[
"YPt"] = tmp8;
1026 for (Int_t iHist = 0; iHist < nofEffHistos; iHist++) {
1027 TH1* hist = effHistos[iHist];
1028 string histName = hist->GetName();
1029 vector<string> split = Split(histName,
'_');
1030 string effName = split[1];
1031 string normName = split[2];
1032 string catName = split[3];
1033 string histTypeName = split[0];
1034 string parName = split[5];
1035 assert(parMap.count(parName) != 0);
1037 vector<Double_t> par = list_of(0);
1038 if (parName ==
"Np") {
1039 vector<Double_t> tmp9 = list_of((effName ==
"Sts") ? nofPointsSts
1040 : (effName ==
"Trd") ? nofPointsTrd
1041 : (effName ==
"Much") ? nofPointsMuch
1042 : (effName ==
"Tof") ? nofPointsTof
1047 par = parMap[parName];
1050 Bool_t sts = (normName.find(
"Sts") != string::npos) ? isStsOk :
true;
1051 Bool_t trd = (normName.find(
"Trd") != string::npos) ? isTrdOk :
true;
1052 Bool_t much = (normName.find(
"Much") != string::npos) ? isMuchOk :
true;
1053 Bool_t tof = (normName.find(
"Tof") != string::npos) ? isTofOk :
true;
1054 Bool_t rich = (normName.find(
"Rich") != string::npos) ? isRichOk :
true;
1056 if (effName ==
"Trd" || effName ==
"Much" || effName ==
"Tof") {
1057 string prevRecName = FindAndReplace(normName, effName,
"");
1060 Bool_t accOk = isPrevRec && sts && trd && much && tof && rich;
1067 Bool_t accOk = sts && trd && much && tof && rich;
1069 if (histName.find(
"Rich") == string::npos) {
1084 const multimap<pair<Int_t, Int_t>, Int_t>& mcMap,
1085 const string& histName,
const string& histTypeName,
1086 const string& effName,
const string& catName,
1087 const vector<Double_t>& par)
1089 string accHistName = FindAndReplace(histName,
"_Eff_",
"_Acc_");
1090 string recHistName = FindAndReplace(histName,
"_Eff_",
"_Rec_");
1092 Bool_t accOk = function(
fMCTracks, mcEventId, mcId);
1093 Bool_t recOk = (histTypeName ==
"hte") ? (mcMap.find(pair<Int_t, Int_t>(mcEventId, mcId)) != mcMap.end() && accOk)
1094 : (
ElectronId(mcEventId, mcId, mcMap, effName) && accOk);
1095 Int_t nofParams = par.size();
1096 assert(nofParams < 3 && nofParams > 0);
1097 if (nofParams == 1) {
1099 fHM->
H1(accHistName)->Fill(par[0]);
1102 fHM->
H1(recHistName)->Fill(par[0]);
1105 else if (nofParams == 2) {
1107 fHM->
H1(accHistName)->Fill(par[0], par[1]);
1110 fHM->
H1(recHistName)->Fill(par[0], par[1]);
1116 const multimap<pair<Int_t, Int_t>, Int_t>& mcMap,
1117 const string& histName,
const string& histTypeName,
1118 const string& effName,
const string& catName,
1119 const vector<Double_t>& par)
1122 string accHistName = FindAndReplace(histName,
"_Eff_",
"_Acc_");
1123 string recHistName = FindAndReplace(histName,
"_Eff_",
"_Rec_");
1125 Bool_t accOk = function(
fMCTracks, mcEventId, mcId, nofHitsInRing);
1126 Bool_t recOk = (histTypeName ==
"hte") ? (mcMap.find(make_pair(mcEventId, mcId)) != mcMap.end() && accOk)
1127 : (
ElectronId(mcEventId, mcId, mcMap, effName) && accOk);
1128 Int_t nofParams = par.size();
1129 assert(nofParams < 3 && nofParams > 0);
1130 if (nofParams == 1) {
1132 fHM->
H1(accHistName)->Fill(par[0]);
1135 fHM->
H1(recHistName)->Fill(par[0]);
1138 else if (nofParams == 2) {
1140 fHM->
H1(accHistName)->Fill(par[0], par[1]);
1143 fHM->
H1(recHistName)->Fill(par[0], par[1]);
1149 const string& effName)
1151 multimap<pair<Int_t, Int_t>, Int_t>::const_iterator it = mcMap.find(pair<Int_t, Int_t>(mcEventId, mcId));
1152 if (it == mcMap.end())
return false;
1153 Int_t globalTrackIndex = (*it).second;
1166 return isRichElectron && isTrdElectron && isTofElectron;
1172 vector<TH1*> histos =
fHM->
H1Vector(
"hps_.*_RecPions_.*");
1173 Int_t nofHistos = histos.size();
1176 for (Int_t iGT = 0; iGT < nofGlobalTracks; iGT++) {
1179 if (stsIndex < 0)
continue;
1181 const FairTrackParam* richProjection =
static_cast<const FairTrackParam*
>(
fRichProjections->At(iGT));
1182 if (richProjection == NULL || richProjection->GetX() == 0 || richProjection->GetY() == 0)
continue;
1191 if (mcIdSts < 0)
continue;
1195 Double_t p = mom.Mag();
1197 if (std::abs(pdgSts) == 211) {
1198 Bool_t isRichElectron =
1200 Bool_t isTrdElectron =
1202 Bool_t isTofElectron =
1205 for (Int_t iHist = 0; iHist < nofHistos; iHist++) {
1206 histos[iHist]->Fill(p);
1207 string name = histos[iHist]->GetName();
1208 vector<string> split = Split(name,
'_');
1209 string effName = split[1];
1210 string category = split[2];
1212 Bool_t isElectron = ((effName.find(
"Rich") != string::npos) ? isRichElectron :
true)
1213 && ((effName.find(
"Trd") != string::npos) ? isTrdElectron :
true)
1214 && ((effName.find(
"Tof") != string::npos) ? isTofElectron :
true);
1220 if (ok)
fHM->
H1(FindAndReplace(name,
"RecPions",
"Rec"))->Fill(p);
1231 fHM->
H1(
"hno_NofObjects_StsTracks")->Fill(
fStsTracks->GetEntriesFast());
1234 fHM->
H1(
"hno_NofObjects_RichRings")->Fill(
fRichRings->GetEntriesFast());
1235 Int_t projCount = 0;
1237 for (Int_t iProj = 0; iProj < nProj; iProj++) {
1239 if (NULL == proj || proj->GetX() == 0. || proj->GetY() == 0)
continue;
1242 fHM->
H1(
"hno_NofObjects_RichProjections")->Fill(projCount);
@ kMvd
Micro-Vertex Detector.
@ kTrd
Transition Radiation Detector.
@ kTof
Time-of-flight Detector.
@ kSts
Silicon Tracking System.
@ kMuch
Muon detection system.
@ kRich
Ring-Imaging Cherenkov Detector.
Global function to define the track acceptance. Used in QA.
Creates CbmLitMCTrack objects.
Create report for tracking QA.
Creates study report for tracking QA.
ClassImp(CbmLitTrackingQa)
FairTask for tracking performance calculation.
Data class for STS tracks.
int32_t GetStsTrackIndex() const
int32_t GetRichRingIndex() const
int32_t GetTofHitIndex() const
int32_t GetMuchTrackIndex() const
int32_t GetTrdTrackIndex() const
std::vector< TH1 * > H1Vector(const std::vector< std::string > &names) const
Return vector of pointers to TH1 histogram.
void WriteToFile()
Write all objects to current opened file.
void Add(const std::string &name, TNamed *object)
Add new named object to manager.
std::string ToString() const
Return string representation of class.
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
static Bool_t KaonTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t KaonMinusTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t PionRingAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index, Int_t)
static Bool_t PionMinusTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t AllTrackAcceptanceFunction(CbmMCDataArray *, Int_t, Int_t)
static Bool_t PionTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t TrueMatchPiSuppAcceptanceFunction(const TClonesArray *globalTracks, const TClonesArray *stsMatches, const TClonesArray *richMatches, Int_t index)
static Bool_t PionPlusTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t SecondaryTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t AllPiSuppAcceptanceFunction(const TClonesArray *, const TClonesArray *, const TClonesArray *, Int_t)
static Bool_t KaonPlusTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t ProtonTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t PrimaryElectronRingAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index, Int_t)
static Bool_t PrimaryElectronTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t AllRingAcceptanceFunction(CbmMCDataArray *, Int_t, Int_t, Int_t)
static Bool_t PrimaryMuonTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t WrongMatchPiSuppAcceptanceFunction(const TClonesArray *globalTracks, const TClonesArray *stsMatches, const TClonesArray *richMatches, Int_t index)
static Bool_t PionReferenceRingAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index, Int_t nofHitsInRing)
static Bool_t ReferenceTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t AllReferenceRingAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index, Int_t nofHitsInRing)
static Bool_t PrimaryTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
static Bool_t PrimaryElectronReferenceRingAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index, Int_t nofHitsInRing)
void DetermineSetup()
Determines detector presence using TGeoManager.
bool GetElectronSetup() const
Return true if electron setup is detected.
bool GetDet(ECbmModuleId detId) const
Return detector presence in setup.
Bool_t IsTrdElectron(Int_t globalTrackindex, Double_t momentum)
Identify electron in RICH detector.
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.
void SetRichAnnCut(Double_t par)
Set cut on RICH ANN output value.
static CbmLitGlobalElectronId & GetInstance()
void SetTrdAnnCut(Double_t par)
Set cut on TRD ANN output value.
bool TrackExists(int mcEventId, int mcId) const
Check whether a track exists in the array.
void Create(Int_t eventNum)
Creates array of CbmLitMCTracks for current event.
static CbmLitMCTrackCreator * Instance()
Singleton instance.
const CbmLitMCTrack & GetTrack(int mcEventId, int mcId) const
Return CbmLitMCTrack by its index.
Double_t GetRingCenterY() const
Return Y coordinate of the ellipse center.
Double_t GetRingAaxis() const
Return major semi-axis of the ellipse.
UInt_t GetNofPointsInDifferentStations(ECbmModuleId detId) const
Return number of MC points in different stations for specified detector id.
Double_t GetRingCenterX() const
Return X coordinate of the ellipse center.
Int_t GetNofConsecutivePoints(ECbmModuleId detId) const
Return number of consecutive MC points for specified detector id. Currently works only for STS.
UInt_t GetNofPoints(ECbmModuleId detId) const
Return number of MC points for specified detector id.
Int_t GetNofRichHits() const
Return number of RICH hits in ring.
Double_t GetRingBaxis() const
Return minor semi-axis of the ellipse.
Create report for tracking QA.
Bool_t(*) LitTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
CbmMCDataArray * fMvdPoints
vector< string > PionSuppressionVariants()
vector< string > CreateGlobalTrackingHistogramNames()
CbmLitTrackingQa()
Constructor.
TClonesArray * fGlobalTracks
Bool_t ElectronId(Int_t mcEventId, Int_t mcId, const multimap< pair< Int_t, Int_t >, Int_t > &mcMap, const string &effName)
void CreateTrackHitsHistogram(const string &detName)
void FillDefaultPiSuppCategories()
vector< string > fTrackCategories
void FillDefaultTrackCategories()
Fill array of track categories with default values.
Bool_t(*) LitRingAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index, Int_t nofHitsInRing)
void FillDefaultRingPIDCategories()
void CreateH1PionSuppression(const string &name, const string ¶meter, const string &xTitle, Int_t nofBins, Double_t minBin, Double_t maxBin)
CbmMCDataArray * fTofPoints
map< string, multimap< pair< Int_t, Int_t >, Int_t > > fMcToRecoMap
TClonesArray * fMuchMatches
TClonesArray * fStsMatches
TClonesArray * fRichProjections
TClonesArray * fTofMatches
virtual void Finish()
Derived from FairTask.
void ProcessGlobalTracks()
Loop over the reconstructed global tracks. Check if track is correct and fill multimap <MC track inde...
void CreateH1Efficiency(const string &name, const string ¶meter, const string &xTitle, Int_t nofBins, Double_t minBin, Double_t maxBin, const string &opt)
Bool_t(*) LitPiSuppAcceptanceFunction(const TClonesArray *globalTracks, const TClonesArray *stsMatches, const TClonesArray *richMatches, Int_t index)
virtual ~CbmLitTrackingQa()
Destructor.
void CreateH2Efficiency(const string &name, const string ¶meter, const string &xTitle, const string &yTitle, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY, const string &opt)
void FillGlobalReconstructionHistos(Int_t mcEventId, Int_t mcId, const multimap< pair< Int_t, Int_t >, Int_t > &mcMap, const string &histName, const string &histTypeName, const string &effName, const string &catName, const vector< Double_t > &par)
Calculate efficiency histograms.
void ProcessMvd(Int_t stsId)
Check correctness attached MVD hits.
string LocalEfficiencyNormalization(const string &detName)
void FillTrackQualityHistograms(const CbmTrackMatchNew *trackMatch, ECbmModuleId detId)
TClonesArray * fRichRings
TClonesArray * fTrdMatches
void ProcessMcTracks(Int_t iEvent)
Loop over the MC tracks. Check track acceptance for different cases. Fill histograms of accepted and ...
virtual InitStatus Init()
Derived from FairTask.
map< string, LitRingAcceptanceFunction > fRingAcceptanceFunctions
map< string, LitPiSuppAcceptanceFunction > fPiSuppAcceptanceFunctions
vector< string > GlobalTrackVariants()
void CreateH2(const string &name, const string &xTitle, const string &yTitle, const string &zTitle, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY)
TClonesArray * fStsTracks
void FillDefaultRingCategories()
TClonesArray * fMvdHitMatches
void ReadDataBranches()
Read data branches from input data files.
void FillTrackAndRingAcceptanceFunctions()
Bool_t fUseConsecutivePointsInSts
void IncreaseCounters()
Increase number of objects counters.
void CreateH1(const string &name, const string &xTitle, const string &yTitle, Int_t nofBins, Double_t minBin, Double_t maxBin)
void FillGlobalReconstructionHistosRich(Int_t mcEventId, Int_t mcId, const multimap< pair< Int_t, Int_t >, Int_t > &mcMap, const string &histName, const string &histTypeName, const string &effName, const string &catName, const vector< Double_t > &par)
Fill histograms of accepted and reconstructed rings tracks.
map< string, LitTrackAcceptanceFunction > fTrackAcceptanceFunctions
void FillDefaultTrackPIDCategories()
vector< string > fTrackCategoriesPID
vector< string > fRingCategories
CbmLitMCTrackCreator * fMCTrackCreator
virtual void Exec(Option_t *opt)
Derived from FairTask.
TClonesArray * fRichRingMatches
CbmMCDataArray * fMCTracks
void ProcessRichRings()
Loop over the reconstructed RICH rings. Check if ring is correct and fill multimap <MC track index,...
vector< string > fPiSuppCategories
vector< string > fRingCategoriesPID
TObject * Get(const CbmLink *lnk)
Int_t Size(Int_t fileNumber, Int_t eventNumber)
Task class creating and managing CbmMCDataArray objects.
CbmMCDataObject * GetObject(const char *name)
CbmMCDataArray * InitBranch(const char *name)
void GetMomentum(TVector3 &momentum) const
int32_t GetPdgCode() const
double GetRapidity() const
int32_t GetNofLinks() const
const CbmLink & GetMatchedLink() const
const std::vector< CbmLink > & GetLinks() const
static double GetRingTrackDistance(int globalTrackId)
Base class for simulation reports.
void Create(CbmHistManager *histManager, const std::string &outputDir)
Main function which creates report data.
Class representing the top level of the STS setup.
Bool_t Init(const char *geometryFile=nullptr)
Initialise the setup.
static CbmStsSetup * Instance()
Bool_t IsInit() const
Initialisation status for sensor parameters.
Data class with information on a STS local track.
int32_t GetNofMvdHits() const
int32_t GetMvdHitIndex(int32_t iHit) const
double GetTrueOverAllHitsRatio() const
int32_t GetNofWrongHits() const
double GetWrongOverAllHitsRatio() const
int32_t GetNofHits() const
int32_t GetNofTrueHits() const
string FindAndReplace(const string &name, const string &oldSubstr, const string &newSubstr)
vector< string > Split(const string &name, char delimiter)