CbmRoot
Loading...
Searching...
No Matches
CbmLitTrackingQa.h
Go to the documentation of this file.
1/* Copyright (C) 2007-2018 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Andrey Lebedev [committer] */
4
12#ifndef CBMLITTRACKINGQA_H_
13#define CBMLITTRACKINGQA_H_
14
15#include "CbmDefs.h"
16#include "FairTask.h"
18
19class CbmHistManager;
22class CbmMCDataArray;
23class TClonesArray;
24
25using std::multimap;
26using std::pair;
27using std::string;
28using std::vector;
29
30
37class CbmLitTrackingQa : public FairTask {
38 public:
43
47 virtual ~CbmLitTrackingQa();
48
52 virtual InitStatus Init();
53
57 virtual void Exec(Option_t* opt);
58
62 virtual void Finish();
63
65 void SetMinNofPointsSts(Int_t minNofPointsSts) { fMinNofPointsSts = minNofPointsSts; }
66 void SetMinNofPointsTrd(Int_t minNofPointsTrd) { fMinNofPointsTrd = minNofPointsTrd; }
67 void SetMinNofPointsMuch(Int_t minNofPointsMuch) { fMinNofPointsMuch = minNofPointsMuch; }
68 void SetMinNofPointsTof(Int_t minNofPointsTof) { fMinNofPointsTof = minNofPointsTof; }
69 void SetMinNofHitsRich(Int_t minNofHitsRich) { fMinNofHitsRich = minNofHitsRich; }
70 void SetQuota(Double_t quota) { fQuota = quota; }
71 void SetQuotaRich(Double_t quotaRich) { fQuotaRich = quotaRich; }
72 void SetMinNofHitsTrd(Int_t minNofHitsTrd) { fMinNofHitsTrd = minNofHitsTrd; }
73 void SetMinNofHitsMuch(Int_t minNofHitsMuch) { fMinNofHitsMuch = minNofHitsMuch; }
74 void SetUseConsecutivePointsInSts(Bool_t useConsecutivePointsInSts)
75 {
76 fUseConsecutivePointsInSts = useConsecutivePointsInSts;
77 }
78 void SetOutputDir(const std::string& dir) { fOutputDir = dir; }
79 void SetPRange(Int_t bins, Int_t min, Int_t max)
80 {
81 fPRangeBins = bins;
84 }
85 void SetYRange(Int_t bins, Int_t min, Int_t max)
86 {
87 fYRangeBins = bins;
90 }
91 void SetPtRange(Int_t bins, Int_t min, Int_t max)
92 {
93 fPtRangeBins = bins;
96 }
97 void SetAngleRange(Double_t min, Double_t max, Int_t nofBins)
98 {
101 fAngleRangeBins = nofBins;
102 }
103 void SetTrackCategories(const vector<string>& trackCategories) { fTrackCategories = trackCategories; }
104 void SetRingCategories(const vector<string>& ringCategories) { fRingCategories = ringCategories; }
105
106 void SetRichAnnCut(Double_t par) { fRichAnnCut = par; }
107 void SetTrdAnnCut(Double_t par) { fTrdAnnCut = par; }
108
109 private:
113 void ReadDataBranches();
114
119
121
123
125
127
129
130
131 void CreateH1Efficiency(const string& name, const string& parameter, const string& xTitle, Int_t nofBins,
132 Double_t minBin, Double_t maxBin, const string& opt);
133
134 void CreateH2Efficiency(const string& name, const string& parameter, const string& xTitle, const string& yTitle,
135 Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY,
136 Double_t maxBinY, const string& opt);
137
138 void CreateH1PionSuppression(const string& name, const string& parameter, const string& xTitle, Int_t nofBins,
139 Double_t minBin, Double_t maxBin);
140
141 void CreateH1(const string& name, const string& xTitle, const string& yTitle, Int_t nofBins, Double_t minBin,
142 Double_t maxBin);
143
144 void CreateH2(const string& name, const string& xTitle, const string& yTitle, const string& zTitle, Int_t nofBinsX,
145 Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY);
146
147 void CreateTrackHitsHistogram(const string& detName);
148
149 vector<string> CreateGlobalTrackingHistogramNames(const vector<string>& detectors);
150
151 vector<string> CreateGlobalTrackingHistogramNames();
152
153 string LocalEfficiencyNormalization(const string& detName);
154
155 vector<string> GlobalTrackVariants();
156
157 vector<string> PionSuppressionVariants();
158
159 void CreateHistograms();
160
166 void ProcessGlobalTracks();
167
173 void ProcessRichRings();
174
178 void ProcessMvd(Int_t stsId);
179
180 void FillTrackQualityHistograms(const CbmTrackMatchNew* trackMatch, ECbmModuleId detId);
181
186 void ProcessMcTracks(Int_t iEvent);
187
188 // /**
189 // * \brief Calculate efficiency histograms.
190 // */
191 // void CalculateEfficiencyHistos();
192
201 void FillGlobalReconstructionHistos(Int_t mcEventId, Int_t mcId, const multimap<pair<Int_t, Int_t>, Int_t>& mcMap,
202 const string& histName, const string& histTypeName, const string& effName,
203 const string& catName, const vector<Double_t>& par);
204
213 void FillGlobalReconstructionHistosRich(Int_t mcEventId, Int_t mcId, const multimap<pair<Int_t, Int_t>, Int_t>& mcMap,
214 const string& histName, const string& histTypeName, const string& effName,
215 const string& catName, const vector<Double_t>& par);
216
217 Bool_t ElectronId(Int_t mcEventId, Int_t mcId, const multimap<pair<Int_t, Int_t>, Int_t>& mcMap,
218 const string& effName);
219
220 void PionSuppression();
221
225 void IncreaseCounters();
226
227 CbmHistManager* fHM; // Histogram manager
228 string fOutputDir; // Output directory for results
229 CbmLitDetectorSetup fDet; // Detector presence information
230 CbmLitMCTrackCreator* fMCTrackCreator; // MC track creator tool
231
232 // Acceptance defined by MC points
233 Int_t fMinNofPointsSts; // Minimal number of MCPoints in STS
234 Int_t fMinNofPointsTrd; // Minimal number of MCPoints in TRD
235 Int_t fMinNofPointsMuch; // Minimal number of MCPoints in MUCH
236 Int_t fMinNofPointsTof; // Minimal number of MCPoints in TOF
237 Double_t fQuota; // True/all hits for track to be considered correctly reconstructed
238
239 Bool_t fUseConsecutivePointsInSts; // Use consecutive MC points for STS normalization
240
241 // Acceptance in RICH
242 Int_t fMinNofHitsRich; // Minimal number of hits in MC RICH ring
243 Double_t fQuotaRich; // True/all hits for ring to be considered correctly reconstructed
244
245 // Minimal number of hits in track to be considered as accepted.
246 // This is needed because the definition of the correctly reconstructed track
247 // is 70% of hits in the reconstructed track are from the same MC track.
248 // But this can lead to the situation when a reconstructed track has 4 hits,
249 // all of them from the same MC track, which means that the track is correctly
250 // reconstructed. BUT the real MC track has 12 points(hits). This is especially
251 // important for the MUCH detector. To avoid such situations one has to put
252 // such cut.
253 Int_t fMinNofHitsTrd; // for TRD track
254 Int_t fMinNofHitsMuch; // for MUCH track
255
256 Double_t fPRangeMin; // Minimum momentum for tracks for efficiency calculation [GeV/c]
257 Double_t fPRangeMax; // Maximum momentum for tracks for efficiency calculation [GeV/c]
258 Int_t fPRangeBins; // Number of bins for efficiency vs. momentum histogram
259 Double_t fPtRangeMin; // Minimum Pt for tracks for efficiency calculation [GeV/c]
260 Double_t fPtRangeMax; // Maximum Pt for tracks for efficiency calculation [GeV/c]
261 Int_t fPtRangeBins; // Number of bins for efficiency vs. Pt histogram
262 Double_t fYRangeMin; // Minimum rapidity for tracks for efficiency calculation [GeV/c]
263 Double_t fYRangeMax; // Maximum rapidity for tracks for efficiency calculation [GeV/c]
264 Int_t fYRangeBins; // Number of bins for efficiency vs. rapidity histogram
265 Double_t fAngleRangeMin; // Minimum polar angle [grad]
266 Double_t fAngleRangeMax; // Maximum polar angle [grad]
267 Int_t fAngleRangeBins; // Number of bins for efficiency vs. polar angle histogram
268
269 // Pointers to data arrays
270 CbmMCDataArray* fMCTracks; // CbmMCTrack array
271 TClonesArray* fGlobalTracks; // CbmGlobalTrack array
272 CbmMCDataArray* fMvdPoints; // CbmMvdPoint array
273 TClonesArray* fMvdHitMatches; // CbmMatch array
274 TClonesArray* fStsTracks; // CbmStsTrack array
275 TClonesArray* fStsMatches; // CbmStsTrackMatch array
276 TClonesArray* fRichRings; // CbmRichRing array
277 TClonesArray* fRichProjections; // CbmRichProjection array
278 TClonesArray* fRichRingMatches; // CbmRichMatchesn array
279 TClonesArray* fMuchMatches; // CbmTrackMatchNew array
280 TClonesArray* fTrdMatches; // CbmTrackMatchNew array
281 CbmMCDataArray* fTofPoints; // CbmTofPoint array
282 TClonesArray* fTofMatches; // CbmMatch array
283
284 // Global track segment name maps to multimap <MC track index, reconstructed track index>
285 map<string, multimap<pair<Int_t, Int_t>, Int_t>> fMcToRecoMap;
286
287 vector<string> fTrackCategories; // Vector of track category names
288 vector<string> fRingCategories; // Vector of ring category names
289 vector<string> fTrackCategoriesPID; // Vector of track category names
290 vector<string> fRingCategoriesPID; // Vector of ring category names for REC+PID
291 vector<string> fPiSuppCategories;
292 ; // Vector of categories for pion suppression
293
294 //#ifndef __ROOTCLING__
295 typedef Bool_t (*LitTrackAcceptanceFunction)(CbmMCDataArray* mcTracks, Int_t eventNo, Int_t index);
296 typedef Bool_t (*LitRingAcceptanceFunction)(CbmMCDataArray* mcTracks, Int_t eventNo, Int_t index,
297 Int_t nofHitsInRing);
298 typedef Bool_t (*LitPiSuppAcceptanceFunction)(const TClonesArray* globalTracks, const TClonesArray* stsMatches,
299 const TClonesArray* richMatches, Int_t index);
300 map<string, LitTrackAcceptanceFunction>
301 fTrackAcceptanceFunctions; // maps track category name to track acceptance function
302 map<string, LitRingAcceptanceFunction>
303 fRingAcceptanceFunctions; // maps ring category name to ring acceptance function
304 map<string, LitPiSuppAcceptanceFunction>
305 fPiSuppAcceptanceFunctions; // maps pion supp. category name to piSupp acceptance function
306 //#endif
307 Double_t fRichAnnCut;
308 Double_t fTrdAnnCut;
309
312
314};
315
316#endif /* CBMLITTRACKINGQA_H_ */
ECbmModuleId
Definition CbmDefs.h:39
Helper class to access detector presence.
static vector< vector< QAMCTrack > > mcTracks
friend fscal max(fscal x, fscal y)
friend fscal min(fscal x, fscal y)
Histogram manager.
Helper class to access detector presence.
Creates CbmLitMCTrack objects.
Bool_t(*) LitTrackAcceptanceFunction(CbmMCDataArray *mcTracks, Int_t eventNo, Int_t index)
void SetTrdAnnCut(Double_t par)
CbmMCDataArray * fMvdPoints
vector< string > PionSuppressionVariants()
vector< string > CreateGlobalTrackingHistogramNames()
CbmLitTrackingQa()
Constructor.
CbmLitTrackingQa & operator=(const CbmLitTrackingQa &)
void SetTrackCategories(const vector< string > &trackCategories)
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 SetPRange(Int_t bins, Int_t min, Int_t max)
void CreateTrackHitsHistogram(const string &detName)
void SetUseConsecutivePointsInSts(Bool_t useConsecutivePointsInSts)
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 CreateH1PionSuppression(const string &name, const string &parameter, const string &xTitle, Int_t nofBins, Double_t minBin, Double_t maxBin)
void SetMinNofHitsTrd(Int_t minNofHitsTrd)
CbmMCDataArray * fTofPoints
map< string, multimap< pair< Int_t, Int_t >, Int_t > > fMcToRecoMap
TClonesArray * fMuchMatches
void SetMinNofHitsMuch(Int_t minNofHitsMuch)
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 SetMinNofPointsTof(Int_t minNofPointsTof)
void CreateH1Efficiency(const string &name, const string &parameter, const string &xTitle, Int_t nofBins, Double_t minBin, Double_t maxBin, const string &opt)
CbmLitTrackingQa(const CbmLitTrackingQa &)
Bool_t(*) LitPiSuppAcceptanceFunction(const TClonesArray *globalTracks, const TClonesArray *stsMatches, const TClonesArray *richMatches, Int_t index)
virtual ~CbmLitTrackingQa()
Destructor.
void SetMinNofPointsTrd(Int_t minNofPointsTrd)
void CreateH2Efficiency(const string &name, const string &parameter, 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 SetAngleRange(Double_t min, Double_t max, Int_t nofBins)
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 SetMinNofHitsRich(Int_t minNofHitsRich)
CbmLitDetectorSetup fDet
void ProcessMvd(Int_t stsId)
Check correctness attached MVD hits.
void SetQuota(Double_t quota)
string LocalEfficiencyNormalization(const string &detName)
void FillTrackQualityHistograms(const CbmTrackMatchNew *trackMatch, ECbmModuleId detId)
TClonesArray * fRichRings
void SetYRange(Int_t bins, Int_t min, Int_t max)
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
CbmHistManager * fHM
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
TClonesArray * fMvdHitMatches
void SetRichAnnCut(Double_t par)
void SetMinNofPointsSts(Int_t minNofPointsSts)
void SetOutputDir(const std::string &dir)
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 SetMinNofPointsMuch(Int_t minNofPointsMuch)
void SetQuotaRich(Double_t quotaRich)
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
vector< string > fTrackCategoriesPID
vector< string > fRingCategories
void SetRingCategories(const vector< string > &ringCategories)
CbmLitMCTrackCreator * fMCTrackCreator
void SetPtRange(Int_t bins, Int_t min, Int_t max)
virtual void Exec(Option_t *opt)
Derived from FairTask.
TClonesArray * fRichRingMatches
ClassDef(CbmLitTrackingQa, 1)
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
Access to a MC data branch for time-based analysis.