CbmRoot
CbmBinnedTrackerQA.cxx
Go to the documentation of this file.
1 /*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 
7 //#define CBM_BINNED_QA_FILL_HISTOS
8 
9 #include <complex>
10 
11 #include "CbmBinnedTrackerQA.h"
12 #include "CbmMCDataManager.h"
13 #include "CbmMCTrack.h"
14 #include "CbmMatch.h"
15 #include "CbmMuchCluster.h"
16 #include "CbmMuchDigi.h"
17 #include "CbmMuchGeoScheme.h"
18 #include "CbmMuchPixelHit.h"
19 #include "CbmMuchPoint.h"
20 #include "CbmMuchStation.h"
21 #include "CbmStsCluster.h"
22 #include "CbmStsDigi.h"
23 #include "CbmStsHit.h"
24 #include "CbmStsPoint.h"
25 #include "CbmStsSetup.h"
26 #include "CbmTofPoint.h"
27 #include "CbmTrdCluster.h"
28 #include "CbmTrdDigi.h"
29 #include "FairRun.h"
30 #include "FairRuntimeDb.h"
31 #include "GeoReader.h"
32 #include "TH1.h"
33 #include "TProfile.h"
34 #include "global/CbmGlobalTrack.h"
35 #include "trd/CbmTrdAddress.h"
36 
37 using namespace std;
38 
39 //#define TRD_IDEAL
40 
41 struct TrackDesc {
42  static Int_t nofStsStations;
43  static Int_t nofMuchStations;
44  static Int_t nofTrdStations;
45  static bool hasTof;
46 
47  static Int_t firstStsStationNo;
48  static Int_t firstMuchStationNo;
49  static Int_t firstTrdStationNo;
50  static Int_t tofStationNo;
51 
52  // In the pairs below
53  pair<set<Int_t>, set<Int_t>>* sts;
54  pair<set<Int_t>, set<Int_t>>* much;
55  pair<set<Int_t>, set<Int_t>>* trd;
56  pair<set<Int_t>, set<Int_t>> tof;
57  set<const CbmStsPoint*>* stsPoints;
58  set<const CbmMuchPoint*>* muchPoints;
59  set<const CbmTrdPoint*>* trdPoints;
60  bool isPrimary;
61  const CbmMCTrack* ptr;
62  Double_t* nearestHitDistSts;
63  Double_t* nearestHitDistMuch;
64  Double_t* nearestHitDistTrd;
68  Double_t* pullXsts;
69  Double_t* pullYsts;
70  Double_t* pullXmuch;
71  Double_t* pullYmuch;
72  Double_t* pullXtrd;
73  Double_t* pullYtrd;
74 
75  list<TrackDesc*> children;
78 
80  : sts(nofStsStations > 0 ? new pair<set<Int_t>, set<Int_t>>[nofStsStations]
81  : 0)
82  , much(nofMuchStations > 0
83  ? new pair<set<Int_t>, set<Int_t>>[nofMuchStations]
84  : 0)
85  , trd(nofTrdStations > 0 ? new pair<set<Int_t>, set<Int_t>>[nofTrdStations]
86  : 0)
87  , tof()
88  , stsPoints(nofStsStations > 0 ? new set<const CbmStsPoint*>[nofStsStations]
89  : 0)
90  , muchPoints(
91  nofMuchStations > 0 ? new set<const CbmMuchPoint*>[nofMuchStations] : 0)
92  , trdPoints(nofTrdStations > 0 ? new set<const CbmTrdPoint*>[nofTrdStations]
93  : 0)
94  , isPrimary(false)
95  , ptr(0)
96  , nearestHitDistSts(nofStsStations > 0 ? new Double_t[nofStsStations] : 0)
97  , nearestHitDistMuch(nofMuchStations > 0 ? new Double_t[nofMuchStations]
98  : 0)
99  , nearestHitDistTrd(nofTrdStations > 0 ? new Double_t[nofTrdStations] : 0)
100  , nearestPointsSts(
101  nofStsStations > 0 ? new const CbmStsPoint*[nofStsStations] : 0)
102  , nearestPointsMuch(
103  nofMuchStations > 0 ? new const CbmMuchPoint*[nofMuchStations] : 0)
104  , nearestPointsTrd(
105  nofTrdStations > 0 ? new const CbmTrdPoint*[nofTrdStations] : 0)
106  , pullXsts(nofStsStations > 0 ? new Double_t[nofStsStations] : 0)
107  , pullYsts(nofStsStations > 0 ? new Double_t[nofStsStations] : 0)
108  , pullXmuch(nofMuchStations > 0 ? new Double_t[nofMuchStations] : 0)
109  , pullYmuch(nofMuchStations > 0 ? new Double_t[nofMuchStations] : 0)
110  , pullXtrd(nofTrdStations > 0 ? new Double_t[nofTrdStations] : 0)
111  , pullYtrd(nofTrdStations > 0 ? new Double_t[nofTrdStations] : 0)
112  , children()
113  , isReference(false)
114  , isReconstructed(false) {
115  fill_n(nearestHitDistSts, nofStsStations, -1);
116  fill_n(nearestHitDistMuch, nofMuchStations, -1);
117  fill_n(nearestHitDistTrd, nofTrdStations, -1);
118  fill_n(
119  nearestPointsSts, nofStsStations, static_cast<const CbmStsPoint*>(0));
120  fill_n(
121  nearestPointsMuch, nofMuchStations, static_cast<const CbmMuchPoint*>(0));
122  fill_n(
123  nearestPointsTrd, nofTrdStations, static_cast<const CbmTrdPoint*>(0));
124  fill_n(pullXsts, nofStsStations, 0);
125  fill_n(pullYsts, nofStsStations, 0);
126  fill_n(pullXmuch, nofMuchStations, 0);
127  fill_n(pullYmuch, nofMuchStations, 0);
128  fill_n(pullXtrd, nofTrdStations, 0);
129  fill_n(pullYtrd, nofTrdStations, 0);
130  }
131 
133  delete[] sts;
134  delete[] much;
135  delete[] trd;
136  delete[] stsPoints;
137  delete[] muchPoints;
138  delete[] trdPoints;
139  delete[] nearestHitDistSts;
140  delete[] nearestHitDistMuch;
141  delete[] nearestHitDistTrd;
142  delete[] nearestPointsSts;
143  delete[] nearestPointsMuch;
144  delete[] nearestPointsTrd;
145  delete[] pullXsts;
146  delete[] pullYsts;
147  delete[] pullXmuch;
148  delete[] pullYmuch;
149  delete[] pullXtrd;
150  delete[] pullYtrd;
151  }
152 
153  TrackDesc(const TrackDesc&) = default;
154  TrackDesc& operator=(const TrackDesc&) = default;
155 };
156 
157 Int_t TrackDesc::nofStsStations = 0;
159 Int_t TrackDesc::nofTrdStations = 0;
160 bool TrackDesc::hasTof = false;
161 
165 Int_t TrackDesc::tofStationNo = 0;
166 
167 static vector<vector<TrackDesc>> gTracks;
168 static vector<vector<bool>> gStsPoints;
169 static vector<vector<bool>> gMuchPoints;
170 static vector<vector<bool>> gTrdPoints;
171 static vector<vector<char>> gTofPoints;
172 
173 static TProfile* effByMom = 0;
174 static TProfile* effByMomPrimary = 0;
175 static TProfile* effByMomNonPrimary = 0;
176 
177 static TProfile* effByPolarAngle = 0;
178 static TProfile* effByPolarAnglePrimary = 0;
179 static TProfile* effByPolarAngleNonPrimary = 0;
180 
181 static TProfile* effByXAngle = 0;
182 static TProfile* effByXAnglePrimary = 0;
183 static TProfile* effByXAngleNonPrimary = 0;
184 
185 static TProfile* effByYAngle = 0;
186 static TProfile* effByYAnglePrimary = 0;
187 static TProfile* effByYAngleNonPrimary = 0;
188 
189 static TH1F* lambdaChildrenMoms = 0;
190 static TProfile* lambdaChildrenEffByMom = 0;
191 static TH1F* clonesNofSameHits = 0;
192 
193 static TH1F* muchHitResidualX = 0;
194 static TH1F* muchHitResidualY = 0;
195 static TH1F* muchHitResidualT = 0;
196 static TH1F* muchHitPullX = 0;
197 static TH1F* muchHitPullY = 0;
198 static TH1F* muchHitPullT = 0;
199 
200 static TH1F* stsTrackResidualFirstX = 0;
201 static TH1F* stsTrackResidualFirstY = 0;
202 static TH1F* stsTrackPullFirstX = 0;
203 static TH1F* stsTrackPullFirstY = 0;
204 static TH1F* stsTrackResidualLastX = 0;
205 static TH1F* stsTrackResidualLastY = 0;
206 static TH1F* stsTrackPullLastX = 0;
207 static TH1F* stsTrackPullLastY = 0;
208 
209 static TH1F* muchTrackResidualFirstX = 0;
210 static TH1F* muchTrackResidualFirstY = 0;
211 static TH1F* muchTrackPullFirstX = 0;
212 static TH1F* muchTrackPullFirstY = 0;
213 static TH1F* muchTrackResidualLastX = 0;
214 static TH1F* muchTrackResidualLastY = 0;
215 static TH1F* muchTrackPullLastX = 0;
216 static TH1F* muchTrackPullLastY = 0;
217 
218 static TH1F* trdTrackResidualFirstX = 0;
219 static TH1F* trdTrackResidualFirstY = 0;
220 static TH1F* trdTrackPullFirstX = 0;
221 static TH1F* trdTrackPullFirstY = 0;
222 static TH1F* trdTrackResidualLastX = 0;
223 static TH1F* trdTrackResidualLastY = 0;
224 static TH1F* trdTrackPullLastX = 0;
225 static TH1F* trdTrackPullLastY = 0;
226 
227 static TH1F* globalTrackResidualFirstX = 0;
228 static TH1F* globalTrackResidualFirstY = 0;
229 static TH1F* globalTrackPullFirstX = 0;
230 static TH1F* globalTrackPullFirstY = 0;
231 static TH1F* globalTrackResidualLastX = 0;
232 static TH1F* globalTrackResidualLastY = 0;
233 static TH1F* globalTrackPullLastX = 0;
234 static TH1F* globalTrackPullLastY = 0;
235 
236 #ifdef CBM_BINNED_QA_FILL_HISTOS
237 static TH1F* stsXResHisto = 0;
238 static TH1F* stsYResHisto = 0;
239 static TH1F* stsTResHisto = 0;
240 static TH1F* trdXResHisto = 0;
241 static TH1F* trdYResHisto = 0;
242 static TH1F* trdTResHisto = 0;
243 static TH1F* muchXResHisto = 0;
244 static TH1F* muchYResHisto = 0;
245 static TH1F* muchTResHisto = 0;
246 static TH1F* tofXResHisto = 0;
247 static TH1F* tofYResHisto = 0;
248 static TH1F* tofTResHisto = 0;
249 
250 static TH1F* stsXPullHistos[] = {0, 0};
251 static TH1F* stsYPullHistos[] = {0, 0};
252 
253 static TH1F* trdXPullHistos[] = {0, 0, 0, 0};
254 static TH1F* trdYPullHistos[] = {0, 0, 0, 0};
255 
256 static TH1F* extrStsXHisto = 0;
257 static TH1F* extrStsYHisto = 0;
258 
259 static TH1F* vtxXHisto = 0;
260 static TH1F* vtxYHisto = 0;
261 static TH1F* vtxZHisto = 0;
262 
263 static TH1F* extrTrdXHistos[] = {0, 0, 0, 0};
264 static TH1F* extrTrdYHistos[] = {0, 0, 0, 0};
265 
266 static TH1F* trdNearestHitDistHistos[] = {0, 0, 0, 0};
267 #endif //CBM_BINNED_QA_FILL_HISTOS
268 
269 //static int trdNofStrangerHits[] = { 0, 0, 0, 0 };
270 
271 static list<TrackDesc*> lambdaList;
272 
274  : fPrimaryParticleIds()
275  , fIsOnlyPrimary(false)
276  , fSettings(0)
277  , fGlobalTracks(0)
278  , fStsTracks(0)
279  , fMuchTracks(0)
280  , fTrdTracks(0)
281  , fStsHits(0)
282  , fMuchHits(0)
283  , fTrdHits(0)
284  , fTofHits(0)
285  , fStsClusters(0)
286  , fMuchClusters(0)
287  , fTrdClusters(0)
288  , fTrdDigiMatches(0)
289  , fTofHitDigiMatches(0)
290  , fTofDigiPointMatches(0)
291  , fStsDigis(0)
292  , fStsDigiMatches(0)
293  , fMuchDigis(0)
294  , fTrdDigis(0)
295  , fTofDigis(0)
296  , fMCTracks(0)
297  , fStsPoints(0)
298  , fMuchPoints(0)
299  , fTrdPoints(0)
300  , fTofPoints(0) {
301  fPrimaryParticleIds.push_back(ppiNone);
302 }
303 
305  CbmStsSetup* stsSetup = CbmStsSetup::Instance();
306 
307  if (!stsSetup->IsInit()) stsSetup->Init();
308 
313  LOG(info) << "The number of STS stations: " << TrackDesc::nofStsStations;
316  LOG(info) << "The number of MuCh stations: " << TrackDesc::nofMuchStations;
319  LOG(info) << "The number of TRD stations: " << TrackDesc::nofTrdStations;
321  LOG(info) << "Use ToF station: " << (TrackDesc::hasTof ? "true" : "false");
322 
328 
329  effByMom =
330  new TProfile("effByMom",
331  "Track reconstruction efficiency by momentum distribution %",
332  400,
333  0.,
334  10.);
335  effByMomPrimary = new TProfile("effByMomPrimary",
336  "Track reconstruction efficiency by momentum "
337  "distribution for primary tracks %",
338  400,
339  0.,
340  10.);
342  new TProfile("effByMomNonPrimary",
343  "Track reconstruction efficiency by momentum distribution for "
344  "non primary tracks %",
345  200,
346  0.,
347  10.);
348 
349  effByPolarAngle = new TProfile(
350  "effByPolarAngle",
351  "Track reconstruction efficiency by polar angle distribution %",
352  300,
353  0.,
354  30.);
356  new TProfile("effByPolarAnglePrimary",
357  "Track reconstruction efficiency by polar angle distribution "
358  "for primary tracks %",
359  300,
360  0.,
361  30.);
363  new TProfile("effByPolarAngleNonPrimary",
364  "Track reconstruction efficiency by polar angle distribution "
365  "for non primary tracks %",
366  300,
367  0.,
368  30.);
369 
370  effByXAngle =
371  new TProfile("effByXAngle",
372  "Track reconstruction efficiency by XZ angle distribution %",
373  300,
374  0.,
375  30.);
376  effByXAnglePrimary = new TProfile("effByXAnglePrimary",
377  "Track reconstruction efficiency by XZ "
378  "angle distribution for primary tracks %",
379  300,
380  0.,
381  30.);
383  new TProfile("effByXAngleNonPrimary",
384  "Track reconstruction efficiency by XZ angle distribution for "
385  "non primary tracks %",
386  300,
387  0.,
388  30.);
389 
390  effByYAngle =
391  new TProfile("effByYAngle",
392  "Track reconstruction efficiency by YZ angle distribution %",
393  300,
394  0.,
395  30.);
396  effByYAnglePrimary = new TProfile("effByYAnglePrimary",
397  "Track reconstruction efficiency by YZ "
398  "angle distribution for primary tracks %",
399  300,
400  0.,
401  30.);
403  new TProfile("effByYAngleNonPrimary",
404  "Track reconstruction efficiency by YZ angle distribution for "
405  "non primary tracks %",
406  300,
407  0.,
408  30.);
409 
410  lambdaChildrenMoms = new TH1F(
411  "lambdaChildrenMoms", "Lambda children momenta distribution", 100, 0., 10.);
413  new TProfile("lambdaChildrenEffByMom",
414  "Track reconstruction for Lambda children efficiency by "
415  "momentum distribution %",
416  200,
417  0.,
418  10.);
420  new TH1F("clonesNofSameHits",
421  "The number of hits which are the same for a clone track",
422  10,
423  0.,
424  10.);
425 
427  new TH1F("muchHitResidualX", "muchHitResidualX", 100, -5.0, 5.0);
429  new TH1F("muchHitResidualY", "muchHitResidualY", 100, -5.0, 5.0);
431  new TH1F("muchHitResidualT", "muchHitResidualT", 100, -20.0, 20.0);
432  muchHitPullX = new TH1F("muchHitPullX", "muchHitPullX", 100, -5.0, 5.0);
433  muchHitPullY = new TH1F("muchHitPullY", "muchHitPullY", 100, -5.0, 5.0);
434  muchHitPullT = new TH1F("muchHitPullT", "muchHitPullT", 100, -5.0, 5.0);
435 
436  stsTrackResidualFirstX = new TH1F(
437  "stsTrackResidualFirstX", "stsTrackResidualFirstX", 100, -0.1, 0.1);
438  stsTrackResidualFirstY = new TH1F(
439  "stsTrackResidualFirstY", "stsTrackResidualFirstY", 100, -0.1, 0.1);
441  new TH1F("stsTrackPullFirstX", "stsTrackPullFirstX", 100, -5.0, 5.0);
443  new TH1F("stsTrackPullFirstY", "stsTrackPullFirstY", 100, -5.0, 5.0);
445  new TH1F("stsTrackResidualLastX", "stsTrackResidualLastX", 100, -0.1, 0.1);
447  new TH1F("stsTrackResidualLastY", "stsTrackResidualLastY", 100, -0.1, 0.1);
449  new TH1F("stsTrackPullLastX", "stsTrackPullLastX", 100, -5.0, 5.0);
451  new TH1F("stsTrackPullLastY", "stsTrackPullLastY", 100, -5.0, 5.0);
452 
453  muchTrackResidualFirstX = new TH1F(
454  "muchTrackResidualFirstX", "muchTrackResidualFirstX", 100, -5.0, 5.0);
455  muchTrackResidualFirstY = new TH1F(
456  "muchTrackResidualFirstY", "muchTrackResidualFirstY", 100, -5.0, 5.0);
458  new TH1F("muchTrackPullFirstX", "muchTrackPullFirstX", 100, -10.0, 10.0);
460  new TH1F("muchTrackPullFirstY", "muchTrackPullFirstY", 100, -10.0, 10.0);
461  muchTrackResidualLastX = new TH1F(
462  "muchTrackResidualLastX", "muchTrackResidualLastX", 100, -5.0, 5.0);
463  muchTrackResidualLastY = new TH1F(
464  "muchTrackResidualLastY", "muchTrackResidualLastY", 100, -5.0, 5.0);
466  new TH1F("muchTrackPullLastX", "muchTrackPullLastX", 100, -10.0, 10.0);
468  new TH1F("muchTrackPullLastY", "muchTrackPullLastY", 100, -10.0, 10.0);
469 
470  trdTrackResidualFirstX = new TH1F(
471  "trdTrackResidualFirstX", "trdTrackResidualFirstX", 100, -10.0, 10.0);
472  trdTrackResidualFirstY = new TH1F(
473  "trdTrackResidualFirstY", "trdTrackResidualFirstY", 100, -10.0, 10.0);
475  new TH1F("trdTrackPullFirstX", "trdTrackPullFirstX", 100, -5.0, 5.0);
477  new TH1F("trdTrackPullFirstY", "trdTrackPullFirstY", 100, -5.0, 5.0);
478  trdTrackResidualLastX = new TH1F(
479  "trdTrackResidualLastX", "trdTrackResidualLastX", 100, -10.0, 10.0);
480  trdTrackResidualLastY = new TH1F(
481  "trdTrackResidualLastY", "trdTrackResidualLastY", 100, -10.0, 10.0);
483  new TH1F("trdTrackPullLastX", "trdTrackPullLastX", 100, -5.0, 5.0);
485  new TH1F("trdTrackPullLastY", "trdTrackPullLastY", 100, -5.0, 5.0);
486 
487  globalTrackResidualFirstX = new TH1F(
488  "globalTrackResidualFirstX", "globalTrackResidualFirstX", 100, -0.2, 0.2);
489  globalTrackResidualFirstY = new TH1F(
490  "globalTrackResidualFirstY", "globalTrackResidualFirstY", 100, -0.2, 0.2);
492  new TH1F("globalTrackPullFirstX", "globalTrackPullFirstX", 100, -5.0, 5.0);
494  new TH1F("globalTrackPullFirstY", "globalTrackPullFirstY", 100, -5.0, 5.0);
495  globalTrackResidualLastX = new TH1F(
496  "globalTrackResidualLastX", "globalTrackResidualLastX", 100, -1.5, 1.5);
497  globalTrackResidualLastY = new TH1F(
498  "globalTrackResidualLastY", "globalTrackResidualLastY", 100, -1.5, 1.5);
500  new TH1F("globalTrackPullLastX", "globalTrackPullLastX", 100, -5.0, 5.0);
502  new TH1F("globalTrackPullLastY", "globalTrackPullLastY", 100, -5.0, 5.0);
503 
504 #ifdef CBM_BINNED_QA_FILL_HISTOS
505  stsXResHisto = new TH1F("stsXResHisto", "stsXResHisto", 200, -0.1, 0.1);
506  stsYResHisto = new TH1F("stsYResHisto", "stsYResHisto", 200, -0.1, 0.1);
507  stsTResHisto = new TH1F("stsTResHisto", "stsTResHisto", 200, -10.0, 10.0);
508  trdXResHisto = new TH1F("trdXResHisto", "trdXResHisto", 600, -60.0, 60.0);
509  trdYResHisto = new TH1F("trdYResHisto", "trdYResHisto", 600, -60.0, 60.0);
510  trdTResHisto = new TH1F("trdTResHisto", "trdTResHisto", 200, -10.0, 10.0);
511  muchXResHisto = new TH1F("muchXResHisto", "muchXResHisto", 200, -3.0, 3.0);
512  muchYResHisto = new TH1F("muchYResHisto", "muchYResHisto", 200, -3.0, 3.0);
513  muchTResHisto = new TH1F("muchTResHisto", "muchTResHisto", 200, -10.0, 100.0);
514  tofXResHisto = new TH1F("tofXResHisto", "tofXResHisto", 200, -3.0, 3.0);
515  tofYResHisto = new TH1F("tofYResHisto", "tofYResHisto", 200, -3.0, 3.0);
516  tofTResHisto = new TH1F("tofTResHisto", "tofTResHisto", 200, -10.0, 10.0);
517 
518  extrStsXHisto = new TH1F("extrStsXHisto", "extrStsXHisto", 200, -0.5, 0.5);
519  extrStsYHisto = new TH1F("extrStsYHisto", "extrStsYHisto", 200, -0.5, 0.5);
520 
521  vtxXHisto = new TH1F("vtxXHisto", "vtxXHisto", 100, -0.5, 0.5);
522  vtxYHisto = new TH1F("vtxYHisto", "vtxYHisto", 100, -0.5, 0.5);
523  vtxZHisto = new TH1F("vtxZHisto", "vtxZHisto", 100, -0.5, 0.5);
524 
525  for (int i = 0; i < 2; ++i) {
526  char name[256];
527  sprintf(name, "stsXPullHistos_%d", i);
528  Double_t range = 5;
529  stsXPullHistos[i] = new TH1F(name, name, 200, -range, range);
530  sprintf(name, "stsYPullHistos_%d", i);
531  stsYPullHistos[i] = new TH1F(name, name, 200, -range, range);
532  }
533 
534  for (int i = 0; i < 4; ++i) {
535  char name[256];
536  sprintf(name, "extrTrdXHisto_%d", i);
537  extrTrdXHistos[i] = new TH1F(name, name, 200, 0.5, 0.5);
538  sprintf(name, "extrTrdYHisto_%d", i);
539  extrTrdYHistos[i] = new TH1F(name, name, 200, 0.5, 0.5);
540 
541  sprintf(name, "trdNearestHitDistHistos_%d", i);
542  trdNearestHitDistHistos[i] = new TH1F(name, name, 200, -100, 100);
543 
544  sprintf(name, "trdXPullHistos_%d", i);
545  Double_t range = i % 2 ? 5 : 25;
546  trdXPullHistos[i] = new TH1F(name, name, 200, -range, range);
547  sprintf(name, "trdYPullHistos_%d", i);
548  range = i % 2 ? 25 : 5;
549  trdYPullHistos[i] = new TH1F(name, name, 200, -range, range);
550  }
551 #endif //CBM_BINNED_QA_FILL_HISTOS
552 
553  FairRootManager* ioman = FairRootManager::Instance();
554 
555  if (0 == ioman) LOG(fatal) << "No FairRootManager";
556 
557  CbmMCDataManager* mcManager =
558  static_cast<CbmMCDataManager*>(ioman->GetObject("MCDataManager"));
559 
560  if (0 == mcManager) LOG(fatal) << "No MC data manager";
561 
562  fMCTracks = mcManager->InitBranch("MCTrack");
563 
564  if (0 == fMCTracks) LOG(fatal) << "No MC tracks in the input file";
565 
566  for (Int_t i = 0; fMCTracks->Size(0, i) >= 0; ++i) {
567  gTracks.push_back(vector<TrackDesc>());
568  gStsPoints.push_back(vector<bool>());
569  gMuchPoints.push_back(vector<bool>());
570  gTrdPoints.push_back(vector<bool>());
571  gTofPoints.push_back(vector<char>());
572 
573  Int_t nofMcTracks = fMCTracks->Size(0, i);
574  vector<TrackDesc>& eventTracks = gTracks.back();
575  eventTracks.resize(nofMcTracks);
576 
577  for (Int_t j = 0; j < nofMcTracks; ++j) {
578  TrackDesc& track = eventTracks[j];
579  const CbmMCTrack* mcTrack =
580  static_cast<const CbmMCTrack*>(fMCTracks->Get(0, i, j));
581  track.ptr = mcTrack;
582 
583  bool isPrimary = false;
584  Int_t motherId = mcTrack->GetMotherId();
585  TrackDesc* motherTrack = 0 > motherId ? 0 : &eventTracks[motherId];
586 
588  switch (ppi) {
589  case ppiJpsi: {
590  if (motherId >= 0)
591  isPrimary = 443 == motherTrack->ptr->GetPdgCode();
592 
593  break;
594  }
595 
596  default: isPrimary = motherId < 0;
597  }
598 
599  if (isPrimary) break;
600  }
601 
602  if (isPrimary) {
603  track.isPrimary = true;
604 #ifdef CBM_BINNED_QA_FILL_HISTOS
605  vtxXHisto->Fill(mcTrack->GetStartX());
606  vtxYHisto->Fill(mcTrack->GetStartY());
607  vtxZHisto->Fill(mcTrack->GetStartZ());
608 #endif //CBM_BINNED_QA_FILL_HISTOS
609  } else if (motherId >= 0) {
610  if (motherTrack->ptr->GetPdgCode()
611  == 3122) // Mother particle is a Lambda baryon
612  motherTrack->children.push_back(&track);
613  }
614 
615  if (mcTrack->GetPdgCode() == 3122) // Lambda baryon
616  lambdaList.push_back(&track);
617  }
618  }
619 
620  LOG(info) << "The number of MC events in the input: " << gTracks.size();
621 
622  fGlobalTracks = static_cast<TClonesArray*>(ioman->GetObject("GlobalTrack"));
623 
624  if (0 == fGlobalTracks) LOG(fatal) << "No global tracks in the input file";
625 
626  if (TrackDesc::nofStsStations > 0) {
627  fStsTracks = static_cast<TClonesArray*>(ioman->GetObject("StsTrack"));
628 
629  if (0 == fStsTracks) LOG(fatal) << "No sts tracks in the input file";
630 
631  fStsHits = static_cast<TClonesArray*>(ioman->GetObject("StsHit"));
632 
633  if (0 == fStsHits) LOG(fatal) << "No sts hits in the input file";
634 
635  fStsClusters = static_cast<TClonesArray*>(ioman->GetObject("StsCluster"));
636 
637  if (0 == fStsClusters) LOG(fatal) << "No sts clusters in the input file";
638 
639  fStsDigis = static_cast<TClonesArray*>(ioman->GetObject("StsDigi"));
640 
641  if (0 == fStsDigis) LOG(fatal) << "No sts digis in the input file";
642 
644  static_cast<TClonesArray*>(ioman->GetObject("StsDigiMatch"));
645 
646  if (0 == fStsDigiMatches)
647  LOG(fatal) << "No sts digi matches in the input file";
648 
649  fStsPoints = mcManager->InitBranch("StsPoint");
650 
651  if (0 == fStsPoints) LOG(fatal) << "No sts MC points in the input file";
652 
653  for (Int_t i = 0; fStsPoints->Size(0, i) >= 0; ++i) {
654  Int_t nofPoints = fStsPoints->Size(0, i);
655  gStsPoints[i].resize(nofPoints, false);
656  vector<TrackDesc>& tracks = gTracks[i];
657 
658  for (Int_t j = 0; j < nofPoints; ++j) {
659  const CbmStsPoint* stsPoint =
660  static_cast<const CbmStsPoint*>(fStsPoints->Get(0, i, j));
661  Int_t trackId = stsPoint->GetTrackID();
662  Int_t stationNumber =
663  CbmStsSetup::Instance()->GetStationNumber(stsPoint->GetDetectorID());
664  //Int_t stationNumber = CbmStsAddress::GetElementId(stsPoint->GetDetectorID(), kSts);
665  //tracks[trackId].sts[stationNumber].first.insert(j);
666  TrackDesc& trackDesk = tracks[trackId];
667  trackDesk.stsPoints[stationNumber].insert(stsPoint);
668  }
669  }
670  }
671 
672  if (TrackDesc::nofMuchStations > 0) {
673  fMuchTracks = static_cast<TClonesArray*>(ioman->GetObject("MuchTrack"));
674 
675  if (0 == fMuchTracks) LOG(fatal) << "No much tracks in the input file";
676 
677  fMuchHits = static_cast<TClonesArray*>(ioman->GetObject("MuchPixelHit"));
678 
679  if (0 == fMuchHits) LOG(fatal) << "No much hits in the input file";
680 
681  fMuchClusters = static_cast<TClonesArray*>(ioman->GetObject("MuchCluster"));
682 
683  if (0 == fMuchClusters) LOG(fatal) << "No much clusters in the input file";
684 
685  fMuchDigis = static_cast<TClonesArray*>(ioman->GetObject("MuchDigi"));
686 
687  if (0 == fMuchDigis) LOG(fatal) << "No much digis in the input file";
688 
690  static_cast<TClonesArray*>(ioman->GetObject("MuchDigiMatch"));
691 
692  if (0 == fMuchDigiMatches)
693  LOG(fatal) << "No much digi matches in the input file";
694 
695  fMuchPoints = mcManager->InitBranch("MuchPoint");
696 
697  if (0 == fMuchPoints) LOG(fatal) << "No much MC points in the input file";
698 
699  for (Int_t i = 0; fMuchPoints->Size(0, i) >= 0; ++i) {
700  Int_t nofPoints = fMuchPoints->Size(0, i);
701  gMuchPoints[i].resize(nofPoints, false);
702  vector<TrackDesc>& tracks = gTracks[i];
703 
704  for (Int_t j = 0; j < nofPoints; ++j) {
705  const CbmMuchPoint* muchPoint =
706  static_cast<const CbmMuchPoint*>(fMuchPoints->Get(0, i, j));
707  Int_t trackId = muchPoint->GetTrackID();
708  int muchStationNumber =
709  CbmMuchGeoScheme::GetStationIndex(muchPoint->GetDetectorID());
710  int layerNumber =
711  CbmMuchGeoScheme::GetLayerIndex(muchPoint->GetDetectorID());
712  int stationNumber = muchStationNumber * 3 + layerNumber;
713  //tracks[trackId].much[stationNumber].first.insert(j);
714  TrackDesc& trackDesk = tracks[trackId];
715  trackDesk.muchPoints[stationNumber].insert(muchPoint);
716  }
717  }
718  }
719 
720  if (TrackDesc::nofTrdStations > 0) {
721  fTrdTracks = static_cast<TClonesArray*>(ioman->GetObject("TrdTrack"));
722 
723  if (0 == fTrdTracks) LOG(fatal) << "No trd tracks in the input file";
724 
725  fTrdHits = static_cast<TClonesArray*>(ioman->GetObject("TrdHit"));
726 
727  if (0 == fTrdHits) LOG(fatal) << "No trd hits in the input file";
728 
729 #ifdef TRD_IDEAL
730  fTrdDigis = static_cast<TClonesArray*>(ioman->GetObject("TrdDigi"));
731 
732  if (0 == fTrdDigis) LOG(fatal) << "No trd digis in the input file";
733 #else //TRD_IDEAL
734  fTrdClusters = static_cast<TClonesArray*>(ioman->GetObject("TrdCluster"));
735 
736  if (0 == fTrdClusters) LOG(fatal) << "No global tracks in the input file";
737 
739  static_cast<TClonesArray*>(ioman->GetObject("TrdDigiMatch"));
740 
741  if (0 == fTrdDigiMatches)
742  LOG(fatal) << "No trd hit to digi matches in the input file";
743 #endif //TRD_IDEAL
744 
745  fTrdPoints = mcManager->InitBranch("TrdPoint");
746 
747  if (0 == fTrdPoints) LOG(fatal) << "No trd MC points in the input file";
748 
749  for (Int_t i = 0; fTrdPoints->Size(0, i) >= 0; ++i) {
750  Int_t nofPoints = fTrdPoints->Size(0, i);
751  gTrdPoints[i].resize(nofPoints, false);
752  vector<TrackDesc>& tracks = gTracks[i];
753 
754  for (Int_t j = 0; j < nofPoints; ++j) {
755  const CbmTrdPoint* trdPoint =
756  static_cast<const CbmTrdPoint*>(fTrdPoints->Get(0, i, j));
757  Int_t trackId = trdPoint->GetTrackID();
758  int stationNumber =
760  //tracks[trackId].trd[stationNumber].first.insert(j);
761  TrackDesc& trackDesk = tracks[trackId];
762  trackDesk.trdPoints[stationNumber].insert(trdPoint);
763  }
764  }
765  }
766 
767  if (TrackDesc::hasTof) {
768  fTofHits = static_cast<TClonesArray*>(ioman->GetObject("TofHit"));
769 
770  if (0 == fTofHits) LOG(fatal) << "No tof hits in the input file";
771 
773  static_cast<TClonesArray*>(ioman->GetObject("TofDigiMatch"));
774 
775  if (0 == fTofHitDigiMatches)
776  LOG(fatal) << "No tof hit to digi matches in the input file";
777 
779  static_cast<TClonesArray*>(ioman->GetObject("TofDigiMatchPoints"));
780 
781  if (0 == fTofDigiPointMatches)
782  LOG(fatal) << "No tof digi to point matches in the input file";
783 
784  fTofDigis = static_cast<TClonesArray*>(ioman->GetObject("TofDigi"));
785 
786  if (0 == fTofDigis) LOG(fatal) << "No tof digis in the input file";
787 
788  fTofPoints = mcManager->InitBranch("TofPoint");
789 
790  if (0 == fTofPoints) LOG(fatal) << "No tof MC points in the input file";
791 
792  for (Int_t i = 0; fTofPoints->Size(0, i) >= 0; ++i) {
793  Int_t nofPoints = fTofPoints->Size(0, i);
794  vector<TrackDesc>& tracks = gTracks[i];
795  gTofPoints[i].resize(tracks.size(), 0);
796 
797  for (Int_t j = 0; j < nofPoints; ++j) {
798  const CbmTofPoint* tofPoint =
799  static_cast<const CbmTofPoint*>(fTofPoints->Get(0, i, j));
800  Int_t trackId = tofPoint->GetTrackID();
801  gTofPoints[i][trackId] = 1;
802  }
803  }
804  }
805 
806  return kSUCCESS;
807 }
808 
810  std::function<void(const CbmTrdHit*, const CbmTrdPoint*)> handleData) {
811  Int_t nofTrdHits = fTrdHits->GetEntriesFast();
812 
813  for (Int_t i = 0; i < nofTrdHits; ++i) {
814  const CbmTrdHit* trdHit = static_cast<const CbmTrdHit*>(fTrdHits->At(i));
815  //Int_t stationNumber = trdHit->GetPlaneId(); (VF) unused
816  Int_t clusterId = trdHit->GetRefId();
817  const CbmTrdCluster* cluster =
818  static_cast<const CbmTrdCluster*>(fTrdClusters->At(clusterId));
819  Int_t nofDigis = cluster->GetNofDigis();
820 
821  for (Int_t j = 0; j < nofDigis; ++j) {
822  Int_t digiId = cluster->GetDigi(j);
823  const CbmMatch* match =
824  static_cast<const CbmMatch*>(fTrdDigiMatches->At(digiId));
825  Int_t nofLinks = match->GetNofLinks();
826 
827  for (Int_t k = 0; k < nofLinks; ++k) {
828  const CbmLink& link = match->GetLink(k);
829  Int_t eventId = link.GetEntry();
830  Int_t mcPointId = link.GetIndex();
831  const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(
832  fTrdPoints->Get(0, eventId, mcPointId));
833  handleData(trdHit, trdPoint);
834  }
835  }
836  } // TRD hits
837 }
838 
839 static Int_t gEventNumber = 0;
840 static Int_t gNofRecoTracks = 0;
841 static Int_t gNofNonGhosts = 0;
842 static Int_t gNofClones = 0;
843 static vector<bool> gIsRecoClone;
844 
845 void CbmBinnedTrackerQA::Exec(Option_t*) {
846  gIsRecoClone.clear();
847 
848  if (TrackDesc::nofStsStations > 0) {
849  Int_t nofStsHits = fStsHits->GetEntriesFast();
850 
851  for (Int_t i = 0; i < nofStsHits; ++i) {
852  const CbmStsHit* stsHit = static_cast<const CbmStsHit*>(fStsHits->At(i));
853  Int_t stationNumber =
855  //Int_t stationNumber = CbmStsAddress::GetElementId(stsHit->GetAddress(), kSts);
856  Int_t frontClusterInd = stsHit->GetFrontClusterId();
857  Int_t backClusterInd = stsHit->GetBackClusterId();
858  const CbmStsCluster* frontCluster =
859  static_cast<const CbmStsCluster*>(fStsClusters->At(frontClusterInd));
860  Int_t nofFrontDigis = frontCluster->GetNofDigis();
861 
862  for (Int_t j = 0; j < nofFrontDigis; ++j) {
863  Int_t stsDigiInd = frontCluster->GetDigi(j);
864  //const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*> (fStsDigis->At(stsDigiInd));
865  const CbmMatch* stsDigiMatch =
866  static_cast<const CbmMatch*>(fStsDigiMatches->At(stsDigiInd));
867  Int_t nofLinks = stsDigiMatch->GetNofLinks();
868 
869  for (Int_t k = 0; k < nofLinks; ++k) {
870  const CbmLink& link = stsDigiMatch->GetLink(k);
871  Int_t eventId = link.GetEntry();
872  Int_t mcPointId = link.GetIndex();
873  gStsPoints[eventId][mcPointId] = true;
874  const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(
875  fStsPoints->Get(0, eventId, mcPointId));
876 #ifdef CBM_BINNED_QA_FILL_HISTOS
877  stsXResHisto->Fill(stsHit->GetX()
878  - (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2);
879  stsYResHisto->Fill(stsHit->GetY()
880  - (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2);
881  stsTResHisto->Fill(stsHit->GetTime() - stsPoint->GetTime());
882 #endif //CBM_BINNED_QA_FILL_HISTOS
883  Int_t trackId = stsPoint->GetTrackID();
884  TrackDesc& trackDesk = gTracks[eventId][trackId];
885  trackDesk.sts[stationNumber].first.insert(i);
886  Double_t mcX = (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2;
887  Double_t mcY = (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2;
888 
889  if (trackDesk.isPrimary && !trackDesk.stsPoints[0].empty()
890  && !trackDesk.stsPoints[1].empty()) {
891  Double_t dist =
892  std::sqrt((stsHit->GetX() - mcX) * (stsHit->GetX() - mcX)
893  + (stsHit->GetY() - mcY) * (stsHit->GetY() - mcY));
894 
895  if (trackDesk.nearestHitDistSts[stationNumber] < 0
896  || dist < trackDesk.nearestHitDistSts[stationNumber]) {
897  trackDesk.nearestHitDistSts[stationNumber] = dist;
898  trackDesk.nearestPointsSts[stationNumber] = stsPoint;
899  trackDesk.pullXsts[stationNumber] =
900  (stsHit->GetX() - mcX) / stsHit->GetDx();
901  trackDesk.pullYsts[stationNumber] =
902  (stsHit->GetY() - mcY) / stsHit->GetDy();
903  }
904  }
905  }
906  }
907 
908  const CbmStsCluster* backCluster =
909  static_cast<const CbmStsCluster*>(fStsClusters->At(backClusterInd));
910  Int_t nofBackDigis = backCluster->GetNofDigis();
911 
912  for (Int_t j = 0; j < nofBackDigis; ++j) {
913  Int_t stsDigiInd = backCluster->GetDigi(j);
914  //const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*> (fStsDigis->At(stsDigiInd));
915  const CbmMatch* stsDigiMatch =
916  static_cast<const CbmMatch*>(fStsDigiMatches->At(stsDigiInd));
917  Int_t nofLinks = stsDigiMatch->GetNofLinks();
918 
919  for (Int_t k = 0; k < nofLinks; ++k) {
920  const CbmLink& link = stsDigiMatch->GetLink(k);
921  Int_t eventId = link.GetEntry();
922  Int_t mcPointId = link.GetIndex();
923  gStsPoints[eventId][mcPointId] = true;
924  const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(
925  fStsPoints->Get(0, eventId, mcPointId));
926 #ifdef CBM_BINNED_QA_FILL_HISTOS
927  stsXResHisto->Fill(stsHit->GetX()
928  - (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2);
929  stsYResHisto->Fill(stsHit->GetY()
930  - (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2);
931  stsTResHisto->Fill(stsHit->GetTime() - stsPoint->GetTime());
932 #endif //CBM_BINNED_QA_FILL_HISTOS
933  Int_t trackId = stsPoint->GetTrackID();
934  TrackDesc& trackDesk = gTracks[eventId][trackId];
935  trackDesk.sts[stationNumber].first.insert(i);
936  Double_t mcX = (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2;
937  Double_t mcY = (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2;
938 
939  if (trackDesk.isPrimary && !trackDesk.stsPoints[0].empty()
940  && !trackDesk.stsPoints[1].empty()) {
941  Double_t dist =
942  std::sqrt((stsHit->GetX() - mcX) * (stsHit->GetX() - mcX)
943  + (stsHit->GetY() - mcY) * (stsHit->GetY() - mcY));
944 
945  if (trackDesk.nearestHitDistSts[stationNumber] < 0
946  || dist < trackDesk.nearestHitDistSts[stationNumber]) {
947  trackDesk.nearestHitDistSts[stationNumber] = dist;
948  trackDesk.nearestPointsSts[stationNumber] = stsPoint;
949  trackDesk.pullXsts[stationNumber] =
950  (stsHit->GetX() - mcX) / stsHit->GetDx();
951  trackDesk.pullYsts[stationNumber] =
952  (stsHit->GetY() - mcY) / stsHit->GetDy();
953  }
954  }
955  }
956  }
957  } // STS hits
958  }
959 
960  if (TrackDesc::nofMuchStations > 0) {
961  Int_t nofMuchHits = fMuchHits->GetEntriesFast();
962 
963  for (Int_t i = 0; i < nofMuchHits; ++i) {
964  const CbmMuchPixelHit* muchHit =
965  static_cast<const CbmMuchPixelHit*>(fMuchHits->At(i));
966  Int_t muchStationNumber =
968  Int_t layerNumber =
970  Int_t stationNumber = muchStationNumber * 3 + layerNumber;
971  Int_t clusterId = muchHit->GetRefId();
972  const CbmMuchCluster* cluster =
973  static_cast<const CbmMuchCluster*>(fMuchClusters->At(clusterId));
974  Int_t nofDigis = cluster->GetNofDigis();
975 
976  for (Int_t j = 0; j < nofDigis; ++j) {
977  Int_t digiId = cluster->GetDigi(j);
978  //const CbmMuchDigi* digi = static_cast<const CbmMuchDigi*> (fMuchDigis->At(digiId));
979  const CbmMatch* muchDigiMatch =
980  static_cast<const CbmMatch*>(fMuchDigiMatches->At(digiId));
981  Int_t nofLinks = muchDigiMatch->GetNofLinks();
982 
983  for (Int_t k = 0; k < nofLinks; ++k) {
984  const CbmLink& link = muchDigiMatch->GetLink(k);
985  Int_t eventId = link.GetEntry();
986  Int_t mcPointId = link.GetIndex();
987  gMuchPoints[eventId][mcPointId] = true;
988  const CbmMuchPoint* muchPoint = static_cast<const CbmMuchPoint*>(
989  fMuchPoints->Get(0, eventId, mcPointId));
990  Double_t mcX = (muchPoint->GetXIn() + muchPoint->GetXOut()) / 2;
991  Double_t mcY = (muchPoint->GetYIn() + muchPoint->GetYOut()) / 2;
992  Double_t mcT = muchPoint->GetTime();
993  Double_t xRes = muchHit->GetX() - mcX;
994  Double_t yRes = muchHit->GetY() - mcY;
995  Double_t tRes = muchHit->GetTime() - mcT;
996  Double_t xPull = xRes / muchHit->GetDx();
997  Double_t yPull = yRes / muchHit->GetDy();
998  Double_t tPull = tRes / muchHit->GetTimeError();
999  muchHitResidualX->Fill(xRes);
1000  muchHitResidualY->Fill(yRes);
1001  muchHitResidualT->Fill(tRes);
1002  muchHitPullX->Fill(xPull);
1003  muchHitPullY->Fill(yPull);
1004  muchHitPullT->Fill(tPull);
1005 #ifdef CBM_BINNED_QA_FILL_HISTOS
1006  muchXResHisto->Fill(
1007  muchHit->GetX() - (muchPoint->GetXIn() + muchPoint->GetXOut()) / 2);
1008  muchYResHisto->Fill(
1009  muchHit->GetY() - (muchPoint->GetYIn() + muchPoint->GetYOut()) / 2);
1010  muchTResHisto->Fill(muchHit->GetTime() - muchPoint->GetTime());
1011 #endif //CBM_BINNED_QA_FILL_HISTOS
1012  Int_t trackId = muchPoint->GetTrackID();
1013  TrackDesc& trackDesk = gTracks[eventId][trackId];
1014  trackDesk.much[stationNumber].first.insert(i);
1015  }
1016  }
1017  } // MUCH hits*/
1018  }
1019 
1020  if (TrackDesc::nofTrdStations > 0) {
1021  Int_t nofTrdHits = fTrdHits->GetEntriesFast();
1022 
1023  for (Int_t i = 0; i < nofTrdHits; ++i) {
1024  const CbmTrdHit* trdHit = static_cast<const CbmTrdHit*>(fTrdHits->At(i));
1025  Int_t stationNumber = trdHit->GetPlaneId();
1026  Int_t clusterId = trdHit->GetRefId();
1027 #ifndef TRD_IDEAL
1028  const CbmTrdCluster* cluster =
1029  static_cast<const CbmTrdCluster*>(fTrdClusters->At(clusterId));
1030  Int_t nofDigis = cluster->GetNofDigis();
1031 
1032  for (Int_t j = 0; j < nofDigis; ++j) {
1033  Int_t digiId = cluster->GetDigi(j);
1034  const CbmMatch* match =
1035  static_cast<const CbmMatch*>(fTrdDigiMatches->At(digiId));
1036  Int_t nofLinks = match->GetNofLinks();
1037 
1038  for (Int_t k = 0; k < nofLinks; ++k) {
1039  const CbmLink& link = match->GetLink(k);
1040  Int_t eventId = link.GetEntry();
1041  Int_t mcPointId = link.GetIndex();
1042  gTrdPoints[eventId][mcPointId] = true;
1043  const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(
1044  fTrdPoints->Get(0, eventId, mcPointId));
1045 #ifdef CBM_BINNED_QA_FILL_HISTOS
1046  //Double_t mcX = (trdPoint->GetXIn() + trdPoint->GetXOut()) / 2; (VF) unused
1047  //Double_t mcY = (trdPoint->GetYIn() + trdPoint->GetYOut()) / 2; (VF) unused
1048  trdXResHisto->Fill(trdHit->GetX() - mcX);
1049  trdYResHisto->Fill(trdHit->GetY() - mcY);
1050  trdTResHisto->Fill(trdHit->GetTime() - trdPoint->GetTime());
1051 #endif //CBM_BINNED_QA_FILL_HISTOS
1052  Int_t trackId = trdPoint->GetTrackID();
1053  TrackDesc& trackDesk = gTracks[eventId][trackId];
1054  trackDesk.trd[stationNumber].first.insert(i);
1055 
1056 #ifdef CBM_BINNED_QA_FILL_HISTOS
1057  if (trackDesk.isPrimary && !trackDesk.trdPoints[0].empty()
1058  && !trackDesk.trdPoints[1].empty()
1059  && !trackDesk.trdPoints[2].empty()
1060  && !trackDesk.trdPoints[3].empty()) {
1061  Double_t dist =
1062  std::sqrt((trdHit->GetX() - mcX) * (trdHit->GetX() - mcX)
1063  + (trdHit->GetY() - mcY) * (trdHit->GetY() - mcY));
1064 
1065  if (trackDesk.nearestHitDistTrd[stationNumber] < 0
1066  || dist < trackDesk.nearestHitDistTrd[stationNumber]) {
1067  trackDesk.nearestHitDistTrd[stationNumber] = dist;
1068  trackDesk.nearestPointsTrd[stationNumber] = trdPoint;
1069  trackDesk.pullXtrd[stationNumber] =
1070  (trdHit->GetX() - mcX) / trdHit->GetDx();
1071  trackDesk.pullYtrd[stationNumber] =
1072  (trdHit->GetY() - mcY) / trdHit->GetDy();
1073  }
1074  }
1075 #endif //CBM_BINNED_QA_FILL_HISTOS
1076  }
1077  }
1078 #else //TRD_IDEAL
1079  const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(
1080  fTrdPoints->Get(0, gEventNumber, clusterId));
1081  Double_t mcX = (trdPoint->GetXIn() + trdPoint->GetXOut()) / 2;
1082  Double_t mcY = (trdPoint->GetYIn() + trdPoint->GetYOut()) / 2;
1083  trdXResHisto->Fill(trdHit->GetX() - mcX);
1084  trdYResHisto->Fill(trdHit->GetY() - mcY);
1085  trdTResHisto->Fill(trdHit->GetTime() - trdPoint->GetTime());
1086  Int_t trackId = trdPoint->GetTrackID();
1087  TrackDesc& trackDesk = gTracks[gEventNumber][trackId];
1088  trackDesk.trd[stationNumber].first.insert(i);
1089 
1090  if (trackDesk.isPrimary && !trackDesk.trdPoints[0].empty()
1091  && !trackDesk.trdPoints[1].empty() && !trackDesk.trdPoints[2].empty()
1092  && !trackDesk.trdPoints[3].empty()) {
1093  Double_t dist =
1094  std::sqrt((trdHit->GetX() - mcX) * (trdHit->GetX() - mcX)
1095  + (trdHit->GetY() - mcY) * (trdHit->GetY() - mcY));
1096 
1097  if (trackDesk.nearestHitDist[stationNumber] < 0
1098  || dist < trackDesk.nearestHitDist[stationNumber]) {
1099  trackDesk.nearestHitDist[stationNumber] = dist;
1100  trackDesk.nearestPoints[stationNumber] = trdPoint;
1101  trackDesk.pullX[stationNumber] =
1102  (trdHit->GetX() - mcX) / trdHit->GetDx();
1103  trackDesk.pullY[stationNumber] =
1104  (trdHit->GetY() - mcY) / trdHit->GetDy();
1105  }
1106  }
1107 #endif //TRD_IDEAL
1108  } // TRD hits
1109  }
1110 
1111  if (TrackDesc::hasTof) {
1112  Int_t nofTofHits = fTofHits->GetEntriesFast();
1113 
1114  for (Int_t i = 0; i < nofTofHits; ++i) {
1115  //const CbmTofHit* tofHit = static_cast<const CbmTofHit*> (fTofHits->At(i));
1116  const CbmMatch* tofHitMatch =
1117  static_cast<const CbmMatch*>(fTofHitDigiMatches->At(i));
1118  Int_t nofTofDigis = tofHitMatch->GetNofLinks();
1119 
1120  for (Int_t j = 0; j < nofTofDigis; ++j) {
1121  const CbmLink& digiLink = tofHitMatch->GetLink(j);
1122  Int_t digiInd = digiLink.GetIndex();
1123  const CbmMatch* pointMatch =
1124  static_cast<const CbmMatch*>(fTofDigiPointMatches->At(digiInd));
1125  Int_t nofPoints = pointMatch->GetNofLinks();
1126 
1127  for (Int_t k = 0; k < nofPoints; ++k) {
1128  const CbmLink& pointLink = pointMatch->GetLink(k);
1129  Int_t eventId = pointLink.GetEntry();
1130  Int_t mcPointId = pointLink.GetIndex();
1131  const CbmTofPoint* tofPoint = static_cast<const CbmTofPoint*>(
1132  fTofPoints->Get(0, eventId, mcPointId));
1133 #ifdef CBM_BINNED_QA_FILL_HISTOS
1134  tofXResHisto->Fill(tofHit->GetX() - tofPoint->GetX());
1135  tofYResHisto->Fill(tofHit->GetY() - tofPoint->GetY());
1136  tofTResHisto->Fill(tofHit->GetTime() - tofPoint->GetTime());
1137 #endif //CBM_BINNED_QA_FILL_HISTOS
1138  Int_t trackId = tofPoint->GetTrackID();
1139  TrackDesc& trackDesk = gTracks[eventId][trackId];
1140  trackDesk.tof.first.insert(i);
1141  gTofPoints[eventId][trackId] = 2;
1142  }
1143  }
1144  } // TOF hits
1145  }
1146 
1147  Int_t nofStations = fSettings->GetNofStations();
1148  Int_t nofGlobalTracks = fGlobalTracks->GetEntriesFast();
1149  set<Int_t>* globalTrackMCRefs = new set<Int_t>[nofGlobalTracks * nofStations];
1150  Int_t* globalTracksHitInds = new Int_t[nofGlobalTracks * nofStations];
1151  gIsRecoClone.resize(nofGlobalTracks);
1152  fill(gIsRecoClone.begin(), gIsRecoClone.end(), false);
1153 
1154  for (Int_t i = 0; i < nofGlobalTracks; ++i) {
1155  ++gNofRecoTracks;
1156  const CbmGlobalTrack* globalTrack =
1157  static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(i));
1158  Int_t stsIndex = globalTrack->GetStsTrackIndex();
1159  Int_t muchIndex = globalTrack->GetMuchTrackIndex();
1160  Int_t trdIndex = globalTrack->GetTrdTrackIndex();
1161  Int_t tofIndex = globalTrack->GetTofHitIndex();
1162 
1163  if (TrackDesc::nofStsStations > 0 && stsIndex < 0) continue;
1164 
1165  if (TrackDesc::nofMuchStations > 0 && muchIndex < 0) continue;
1166 
1167  if (TrackDesc::nofTrdStations > 0 && trdIndex < 0) continue;
1168 
1169  if (TrackDesc::hasTof && tofIndex < 0) continue;
1170 
1171  map<Int_t, set<Int_t>> mcTrackIds;
1172 
1173  if (TrackDesc::nofStsStations > 0)
1174  HandleSts(stsIndex, mcTrackIds, globalTrackMCRefs, globalTracksHitInds);
1175 
1177  HandleMuch(muchIndex, mcTrackIds, globalTrackMCRefs, globalTracksHitInds);
1178 
1179  if (TrackDesc::nofTrdStations > 0)
1180  HandleTrd(trdIndex, mcTrackIds, globalTrackMCRefs, globalTracksHitInds);
1181 
1182  if (TrackDesc::hasTof)
1183  HandleTof(
1184  i, tofIndex, mcTrackIds, globalTrackMCRefs, globalTracksHitInds);
1185 
1186  map<Int_t, set<Int_t>>::const_iterator maxIter = max_element(
1187  mcTrackIds.begin(),
1188  mcTrackIds.end(),
1189  [](const pair<Int_t, set<Int_t>>& p1, const pair<Int_t, set<Int_t>>& p2) {
1190  return p1.second.size() < p2.second.size();
1191  });
1192 
1193  if (maxIter->second.size() < size_t(0.7 * nofStations)) continue;
1194 
1195  ++gNofNonGhosts;
1196  }
1197 
1198  map<Int_t, set<Int_t>>* mcToGlobalRefs =
1199  new map<Int_t, set<Int_t>>[nofStations];
1200 
1201  for (Int_t i = 0; i < nofGlobalTracks; ++i) {
1202  //map<Int_t, Int_t> matches;// The map from global track IDs, different from the current (i-th) global track ID, to the number of stations, where their hits originate from the MC tracks.
1203 
1204  for (Int_t j = 0; j < nofStations; ++j) {
1205  //set<Int_t> globals;// Global track IDs, which reference the same Monte Carlo track IDs on this station as the i-th (global) track.
1206  const set<Int_t>& mcs = globalTrackMCRefs[i * nofStations + j];
1207 
1208  for (set<Int_t>::const_iterator k = mcs.begin(); k != mcs.end(); ++k) {
1209  Int_t mc = *k;
1210  /*map<Int_t, set<Int_t> >::const_iterator mctogIter = mcToGlobalRefs[j].find(mc);
1211 
1212  if (mctogIter == mcToGlobalRefs[j].end())
1213  continue;
1214 
1215  globals.insert(mctogIter->second.begin(), mctogIter->second.end());*/
1216  mcToGlobalRefs[j][mc].insert(i);
1217  }
1218 
1219  /*for (set<Int_t>::const_iterator k = globals.begin(); k != globals.end(); ++k)
1220  {
1221  Int_t gl = *k;
1222  map<Int_t, Int_t>::iterator mIter = matches.find(gl);
1223 
1224  if (mIter == matches.end())
1225  matches[gl] = 1;
1226  else
1227  ++mIter->second;
1228  }*/
1229  }
1230 
1231  //map<Int_t, Int_t>::const_iterator maxIter = max_element(matches.begin(), matches.end(),
1232  // [](const pair<Int_t, Int_t>& p1, const pair<Int_t, Int_t>& p2)
1233  //{
1234  //return p1.second < p2.second;
1235  //});
1236 
1237  /*for (map<Int_t, Int_t>::const_iterator maxIter = matches.begin(); maxIter != matches.end(); ++maxIter)
1238  {
1239  if (maxIter->second >= int(0.7 * nofStations))
1240  {
1241  ++gNofClones;
1242  Int_t origTrackInd = maxIter->first;
1243  int nofSameHits = 0;
1244 
1245  for (Int_t j = 0; j < nofStations; ++j)
1246  {
1247  Int_t hitInd = globalTracksHitInds[i * nofStations + j];
1248  Int_t origHitInd = globalTracksHitInds[origTrackInd * nofStations + j];
1249 
1250  if (hitInd == origHitInd)
1251  ++nofSameHits;
1252  }
1253 
1254  clonesNofSameHits->Fill(nofSameHits);
1255  continue;
1256  }
1257  }
1258 
1259  for (Int_t j = 0; j < nofStations; ++j)
1260  {
1261  const set<Int_t>& mcs = globalTrackMCRefs[i * nofStations + j];
1262 
1263  for (set<Int_t>::const_iterator k = mcs.begin(); k != mcs.end(); ++k)
1264  {
1265  Int_t mc = *k;
1266  mcToGlobalRefs[j][mc].insert(i);
1267  }
1268  }*/
1269  } // Filling global tracks to mc maps for furhter clones searches
1270 
1271  for (Int_t i = 0; i < nofGlobalTracks; ++i) {
1272  const CbmGlobalTrack* thisTrack =
1273  static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(i));
1274 
1275  //if (gIsRecoClone[i])
1276  //continue;
1277 
1278  map<Int_t, Int_t>
1279  matches; // The map from global track IDs, different from the current (i-th) global track ID, to the number of stations, where their hits originate from the MC tracks.
1280 
1281  for (Int_t j = 0; j < nofStations; ++j) {
1282  set<Int_t>
1283  globals; // Global track IDs, which reference the same Monte Carlo track IDs on this station as the i-th (global) track.
1284  const set<Int_t>& mcs = globalTrackMCRefs[i * nofStations + j];
1285 
1286  for (set<Int_t>::const_iterator k = mcs.begin(); k != mcs.end(); ++k) {
1287  Int_t mc = *k;
1288  map<Int_t, set<Int_t>>::const_iterator mctogIter =
1289  mcToGlobalRefs[j].find(mc);
1290 
1291  if (mctogIter == mcToGlobalRefs[j].end()) continue;
1292 
1293  globals.insert(mctogIter->second.begin(), mctogIter->second.end());
1294  }
1295 
1296  for (set<Int_t>::const_iterator k = globals.begin(); k != globals.end();
1297  ++k) {
1298  Int_t gl = *k;
1299 
1300  if (gl == i) continue;
1301 
1302  map<Int_t, Int_t>::iterator mIter = matches.find(gl);
1303 
1304  if (mIter == matches.end())
1305  matches[gl] = 1;
1306  else
1307  ++mIter->second;
1308  }
1309  }
1310 
1311  for (map<Int_t, Int_t>::const_iterator j = matches.begin();
1312  j != matches.end();
1313  ++j) {
1314  if (j->second >= int(0.7 * nofStations)) {
1315  const CbmGlobalTrack* anotherTrack =
1316  static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(j->first));
1317 
1318  //if (gIsRecoClone[j->first])
1319  //continue;
1320 
1321  if (thisTrack->GetChi2() < anotherTrack->GetChi2())
1322  gIsRecoClone[j->first] = true;
1323  else
1324  gIsRecoClone[i] = true;
1325  }
1326  }
1327  }
1328 
1329  for (Int_t i = 0; i < nofGlobalTracks; ++i) {
1330  if (gIsRecoClone[i]) ++gNofClones;
1331  }
1332 
1333  delete[] mcToGlobalRefs;
1334  delete[] globalTrackMCRefs;
1335  delete[] globalTracksHitInds;
1336 
1337  ++gEventNumber;
1338 }
1339 
1340 static inline void
1341 IncrementForId(map<Int_t, set<Int_t>>& ids, Int_t id, Int_t stId) {
1342  ids[id].insert(stId);
1343 }
1344 
1345 void CbmBinnedTrackerQA::HandleSts(Int_t stsTrackIndex,
1346  map<Int_t, set<Int_t>>& mcTrackIds,
1347  set<Int_t>* globalTrackMCRefs,
1348  Int_t* globalTracksHitInds) {
1349  int nofStations = fSettings->GetNofStations();
1350  const CbmStsTrack* stsTrack =
1351  static_cast<const CbmStsTrack*>(fStsTracks->At(stsTrackIndex));
1352  Int_t nofStsHits = stsTrack->GetNofHits();
1353 
1354  for (Int_t i = 0; i < nofStsHits; ++i) {
1355  Int_t stsHitInd = stsTrack->GetStsHitIndex(i);
1356  const CbmStsHit* stsHit =
1357  static_cast<const CbmStsHit*>(fStsHits->At(stsHitInd));
1358  Int_t stationNumber =
1360  globalTracksHitInds[stsTrackIndex * nofStations
1361  + TrackDesc::firstStsStationNo + stationNumber] =
1362  stsHitInd;
1363  Double_t mcX = 0;
1364  Double_t mcY = 0;
1365  Double_t mcCnt = 0;
1366  //Int_t stationNumber = CbmStsAddress::GetElementId(stsHit->GetAddress(), kSts);
1367  Int_t frontClusterInd = stsHit->GetFrontClusterId();
1368  Int_t backClusterInd = stsHit->GetBackClusterId();
1369  const CbmStsCluster* frontCluster =
1370  static_cast<const CbmStsCluster*>(fStsClusters->At(frontClusterInd));
1371  Int_t nofFrontDigis = frontCluster->GetNofDigis();
1372 
1373  for (Int_t j = 0; j < nofFrontDigis; ++j) {
1374  Int_t stsDigiInd = frontCluster->GetDigi(j);
1375  //const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*> (fStsDigis->At(stsDigiInd));
1376  const CbmMatch* stsDigiMatch =
1377  static_cast<const CbmMatch*>(fStsDigiMatches->At(stsDigiInd));
1378  Int_t nofLinks = stsDigiMatch->GetNofLinks();
1379 
1380  for (Int_t k = 0; k < nofLinks; ++k) {
1381  const CbmLink& link = stsDigiMatch->GetLink(k);
1382  Int_t eventId = link.GetEntry();
1383  Int_t mcPointId = link.GetIndex();
1384  const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(
1385  fStsPoints->Get(0, eventId, mcPointId));
1386  mcX += (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2;
1387  mcY += (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2;
1388  ++mcCnt;
1389  Int_t trackId = stsPoint->GetTrackID();
1390  IncrementForId(mcTrackIds, trackId, stationNumber);
1391  globalTrackMCRefs[stsTrackIndex * nofStations + stationNumber].insert(
1392  trackId);
1393  TrackDesc& trackDesk = gTracks[eventId][trackId];
1394 
1395  if (trackDesk.sts[stationNumber].first.find(stsHitInd)
1396  != trackDesk.sts[stationNumber].first.end())
1397  trackDesk.sts[stationNumber].second.insert(stsTrackIndex);
1398  }
1399  }
1400 
1401  const CbmStsCluster* backCluster =
1402  static_cast<const CbmStsCluster*>(fStsClusters->At(backClusterInd));
1403  Int_t nofBackDigis = backCluster->GetNofDigis();
1404 
1405  for (Int_t j = 0; j < nofBackDigis; ++j) {
1406  Int_t stsDigiInd = backCluster->GetDigi(j);
1407  //const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*> (fStsDigis->At(stsDigiInd));
1408  const CbmMatch* stsDigiMatch =
1409  static_cast<const CbmMatch*>(fStsDigiMatches->At(stsDigiInd));
1410  Int_t nofLinks = stsDigiMatch->GetNofLinks();
1411 
1412  for (Int_t k = 0; k < nofLinks; ++k) {
1413  const CbmLink& link = stsDigiMatch->GetLink(k);
1414  Int_t eventId = link.GetEntry();
1415  Int_t mcPointId = link.GetIndex();
1416  const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(
1417  fStsPoints->Get(0, eventId, mcPointId));
1418  mcX += (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2;
1419  mcY += (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2;
1420  ++mcCnt;
1421  Int_t trackId = stsPoint->GetTrackID();
1422  IncrementForId(mcTrackIds, trackId, stationNumber);
1423  globalTrackMCRefs[stsTrackIndex * nofStations + stationNumber].insert(
1424  trackId);
1425  TrackDesc& trackDesk = gTracks[eventId][trackId];
1426 
1427  if (trackDesk.sts[stationNumber].first.find(stsHitInd)
1428  != trackDesk.sts[stationNumber].first.end())
1429  trackDesk.sts[stationNumber].second.insert(stsTrackIndex);
1430  }
1431  }
1432 
1433  if (0 == mcCnt) continue;
1434 
1435  mcX /= mcCnt;
1436  mcY /= mcCnt;
1437 
1438  if (0 == stationNumber) {
1439  const FairTrackParam* param = stsTrack->GetParamFirst();
1440  Double_t xRes = param->GetX() - mcX;
1441  Double_t yRes = param->GetY() - mcY;
1442  Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0));
1443  Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1));
1444  stsTrackResidualFirstX->Fill(xRes);
1445  stsTrackResidualFirstY->Fill(yRes);
1446  stsTrackPullFirstX->Fill(xPull);
1447  stsTrackPullFirstY->Fill(yPull);
1448  } else if (TrackDesc::nofStsStations - 1 == stationNumber) {
1449  const FairTrackParam* param = stsTrack->GetParamLast();
1450  Double_t xRes = param->GetX() - mcX;
1451  Double_t yRes = param->GetY() - mcY;
1452  Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0));
1453  Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1));
1454  stsTrackResidualLastX->Fill(xRes);
1455  stsTrackResidualLastY->Fill(yRes);
1456  stsTrackPullLastX->Fill(xPull);
1457  stsTrackPullLastY->Fill(yPull);
1458  }
1459  }
1460 }
1461 
1462 void CbmBinnedTrackerQA::HandleMuch(Int_t muchTrackIndex,
1463  map<Int_t, set<Int_t>>& mcTrackIds,
1464  set<Int_t>* globalTrackMCRefs,
1465  Int_t* globalTracksHitInds) {
1466  int nofStations = fSettings->GetNofStations();
1467  const CbmMuchTrack* muchTrack =
1468  static_cast<const CbmMuchTrack*>(fMuchTracks->At(muchTrackIndex));
1469  Int_t nofMuchHits = muchTrack->GetNofHits();
1470 
1471  for (Int_t i = 0; i < nofMuchHits; ++i) {
1472  Int_t muchHitInd = muchTrack->GetHitIndex(i);
1473  const CbmMuchPixelHit* muchHit =
1474  static_cast<const CbmMuchPixelHit*>(fMuchHits->At(muchHitInd));
1475  Int_t muchStationNumber =
1477  Int_t layerNumber = CbmMuchGeoScheme::GetLayerIndex(muchHit->GetAddress());
1478  Int_t stationNumber = muchStationNumber * 3 + layerNumber;
1479  Double_t mcX = 0;
1480  Double_t mcY = 0;
1481  //Double_t mcCnt = 0; (VF) unused
1482  globalTracksHitInds[muchTrackIndex * nofStations
1483  + TrackDesc::firstMuchStationNo + stationNumber] =
1484  muchHitInd;
1485  Int_t clusterId = muchHit->GetRefId();
1486  const CbmMuchCluster* cluster =
1487  static_cast<const CbmMuchCluster*>(fMuchClusters->At(clusterId));
1488  Int_t nofDigis = cluster->GetNofDigis();
1489 
1490  for (Int_t j = 0; j < nofDigis; ++j) {
1491  Int_t digiId = cluster->GetDigi(j);
1492  //const CbmMuchDigi* digi = static_cast<const CbmMuchDigi*> (fMuchDigis->At(digiId));
1493  const CbmMatch* digiMatch =
1494  static_cast<const CbmMatch*>(fMuchDigiMatches->At(digiId));
1495  Int_t nofLinks = digiMatch->GetNofLinks();
1496 
1497  for (Int_t k = 0; k < nofLinks; ++k) {
1498  const CbmLink& link = digiMatch->GetLink(k);
1499  Int_t eventId = link.GetEntry();
1500  Int_t mcPointId = link.GetIndex();
1501  const CbmMuchPoint* muchPoint = static_cast<const CbmMuchPoint*>(
1502  fMuchPoints->Get(0, eventId, mcPointId));
1503  //mcX += (muchPoint->GetXIn() + muchPoint->GetXOut()) / 2;
1504  //mcY += (muchPoint->GetYIn() + muchPoint->GetYOut()) / 2;
1505  //++mcCnt;
1506  mcX = (muchPoint->GetXIn() + muchPoint->GetXOut()) / 2;
1507  mcY = (muchPoint->GetYIn() + muchPoint->GetYOut()) / 2;
1508 
1509  if (0 == stationNumber) {
1510  const FairTrackParam* param = muchTrack->GetParamFirst();
1511  Double_t xRes = param->GetX() - mcX;
1512  Double_t yRes = param->GetY() - mcY;
1513  Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0));
1514  Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1));
1515  muchTrackResidualFirstX->Fill(xRes);
1516  muchTrackResidualFirstY->Fill(yRes);
1517  muchTrackPullFirstX->Fill(xPull);
1518  muchTrackPullFirstY->Fill(yPull);
1519  } else if (TrackDesc::nofMuchStations - 1 == stationNumber) {
1520  const FairTrackParam* param = muchTrack->GetParamLast();
1521  Double_t xRes = param->GetX() - mcX;
1522  Double_t yRes = param->GetY() - mcY;
1523  Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0));
1524  Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1));
1525  muchTrackResidualLastX->Fill(xRes);
1526  muchTrackResidualLastY->Fill(yRes);
1527  muchTrackPullLastX->Fill(xPull);
1528  muchTrackPullLastY->Fill(yPull);
1529  }
1530 
1531  Int_t trackId = muchPoint->GetTrackID();
1532  IncrementForId(mcTrackIds, trackId, 100 + stationNumber);
1533  globalTrackMCRefs[muchTrackIndex * nofStations
1534  + TrackDesc::firstMuchStationNo + stationNumber]
1535  .insert(trackId);
1536  TrackDesc& trackDesk = gTracks[eventId][trackId];
1537 
1538  if (trackDesk.much[stationNumber].first.find(muchHitInd)
1539  != trackDesk.much[stationNumber].first.end())
1540  trackDesk.much[stationNumber].second.insert(muchTrackIndex);
1541  }
1542  }
1543 
1544  /*if (0 == mcCnt)
1545  continue;
1546 
1547  mcX /= mcCnt;
1548  mcY /= mcCnt;
1549 
1550  if (0 == stationNumber)
1551  {
1552  const FairTrackParam* param = muchTrack->GetParamFirst();
1553  Double_t xRes = param->GetX() - mcX;
1554  Double_t yRes = param->GetY() - mcY;
1555  Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0));
1556  Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1));
1557  muchTrackResidualFirstX->Fill(xRes);
1558  muchTrackResidualFirstY->Fill(yRes);
1559  muchTrackPullFirstX->Fill(xPull);
1560  muchTrackPullFirstY->Fill(yPull);
1561  }
1562  else if (TrackDesc::nofMuchStations - 1 == stationNumber)
1563  {
1564  const FairTrackParam* param = muchTrack->GetParamLast();
1565  Double_t xRes = param->GetX() - mcX;
1566  Double_t yRes = param->GetY() - mcY;
1567  Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0));
1568  Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1));
1569  muchTrackResidualLastX->Fill(xRes);
1570  muchTrackResidualLastY->Fill(yRes);
1571  muchTrackPullLastX->Fill(xPull);
1572  muchTrackPullLastY->Fill(yPull);
1573  }*/
1574  }
1575 }
1576 
1577 void CbmBinnedTrackerQA::HandleTrd(Int_t trdTrackIndex,
1578  map<Int_t, set<Int_t>>& mcTrackIds,
1579  set<Int_t>* globalTrackMCRefs,
1580  Int_t* globalTracksHitInds) {
1581  int nofStations = fSettings->GetNofStations();
1582  const CbmTrdTrack* trdTrack =
1583  static_cast<const CbmTrdTrack*>(fTrdTracks->At(trdTrackIndex));
1584  Int_t nofTrdHits = trdTrack->GetNofHits();
1585 
1586  for (Int_t i = 0; i < nofTrdHits; ++i) {
1587  Int_t trdHitInd = trdTrack->GetHitIndex(i);
1588  const CbmTrdHit* trdHit =
1589  static_cast<const CbmTrdHit*>(fTrdHits->At(trdHitInd));
1590  Int_t stationNumber = trdHit->GetPlaneId();
1591  Double_t mcX = 0;
1592  Double_t mcY = 0;
1593  Double_t mcCnt = 0;
1594  globalTracksHitInds[trdTrackIndex * nofStations
1595  + TrackDesc::firstTrdStationNo + stationNumber] =
1596  trdHitInd;
1597  Int_t clusterId = trdHit->GetRefId();
1598 #ifndef TRD_IDEAL
1599  const CbmTrdCluster* cluster =
1600  static_cast<const CbmTrdCluster*>(fTrdClusters->At(clusterId));
1601  Int_t nofDigis = cluster->GetNofDigis();
1602 
1603  for (Int_t j = 0; j < nofDigis; ++j) {
1604  Int_t digiId = cluster->GetDigi(j);
1605  const CbmMatch* match =
1606  static_cast<const CbmMatch*>(fTrdDigiMatches->At(digiId));
1607  Int_t nofLinks = match->GetNofLinks();
1608 
1609  for (Int_t k = 0; k < nofLinks; ++k) {
1610  const CbmLink& link = match->GetLink(k);
1611  Int_t eventId = link.GetEntry();
1612  Int_t mcPointId = link.GetIndex();
1613  const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(
1614  fTrdPoints->Get(0, eventId, mcPointId));
1615  mcX += (trdPoint->GetXIn() + trdPoint->GetXOut()) / 2;
1616  mcY += (trdPoint->GetYIn() + trdPoint->GetYOut()) / 2;
1617  ++mcCnt;
1618  Int_t trackId = trdPoint->GetTrackID();
1619  IncrementForId(mcTrackIds, trackId, 200 + stationNumber);
1620  globalTrackMCRefs[trdTrackIndex * nofStations
1621  + TrackDesc::firstTrdStationNo + stationNumber]
1622  .insert(trackId);
1623  TrackDesc& trackDesk = gTracks[eventId][trackId];
1624 
1625  if (trackDesk.trd[stationNumber].first.find(trdHitInd)
1626  != trackDesk.trd[stationNumber].first.end())
1627  trackDesk.trd[stationNumber].second.insert(trdTrackIndex);
1628  }
1629  }
1630 #else //TRD_IDEAL
1631  const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(
1632  fTrdPoints->Get(0, gEventNumber, clusterId));
1633  Int_t trackId = trdPoint->GetTrackID();
1634  TrackDesc& trackDesk = gTracks[gEventNumber][trackId];
1635 
1636  if (trackDesk.trd[stationNumber].first.find(trdHitInd)
1637  != trackDesk.trd[stationNumber].first.end())
1638  trackDesk.trd[stationNumber].second.insert(trdTrackIndex);
1639 #endif //TRD_IDEAL
1640  if (0 == mcCnt) continue;
1641 
1642  mcX /= mcCnt;
1643  mcY /= mcCnt;
1644 
1645  if (0 == stationNumber) {
1646  const FairTrackParam* param = trdTrack->GetParamFirst();
1647  Double_t xRes = param->GetX() - mcX;
1648  Double_t yRes = param->GetY() - mcY;
1649  Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0));
1650  Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1));
1651  trdTrackResidualFirstX->Fill(xRes);
1652  trdTrackResidualFirstY->Fill(yRes);
1653  trdTrackPullFirstX->Fill(xPull);
1654  trdTrackPullFirstY->Fill(yPull);
1655  } else if (TrackDesc::nofTrdStations - 1 == stationNumber) {
1656  const FairTrackParam* param = trdTrack->GetParamLast();
1657  Double_t xRes = param->GetX() - mcX;
1658  Double_t yRes = param->GetY() - mcY;
1659  Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0));
1660  Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1));
1661  trdTrackResidualLastX->Fill(xRes);
1662  trdTrackResidualLastY->Fill(yRes);
1663  trdTrackPullLastX->Fill(xPull);
1664  trdTrackPullLastY->Fill(yPull);
1665  }
1666  }
1667 }
1668 
1669 void CbmBinnedTrackerQA::HandleTof(Int_t globalTrackIndex,
1670  Int_t tofHitIndex,
1671  map<Int_t, set<Int_t>>& mcTrackIds,
1672  set<Int_t>* globalTrackMCRefs,
1673  Int_t* globalTracksHitInds) {
1674  const CbmGlobalTrack* globalTrack =
1675  static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex));
1676  Double_t mcX = 0;
1677  Double_t mcY = 0;
1678  Double_t mcCnt = 0;
1679  int nofStations = fSettings->GetNofStations();
1680  globalTracksHitInds[globalTrackIndex * nofStations
1681  + TrackDesc::tofStationNo] = tofHitIndex;
1682  const CbmMatch* tofHitMatch =
1683  static_cast<const CbmMatch*>(fTofHitDigiMatches->At(tofHitIndex));
1684  Int_t nofTofDigis = tofHitMatch->GetNofLinks();
1685 
1686  for (Int_t i = 0; i < nofTofDigis; ++i) {
1687  const CbmLink& digiLink = tofHitMatch->GetLink(i);
1688  Int_t digiInd = digiLink.GetIndex();
1689  const CbmMatch* pointMatch =
1690  static_cast<const CbmMatch*>(fTofDigiPointMatches->At(digiInd));
1691  Int_t nofPoints = pointMatch->GetNofLinks();
1692 
1693  for (Int_t j = 0; j < nofPoints; ++j) {
1694  const CbmLink& pointLink = pointMatch->GetLink(j);
1695  Int_t eventId = pointLink.GetEntry();
1696  Int_t pointId = pointLink.GetIndex();
1697  const CbmTofPoint* tofPoint =
1698  static_cast<const CbmTofPoint*>(fTofPoints->Get(0, eventId, pointId));
1699  mcX += tofPoint->GetX();
1700  mcY += tofPoint->GetY();
1701  ++mcCnt;
1702  Int_t trackId = tofPoint->GetTrackID();
1703  IncrementForId(mcTrackIds, trackId, 300);
1704  globalTrackMCRefs[globalTrackIndex * nofStations
1706  .insert(trackId);
1707  TrackDesc& trackDesk = gTracks[eventId][trackId];
1708 
1709  if (trackDesk.tof.first.find(tofHitIndex) != trackDesk.tof.first.end())
1710  trackDesk.tof.second.insert(tofHitIndex);
1711  }
1712  }
1713 
1714  if (0 == mcCnt) return;
1715 
1716  mcX /= mcCnt;
1717  mcY /= mcCnt;
1718  const FairTrackParam* param = globalTrack->GetParamLast();
1719  Double_t xRes = param->GetX() - mcX;
1720  Double_t yRes = param->GetY() - mcY;
1721  Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0));
1722  Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1));
1723  globalTrackResidualLastX->Fill(xRes);
1724  globalTrackResidualLastY->Fill(yRes);
1725  globalTrackPullLastX->Fill(xPull);
1726  globalTrackPullLastY->Fill(yPull);
1727 }
1728 
1729 static void SaveHisto(TH1* histo) {
1730  TFile* curFile = TFile::CurrentFile();
1731  TString histoName = histo->GetName();
1732  histoName += ".root";
1733  TFile fh(histoName.Data(), "RECREATE");
1734  histo->Write();
1735  fh.Close();
1736  delete histo;
1737  TFile::CurrentFile() = curFile;
1738 }
1739 
1740 template<typename T>
1741 void NumberToFile(const char* name, T number) {
1742  char buf[256];
1743  sprintf(buf, "%s.txt", name);
1744  ofstream fileStream(buf, ios_base::out | ios_base::trunc);
1745  fileStream << number;
1746 }
1747 
1748 static void effOfMCPoints(const char* name,
1749  const vector<vector<bool>>& points) {
1750  int nofAllMCPoints = 0;
1751  int nofRecoMCPoints = 0;
1752 
1753  for (const auto& i : points) {
1754  for (auto j : i) {
1755  ++nofAllMCPoints;
1756 
1757  if (j) ++nofRecoMCPoints;
1758  }
1759  }
1760 
1761  double eff = 100 * nofRecoMCPoints;
1762 
1763  if (0 == nofAllMCPoints)
1764  eff = 100;
1765  else
1766  eff /= nofAllMCPoints;
1767 
1768  cout << "Reconstructed of the " << name << " points: " << eff << "% "
1769  << nofRecoMCPoints << "/" << nofAllMCPoints << endl;
1770 }
1771 
1772 static void effOfMCPoints(const char* name,
1773  const vector<vector<char>>& points) {
1774  int nofAllMCPoints = 0;
1775  int nofRecoMCPoints = 0;
1776 
1777  for (const auto& i : points) {
1778  for (auto j : i) {
1779  if (j > 0) ++nofAllMCPoints;
1780 
1781  if (j > 1) ++nofRecoMCPoints;
1782  }
1783  }
1784 
1785  double eff = 100 * nofRecoMCPoints;
1786 
1787  if (0 == nofAllMCPoints)
1788  eff = 100;
1789  else
1790  eff /= nofAllMCPoints;
1791 
1792  cout << "Reconstructed of the " << name << " points: " << eff << "% "
1793  << nofRecoMCPoints << "/" << nofAllMCPoints << endl;
1794 }
1795 
1797  int nofAllTracks = 0;
1798  int nofRefTracks = 0;
1799  int nofMatchedRefTracks = 0;
1800  int nofRefPrimTracks = 0;
1801  int nofMatchedRefPrimTracks = 0;
1802  int nofRefNonPrimTracks = 0;
1803  int nofMatchedRefNonPrimTracks = 0;
1804  //int nofSts[2] = { 0, 0 };
1805  //int nofTrd[4] = { 0, 0, 0, 0 };
1806  //int nofMuch[3] = { 0, 0, 0 };
1807  //int nofTof = 0;
1808 
1809  for (vector<vector<TrackDesc>>::iterator i = gTracks.begin();
1810  i != gTracks.end();
1811  ++i) {
1812  vector<TrackDesc>& evTracks = *i;
1813 
1814  for (vector<TrackDesc>::iterator j = evTracks.begin(); j != evTracks.end();
1815  ++j) {
1816  ++nofAllTracks;
1817  TrackDesc& trackDesc = *j;
1818 
1819  if (fIsOnlyPrimary && !trackDesc.isPrimary) continue;
1820 
1821  bool isRef = true;
1822 
1823  for (int k = 0; k < TrackDesc::nofStsStations; ++k) {
1824  if (trackDesc.sts[k].first.empty()) {
1825  isRef = false;
1826  break;
1827  }
1828  }
1829 
1830  if (!isRef) continue;
1831 
1832 #ifdef CBM_BINNED_QA_FILL_HISTOS
1833  for (set<const CbmStsPoint*>::const_iterator k =
1834  trackDesc.stsPoints[0].begin();
1835  k != trackDesc.stsPoints[0].end();
1836  ++k) {
1837  const CbmStsPoint* p0 = *k;
1838  Double_t x0 = (p0->GetXIn() + p0->GetXOut()) / 2;
1839  Double_t y0 = (p0->GetYIn() + p0->GetYOut()) / 2;
1840  Double_t z0 = (p0->GetZIn() + p0->GetZOut()) / 2;
1841  Double_t tx =
1842  (x0 - trackDesc.ptr->GetStartX()) / (z0 - trackDesc.ptr->GetStartZ());
1843  Double_t ty =
1844  (y0 - trackDesc.ptr->GetStartY()) / (z0 - trackDesc.ptr->GetStartZ());
1845 
1846  for (set<const CbmStsPoint*>::const_iterator l =
1847  trackDesc.stsPoints[1].begin();
1848  l != trackDesc.stsPoints[1].end();
1849  ++l) {
1850  const CbmStsPoint* p1 = *l;
1851  Double_t x1 = (p1->GetXIn() + p1->GetXOut()) / 2;
1852  Double_t y1 = (p1->GetYIn() + p1->GetYOut()) / 2;
1853  Double_t z1 = (p1->GetZIn() + p1->GetZOut()) / 2;
1854 
1855  extrStsXHisto->Fill(x1 - tx * z1);
1856  extrStsYHisto->Fill(y1 - ty * z1);
1857  }
1858  }
1859 #endif //CBM_BINNED_QA_FILL_HISTOS
1860 
1861  for (int k = 0; k < TrackDesc::nofMuchStations; ++k) {
1862  if (trackDesc.much[k].first.empty()) {
1863  isRef = false;
1864  break;
1865  }
1866  }
1867 
1868  if (!isRef) continue;
1869 
1870  for (int k = 0; k < TrackDesc::nofTrdStations; ++k) {
1871  if (trackDesc.trd[k].first.empty()) {
1872  isRef = false;
1873  break;
1874  }
1875  }
1876 
1877  if (!isRef) continue;
1878 
1879 #ifdef CBM_BINNED_QA_FILL_HISTOS
1880  for (set<const CbmStsPoint*>::const_iterator k =
1881  trackDesc.stsPoints[0].begin();
1882  k != trackDesc.stsPoints[0].end();
1883  ++k) {
1884  const CbmStsPoint* p1 = *k;
1885  Double_t x1 = (p1->GetXIn() + p1->GetXOut()) / 2;
1886  Double_t y1 = (p1->GetYIn() + p1->GetYOut()) / 2;
1887  Double_t z1 = (p1->GetZIn() + p1->GetZOut()) / 2;
1888 
1889  for (set<const CbmStsPoint*>::const_iterator l =
1890  trackDesc.stsPoints[1].begin();
1891  l != trackDesc.stsPoints[1].end();
1892  ++l) {
1893  const CbmStsPoint* p2 = *l;
1894  Double_t x2 = (p2->GetXIn() + p2->GetXOut()) / 2;
1895  Double_t y2 = (p2->GetYIn() + p2->GetYOut()) / 2;
1896  Double_t z2 = (p2->GetZIn() + p2->GetZOut()) / 2;
1897  Double_t tx = (x2 - x1) / (z2 - z1);
1898  Double_t ty = (y2 - y1) / (z2 - z1);
1899 
1900  for (set<const CbmTrdPoint*>::const_iterator m =
1901  trackDesc.trdPoints[0].begin();
1902  m != trackDesc.trdPoints[0].end();
1903  ++m) {
1904  const CbmTrdPoint* p = *m;
1905  Double_t x = (p->GetXIn() + p->GetXOut()) / 2;
1906  Double_t y = (p->GetYIn() + p->GetYOut()) / 2;
1907  Double_t z = (p->GetZIn() + p->GetZOut()) / 2;
1908  Double_t deltaZ = z - z2;
1909  extrTrdXHistos[0]->Fill(x - x2 - tx * deltaZ);
1910  extrTrdYHistos[0]->Fill(y - y2 - ty * deltaZ);
1911  }
1912  }
1913  }
1914 
1915  for (set<const CbmStsPoint*>::const_iterator k =
1916  trackDesc.stsPoints[1].begin();
1917  k != trackDesc.stsPoints[1].end();
1918  ++k) {
1919  const CbmStsPoint* p1 = *k;
1920  Double_t x1 = (p1->GetXIn() + p1->GetXOut()) / 2;
1921  Double_t y1 = (p1->GetYIn() + p1->GetYOut()) / 2;
1922  Double_t z1 = (p1->GetZIn() + p1->GetZOut()) / 2;
1923 
1924  for (set<const CbmTrdPoint*>::const_iterator l =
1925  trackDesc.trdPoints[0].begin();
1926  l != trackDesc.trdPoints[0].end();
1927  ++l) {
1928  const CbmTrdPoint* p2 = *l;
1929  Double_t x2 = (p2->GetXIn() + p2->GetXOut()) / 2;
1930  Double_t y2 = (p2->GetYIn() + p2->GetYOut()) / 2;
1931  Double_t z2 = (p2->GetZIn() + p2->GetZOut()) / 2;
1932  Double_t tx = (x2 - x1) / (z2 - z1);
1933  Double_t ty = (y2 - y1) / (z2 - z1);
1934 
1935  for (set<const CbmTrdPoint*>::const_iterator m =
1936  trackDesc.trdPoints[1].begin();
1937  m != trackDesc.trdPoints[1].end();
1938  ++m) {
1939  const CbmTrdPoint* p = *m;
1940  Double_t x = (p->GetXIn() + p->GetXOut()) / 2;
1941  Double_t y = (p->GetYIn() + p->GetYOut()) / 2;
1942  Double_t z = (p->GetZIn() + p->GetZOut()) / 2;
1943  Double_t deltaZ = z - z2;
1944  extrTrdXHistos[1]->Fill(x - x2 - tx * deltaZ);
1945  extrTrdYHistos[1]->Fill(y - y2 - ty * deltaZ);
1946  }
1947  }
1948  }
1949 
1950  for (set<const CbmTrdPoint*>::const_iterator k =
1951  trackDesc.trdPoints[0].begin();
1952  k != trackDesc.trdPoints[0].end();
1953  ++k) {
1954  const CbmTrdPoint* p1 = *k;
1955  Double_t x1 = (p1->GetXIn() + p1->GetXOut()) / 2;
1956  Double_t y1 = (p1->GetYIn() + p1->GetYOut()) / 2;
1957  Double_t z1 = (p1->GetZIn() + p1->GetZOut()) / 2;
1958 
1959  for (set<const CbmTrdPoint*>::const_iterator l =
1960  trackDesc.trdPoints[1].begin();
1961  l != trackDesc.trdPoints[1].end();
1962  ++l) {
1963  const CbmTrdPoint* p2 = *l;
1964  Double_t x2 = (p2->GetXIn() + p2->GetXOut()) / 2;
1965  Double_t y2 = (p2->GetYIn() + p2->GetYOut()) / 2;
1966  Double_t z2 = (p2->GetZIn() + p2->GetZOut()) / 2;
1967  Double_t tx = (x2 - x1) / (z2 - z1);
1968  Double_t ty = (y2 - y1) / (z2 - z1);
1969 
1970  for (set<const CbmTrdPoint*>::const_iterator m =
1971  trackDesc.trdPoints[2].begin();
1972  m != trackDesc.trdPoints[2].end();
1973  ++m) {
1974  const CbmTrdPoint* p = *m;
1975  Double_t x = (p->GetXIn() + p->GetXOut()) / 2;
1976  Double_t y = (p->GetYIn() + p->GetYOut()) / 2;
1977  Double_t z = (p->GetZIn() + p->GetZOut()) / 2;
1978  Double_t deltaZ = z - z2;
1979  extrTrdXHistos[2]->Fill(x - x2 - tx * deltaZ);
1980  extrTrdYHistos[2]->Fill(y - y2 - ty * deltaZ);
1981  }
1982  }
1983  }
1984 
1985  for (set<const CbmTrdPoint*>::const_iterator k =
1986  trackDesc.trdPoints[1].begin();
1987  k != trackDesc.trdPoints[1].end();
1988  ++k) {
1989  const CbmTrdPoint* p1 = *k;
1990  Double_t x1 = (p1->GetXIn() + p1->GetXOut()) / 2;
1991  Double_t y1 = (p1->GetYIn() + p1->GetYOut()) / 2;
1992  Double_t z1 = (p1->GetZIn() + p1->GetZOut()) / 2;
1993 
1994  for (set<const CbmTrdPoint*>::const_iterator l =
1995  trackDesc.trdPoints[2].begin();
1996  l != trackDesc.trdPoints[2].end();
1997  ++l) {
1998  const CbmTrdPoint* p2 = *l;
1999  Double_t x2 = (p2->GetXIn() + p2->GetXOut()) / 2;
2000  Double_t y2 = (p2->GetYIn() + p2->GetYOut()) / 2;
2001  Double_t z2 = (p2->GetZIn() + p2->GetZOut()) / 2;
2002  Double_t tx = (x2 - x1) / (z2 - z1);
2003  Double_t ty = (y2 - y1) / (z2 - z1);
2004 
2005  for (set<const CbmTrdPoint*>::const_iterator m =
2006  trackDesc.trdPoints[3].begin();
2007  m != trackDesc.trdPoints[3].end();
2008  ++m) {
2009  const CbmTrdPoint* p = *m;
2010  Double_t x = (p->GetXIn() + p->GetXOut()) / 2;
2011  Double_t y = (p->GetYIn() + p->GetYOut()) / 2;
2012  Double_t z = (p->GetZIn() + p->GetZOut()) / 2;
2013  Double_t deltaZ = z - z2;
2014  extrTrdXHistos[3]->Fill(x - x2 - tx * deltaZ);
2015  extrTrdYHistos[3]->Fill(y - y2 - ty * deltaZ);
2016  }
2017  }
2018  }
2019 #endif //CBM_BINNED_QA_FILL_HISTOS
2020 
2021  /*for (int k = 0; k < NOF_MUCH_STATIONS * NOF_MUCH_LAYERS; ++k)
2022  {
2023  if (trackDesc.much[k].first.empty())
2024  {
2025  isRef = false;
2026  break;
2027  }
2028  }
2029 
2030  if (!isRef)
2031  continue;*/
2032 
2033  if (TrackDesc::hasTof && trackDesc.tof.first.empty()) continue;
2034 
2035  trackDesc.isReference = true;
2036  ++nofRefTracks;
2037 
2038  if (trackDesc.isPrimary)
2039  ++nofRefPrimTracks;
2040  else
2041  ++nofRefNonPrimTracks;
2042 
2043  map<Int_t, Int_t> matchedReco;
2044 
2045  for (int k = 0; k < TrackDesc::nofStsStations; ++k) {
2046  for (set<Int_t>::const_iterator l = trackDesc.sts[k].second.begin();
2047  l != trackDesc.sts[k].second.end();
2048  ++l) {
2049  map<Int_t, Int_t>::iterator mrIter = matchedReco.find(*l);
2050 
2051  if (mrIter != matchedReco.end())
2052  ++mrIter->second;
2053  else
2054  matchedReco[*l] = 1;
2055  }
2056  }
2057 
2058  for (int k = 0; k < TrackDesc::nofMuchStations; ++k) {
2059  for (set<Int_t>::const_iterator l = trackDesc.much[k].second.begin();
2060  l != trackDesc.much[k].second.end();
2061  ++l) {
2062  map<Int_t, Int_t>::iterator mrIter = matchedReco.find(*l);
2063 
2064  if (mrIter != matchedReco.end())
2065  ++mrIter->second;
2066  else
2067  matchedReco[*l] = 1;
2068  }
2069  }
2070 
2071  for (int k = 0; k < TrackDesc::nofTrdStations; ++k) {
2072  for (set<Int_t>::const_iterator l = trackDesc.trd[k].second.begin();
2073  l != trackDesc.trd[k].second.end();
2074  ++l) {
2075  map<Int_t, Int_t>::iterator mrIter = matchedReco.find(*l);
2076 
2077  if (mrIter != matchedReco.end())
2078  ++mrIter->second;
2079  else
2080  matchedReco[*l] = 1;
2081  }
2082  }
2083 
2084 #ifdef CBM_BINNED_QA_FILL_HISTOS
2085  for (int k = 0; k < NOF_STS_STATIONS; ++k) {
2086  if (trackDesc.nearestHitDistSts[k] >= 0) {
2087  stsXPullHistos[k]->Fill(trackDesc.pullXsts[k]);
2088  stsYPullHistos[k]->Fill(trackDesc.pullYsts[k]);
2089  }
2090  }
2091 
2092  for (int k = 0; k < NOF_TRD_LAYERS; ++k) {
2093  if (trackDesc.nearestHitDistTrd[k] >= 0) {
2094  trdNearestHitDistHistos[k]->Fill(trackDesc.nearestHitDistTrd[k]);
2095  trdXPullHistos[k]->Fill(trackDesc.pullXtrd[k]);
2096  trdYPullHistos[k]->Fill(trackDesc.pullYtrd[k]);
2097  }
2098  }
2099 #endif //CBM_BINNED_QA_FILL_HISTOS
2100 
2101  /*for (int k = 0; k < NOF_MUCH_STATIONS * NOF_MUCH_LAYERS; ++k)
2102  {
2103  for (set<Int_t>::const_iterator l = trackDesc.much[k].second.begin(); l != trackDesc.much[k].second.end(); ++l)
2104  {
2105  map<Int_t, Int_t>::iterator mrIter = matchedReco.find(*l);
2106 
2107  if (mrIter != matchedReco.end())
2108  ++mrIter->second;
2109  else
2110  matchedReco[*l] = 1;
2111  }
2112 
2113  if (!trackDesc.much[k].second.empty())
2114  ++nofMuch[k];
2115  }*/
2116 
2117  /*for (set<Int_t>::const_iterator k = trackDesc.tof.second.begin(); k != trackDesc.tof.second.end(); ++k)
2118  {
2119  map<Int_t, Int_t>::iterator mrIter = matchedReco.find(*k);
2120 
2121  if (mrIter != matchedReco.end())
2122  ++mrIter->second;
2123  else
2124  matchedReco[*k] = 1;
2125  }
2126 
2127  if (!trackDesc.tof.second.empty())
2128  ++nofTof;*/
2129 
2130  TVector3 mom;
2131  trackDesc.ptr->GetMomentum(mom);
2132  Double_t momV = trackDesc.ptr->GetP();
2133  Double_t momX = mom.X();
2134  Double_t momY = mom.Y();
2135  Double_t momZ = mom.Z();
2136  Double_t polarAng = 180 * TMath::ACos(momZ / momV) / TMath::Pi();
2137  Double_t xAng = 180 * TMath::ASin(momX / momV) / TMath::Pi();
2138  Double_t yAng = 180 * TMath::ASin(momY / momV) / TMath::Pi();
2139 
2140  if (matchedReco.empty()) {
2141  if (trackDesc.isPrimary) {
2142  effByMomPrimary->Fill(momV, 0.);
2143  effByPolarAnglePrimary->Fill(polarAng, 0.);
2144  effByXAnglePrimary->Fill(xAng, 0.);
2145  effByYAnglePrimary->Fill(yAng, 0.);
2146  } else {
2147  effByMomNonPrimary->Fill(momV, 0.);
2148  effByPolarAngleNonPrimary->Fill(polarAng, 0.);
2149  effByXAngleNonPrimary->Fill(xAng, 0.);
2150  effByYAngleNonPrimary->Fill(yAng, 0.);
2151  }
2152 
2153  effByMom->Fill(momV, 0.);
2154  effByPolarAngle->Fill(polarAng, 0.);
2155  effByXAngle->Fill(xAng, 0.);
2156  effByYAngle->Fill(yAng, 0.);
2157  continue;
2158  }
2159 
2160  map<Int_t, Int_t>::const_iterator maxIter = max_element(
2161  matchedReco.begin(),
2162  matchedReco.end(),
2163  [](const pair<Int_t, Int_t>& p1, const pair<Int_t, Int_t>& p2) {
2164  return p1.second < p2.second;
2165  });
2166 
2167  if (maxIter->second < int(0.7 * fSettings->GetNofStations())) {
2168  if (trackDesc.isPrimary) {
2169  effByMomPrimary->Fill(momV, 0.);
2170  effByPolarAnglePrimary->Fill(polarAng, 0.);
2171  effByXAnglePrimary->Fill(xAng, 0.);
2172  effByYAnglePrimary->Fill(yAng, 0.);
2173  } else {
2174  effByMomNonPrimary->Fill(momV, 0.);
2175  effByPolarAngleNonPrimary->Fill(polarAng, 0.);
2176  effByXAngleNonPrimary->Fill(xAng, 0.);
2177  effByYAngleNonPrimary->Fill(yAng, 0.);
2178  }
2179 
2180  effByMom->Fill(momV, 0.);
2181  effByPolarAngle->Fill(polarAng, 0.);
2182  effByXAngle->Fill(xAng, 0.);
2183  effByYAngle->Fill(yAng, 0.);
2184  continue;
2185  }
2186 
2187  effByMom->Fill(momV, 100.);
2188  effByPolarAngle->Fill(polarAng, 100.);
2189  effByXAngle->Fill(xAng, 100.);
2190  effByYAngle->Fill(yAng, 100.);
2191  trackDesc.isReconstructed = true;
2192  ++nofMatchedRefTracks;
2193 
2194  if (trackDesc.isPrimary) {
2195  effByMomPrimary->Fill(momV, 100.);
2196  effByPolarAnglePrimary->Fill(polarAng, 100.);
2197  effByXAnglePrimary->Fill(xAng, 100.);
2198  effByYAnglePrimary->Fill(yAng, 100.);
2199  ++nofMatchedRefPrimTracks;
2200  } else {
2201  effByMomNonPrimary->Fill(momV, 100.);
2202  effByPolarAngleNonPrimary->Fill(polarAng, 100.);
2203  effByXAngleNonPrimary->Fill(xAng, 100.);
2204  effByYAngleNonPrimary->Fill(yAng, 100.);
2205  ++nofMatchedRefNonPrimTracks;
2206  }
2207  }
2208  }
2209 
2210  cout << "Total tracks: " << nofAllTracks << endl;
2211 
2212  double eff = 100 * nofMatchedRefTracks;
2213 
2214  if (0 == nofRefTracks)
2215  eff = 100;
2216  else
2217  eff /= nofRefTracks;
2218 
2219  cout << "The track reconstruction efficiency: " << eff
2220  << "%: " << nofMatchedRefTracks << "/" << nofRefTracks << endl;
2221  NumberToFile("nofRefTracks", nofRefTracks);
2222  NumberToFile("nofMatchedRefTracks", nofMatchedRefTracks);
2223 
2224  eff = 100 * nofMatchedRefPrimTracks;
2225 
2226  if (0 == nofRefPrimTracks)
2227  eff = 100;
2228  else
2229  eff /= nofRefPrimTracks;
2230 
2231  cout << "The track reconstruction efficiency for primary tracks: " << eff
2232  << "%: " << nofMatchedRefPrimTracks << "/" << nofRefPrimTracks << endl;
2233  NumberToFile("nofMatchedRefPrimTracks", nofMatchedRefPrimTracks);
2234 
2235  eff = 100 * nofMatchedRefNonPrimTracks;
2236 
2237  if (0 == nofRefNonPrimTracks)
2238  eff = 100;
2239  else
2240  eff /= nofRefNonPrimTracks;
2241 
2242  cout << "The track reconstruction efficiency for non primary tracks: " << eff
2243  << "%: " << nofMatchedRefNonPrimTracks << "/" << nofRefNonPrimTracks
2244  << endl;
2245  NumberToFile("nofMatchedRefNonPrimTracks", nofMatchedRefNonPrimTracks);
2246 
2247  eff = 100 * (gNofRecoTracks - gNofNonGhosts);
2248 
2249  if (0 == gNofRecoTracks)
2250  eff = 100;
2251  else
2252  eff /= gNofRecoTracks;
2253 
2254  cout << "The number of ghosts: " << eff
2255  << "%: " << gNofRecoTracks - gNofNonGhosts << "/" << gNofRecoTracks
2256  << endl;
2257  NumberToFile("nofRecoTracks", gNofRecoTracks);
2258  NumberToFile("nofGhosts", gNofRecoTracks - gNofNonGhosts);
2259 
2260  eff = 100 * gNofClones;
2261 
2262  if (0 == gNofRecoTracks)
2263  eff = 100;
2264  else
2265  eff /= gNofRecoTracks;
2266 
2267  cout << "The number of clones: " << eff << "%: " << gNofClones << "/"
2268  << gNofRecoTracks << endl;
2269  NumberToFile("nofClones", gNofClones);
2270  //cout << "Nof STS[0]: " << nofSts[0] << endl;
2271  //cout << "Nof STS[1]: " << nofSts[1] << endl;
2272  //cout << "Nof TRD[0]: " << nofTrd[0] << endl;
2273  //cout << "Nof TRD[1]: " << nofTrd[1] << endl;
2274  //cout << "Nof TRD[2]: " << nofTrd[2] << endl;
2275  //cout << "Nof TRD[3]: " << nofTrd[3] << endl;
2276  //cout << "Nof MUCH[0]: " << nofMuch[0] << endl;
2277  //cout << "Nof MUCH[1]: " << nofMuch[1] << endl;
2278  //cout << "Nof MUCH[2]: " << nofMuch[2] << endl;
2279  //cout << "Nof TOF: " << nofTof << endl;
2280 
2281  //cout << "Nof stranger hits on TRD stations: ";
2282 
2283  //for (int i = 0; i < 4; ++i)
2284  //cout << "[" << trdNofStrangerHits[i] << "]";
2285 
2286  //cout << endl;
2287 
2288  int nofLambdas = lambdaList.size();
2289  int nofLambdasInAcc = 0;
2290  int nofRecoLambdas = 0;
2291  cout << "The number of Lambda baryons: " << nofLambdas << endl;
2292 
2293  for (list<TrackDesc*>::const_iterator i = lambdaList.begin();
2294  i != lambdaList.end();
2295  ++i) {
2296  const TrackDesc* lambdaTrack = *i;
2297  bool isInAcc = !lambdaTrack->children.empty();
2298  bool isReco = isInAcc;
2299 
2300  for (list<TrackDesc*>::const_iterator j = lambdaTrack->children.begin();
2301  j != lambdaTrack->children.end();
2302  ++j) {
2303  const TrackDesc* childTrack = *j;
2304  Double_t p = childTrack->ptr->GetP();
2305  lambdaChildrenMoms->Fill(p);
2306 
2307  if (!childTrack->isReference)
2308  isInAcc = false;
2309  else {
2310  if (childTrack->isReconstructed)
2311  lambdaChildrenEffByMom->Fill(p, 100.);
2312  else
2313  lambdaChildrenEffByMom->Fill(p, 0.);
2314  }
2315 
2316  if (!childTrack->isReconstructed) isReco = false;
2317  }
2318 
2319  if (isInAcc) {
2320  ++nofLambdasInAcc;
2321 
2322  if (isReco) ++nofRecoLambdas;
2323  }
2324  }
2325 
2326  eff = 100 * nofLambdasInAcc;
2327 
2328  if (0 == nofLambdas)
2329  eff = 100;
2330  else
2331  eff /= nofLambdas;
2332 
2333  cout << "Lambda baryons in the acceptance: " << eff << "% " << nofLambdasInAcc
2334  << "/" << nofLambdas << endl;
2335 
2336  eff = 100 * nofRecoLambdas;
2337 
2338  if (0 == nofLambdas)
2339  eff = 100;
2340  else
2341  eff /= nofLambdas;
2342 
2343  cout << "Reconstructed of all the Lambda baryons: " << eff << "% "
2344  << nofRecoLambdas << "/" << nofLambdas << endl;
2345 
2346  eff = 100 * nofRecoLambdas;
2347 
2348  if (0 == nofLambdasInAcc)
2349  eff = 100;
2350  else
2351  eff /= nofLambdasInAcc;
2352 
2353  cout << "Reconstructed of the Lambda baryons in the acceptance: " << eff
2354  << "% " << nofRecoLambdas << "/" << nofLambdasInAcc << endl;
2355 
2356  effOfMCPoints("STS", gStsPoints);
2357  effOfMCPoints("MuCh", gMuchPoints);
2358  effOfMCPoints("TRD", gTrdPoints);
2359  effOfMCPoints("ToF", gTofPoints);
2360 
2364 
2368 
2372 
2376 
2380 
2387 
2396 
2405 
2414 
2423 
2424 #ifdef CBM_BINNED_QA_FILL_HISTOS
2425  SaveHisto(stsXResHisto);
2426  SaveHisto(stsYResHisto);
2427  SaveHisto(stsTResHisto);
2428  SaveHisto(trdXResHisto);
2429  SaveHisto(trdYResHisto);
2430  SaveHisto(trdTResHisto);
2431  SaveHisto(muchXResHisto);
2432  SaveHisto(muchYResHisto);
2433  SaveHisto(muchTResHisto);
2434  SaveHisto(tofXResHisto);
2435  SaveHisto(tofYResHisto);
2436  SaveHisto(tofTResHisto);
2437 
2438  SaveHisto(extrStsXHisto);
2439  SaveHisto(extrStsYHisto);
2440 
2441  SaveHisto(vtxXHisto);
2442  SaveHisto(vtxYHisto);
2443  SaveHisto(vtxZHisto);
2444 
2445  for (int i = 0; i < 2; ++i) {
2446  SaveHisto(stsXPullHistos[i]);
2447  SaveHisto(stsYPullHistos[i]);
2448  }
2449 
2450  for (int i = 0; i < 4; ++i) {
2451  SaveHisto(extrTrdXHistos[i]);
2452  SaveHisto(extrTrdYHistos[i]);
2453 
2454  SaveHisto(trdNearestHitDistHistos[i]);
2455 
2456  SaveHisto(trdXPullHistos[i]);
2457  SaveHisto(trdYPullHistos[i]);
2458  }
2459 #endif //CBM_BINNED_QA_FILL_HISTOS
2460 }
2461 
2463  fSettings = static_cast<CbmBinnedSettings*>(
2464  FairRun::Instance()->GetRuntimeDb()->getContainer("CbmBinnedSettings"));
2465 }
2466 
TrackDesc::pullXsts
Double_t * pullXsts
Definition: CbmBinnedTrackerQA.cxx:68
CbmMuchPoint::GetXOut
Double_t GetXOut() const
Definition: CbmMuchPoint.h:73
muchTrackResidualLastX
static TH1F * muchTrackResidualLastX
Definition: CbmBinnedTrackerQA.cxx:213
TrackDesc::hasTof
static bool hasTof
Definition: CbmBinnedTrackerQA.cxx:45
CbmMCTrack::GetMotherId
Int_t GetMotherId() const
Definition: CbmMCTrack.h:71
globalTrackPullLastX
static TH1F * globalTrackPullLastX
Definition: CbmBinnedTrackerQA.cxx:233
CbmMCTrack::GetMomentum
void GetMomentum(TVector3 &momentum) const
Definition: CbmMCTrack.h:172
CbmBinnedSettings::GetNofStsStations
Int_t GetNofStsStations() const
Definition: Settings.h:176
CbmMatch
Definition: CbmMatch.h:22
CbmMCTrack::GetStartX
Double_t GetStartX() const
Definition: CbmMCTrack.h:75
CbmMCDataManager.h
CbmTrdPoint::GetYOut
Double_t GetYOut() const
Definition: CbmTrdPoint.h:67
lambdaChildrenEffByMom
static TProfile * lambdaChildrenEffByMom
Definition: CbmBinnedTrackerQA.cxx:190
muchHitResidualY
static TH1F * muchHitResidualY
Definition: CbmBinnedTrackerQA.cxx:194
CbmTrack::GetParamLast
const FairTrackParam * GetParamLast() const
Definition: CbmTrack.h:62
CbmMuchDigi.h
gTracks
static vector< vector< TrackDesc > > gTracks
Definition: CbmBinnedTrackerQA.cxx:167
globalTrackResidualFirstX
static TH1F * globalTrackResidualFirstX
Definition: CbmBinnedTrackerQA.cxx:227
muchTrackPullFirstX
static TH1F * muchTrackPullFirstX
Definition: CbmBinnedTrackerQA.cxx:211
effByXAnglePrimary
static TProfile * effByXAnglePrimary
Definition: CbmBinnedTrackerQA.cxx:182
CbmMuchPoint
Definition: CbmMuchPoint.h:21
gNofRecoTracks
static Int_t gNofRecoTracks
Definition: CbmBinnedTrackerQA.cxx:840
CbmTrdPoint::GetZIn
Double_t GetZIn() const
Definition: CbmTrdPoint.h:65
TrackDesc::TrackDesc
TrackDesc(const TrackDesc &)=default
CbmBinnedTrackerQA::SetParContainers
void SetParContainers()
Definition: CbmBinnedTrackerQA.cxx:2462
CbmTrdAddress.h
Helper class to convert unique channel ID back and forth.
CbmPixelHit::GetX
Double_t GetX() const
Definition: CbmPixelHit.h:83
CbmGlobalTrack::GetMuchTrackIndex
Int_t GetMuchTrackIndex() const
Definition: CbmGlobalTrack.h:40
CbmMatch::GetLink
const CbmLink & GetLink(Int_t i) const
Definition: CbmMatch.h:35
CbmMatch::GetNofLinks
Int_t GetNofLinks() const
Definition: CbmMatch.h:38
CbmStsCluster
Data class for STS clusters.
Definition: CbmStsCluster.h:31
CbmBinnedTrackerQA::fTrdHits
TClonesArray * fTrdHits
Definition: CbmBinnedTrackerQA.h:79
CbmStsPoint::GetXOut
Double_t GetXOut() const
Definition: CbmStsPoint.h:84
CbmTrack::GetNofHits
virtual Int_t GetNofHits() const
Definition: CbmTrack.h:53
trdTrackPullFirstY
static TH1F * trdTrackPullFirstY
Definition: CbmBinnedTrackerQA.cxx:221
muchTrackResidualLastY
static TH1F * muchTrackResidualLastY
Definition: CbmBinnedTrackerQA.cxx:214
gNofClones
static Int_t gNofClones
Definition: CbmBinnedTrackerQA.cxx:842
CbmBinnedSettings::Use
bool Use(ECbmModuleId m) const
Definition: Settings.h:164
CbmPixelHit::GetY
Double_t GetY() const
Definition: CbmPixelHit.h:84
globalTrackPullFirstX
static TH1F * globalTrackPullFirstX
Definition: CbmBinnedTrackerQA.cxx:229
CbmStsSetup.h
CbmBinnedTrackerQA::fMuchTracks
TClonesArray * fMuchTracks
Definition: CbmBinnedTrackerQA.h:75
muchHitPullT
static TH1F * muchHitPullT
Definition: CbmBinnedTrackerQA.cxx:198
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmBinnedTrackerQA::fTofHits
TClonesArray * fTofHits
Definition: CbmBinnedTrackerQA.h:80
CbmPixelHit::GetDx
Double_t GetDx() const
Definition: CbmPixelHit.h:85
CbmMCDataArray::Size
Int_t Size(Int_t fileNumber, Int_t eventNumber)
Definition: CbmMCDataArray.cxx:133
CbmBinnedTrackerQA::Exec
void Exec(Option_t *opt)
Definition: CbmBinnedTrackerQA.cxx:845
CbmGlobalTrack::GetParamLast
const FairTrackParam * GetParamLast() const
Definition: CbmGlobalTrack.h:44
CbmMuchCluster
Data container for MUCH clusters.
Definition: CbmMuchCluster.h:20
CbmBinnedTrackerQA::fTrdDigis
TClonesArray * fTrdDigis
Definition: CbmBinnedTrackerQA.h:93
muchTrackPullLastY
static TH1F * muchTrackPullLastY
Definition: CbmBinnedTrackerQA.cxx:216
NumberToFile
void NumberToFile(const char *name, T number)
Definition: CbmBinnedTrackerQA.cxx:1741
CbmBinnedTrackerQA.h
globalTrackPullFirstY
static TH1F * globalTrackPullFirstY
Definition: CbmBinnedTrackerQA.cxx:230
TrackDesc::nearestHitDistMuch
Double_t * nearestHitDistMuch
Definition: CbmBinnedTrackerQA.cxx:63
CbmMCTrack::GetPdgCode
Int_t GetPdgCode() const
Definition: CbmMCTrack.h:70
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmBinnedTrackerQA::HandleMuch
void HandleMuch(Int_t muchTrackIndex, std::map< Int_t, std::set< Int_t >> &mcTrackIds, std::set< Int_t > *globalTrackMCRefs, Int_t *globalTracksHitInds)
Definition: CbmBinnedTrackerQA.cxx:1462
CbmTrdHit
data class for a reconstructed Energy-4D measurement in the TRD
Definition: CbmTrdHit.h:35
CbmMCDataManager::InitBranch
CbmMCDataArray * InitBranch(const char *name)
Definition: CbmMCDataManager.cxx:106
CbmStsSetup::Instance
static CbmStsSetup * Instance()
Definition: CbmStsSetup.cxx:293
effByYAngle
static TProfile * effByYAngle
Definition: CbmBinnedTrackerQA.cxx:185
muchTrackPullFirstY
static TH1F * muchTrackPullFirstY
Definition: CbmBinnedTrackerQA.cxx:212
trdTrackResidualLastX
static TH1F * trdTrackResidualLastX
Definition: CbmBinnedTrackerQA.cxx:222
effByMomNonPrimary
static TProfile * effByMomNonPrimary
Definition: CbmBinnedTrackerQA.cxx:175
CbmBinnedTrackerQA::HandleTof
void HandleTof(Int_t globalTrackIndex, Int_t tofHitIndex, std::map< Int_t, std::set< Int_t >> &mcTrackIds, std::set< Int_t > *globalTrackMCRefs, Int_t *globalTracksHitInds)
Definition: CbmBinnedTrackerQA.cxx:1669
globalTrackResidualFirstY
static TH1F * globalTrackResidualFirstY
Definition: CbmBinnedTrackerQA.cxx:228
CbmGlobalTrack.h
TrackDesc::pullXmuch
Double_t * pullXmuch
Definition: CbmBinnedTrackerQA.cxx:70
muchHitResidualX
static TH1F * muchHitResidualX
Definition: CbmBinnedTrackerQA.cxx:193
CbmTrdPoint::GetXOut
Double_t GetXOut() const
Definition: CbmTrdPoint.h:66
CbmBinnedTrackerQA::fTrdPoints
CbmMCDataArray * fTrdPoints
Definition: CbmBinnedTrackerQA.h:99
CbmTrdAddress::GetLayerId
static UInt_t GetLayerId(UInt_t address)
Return layer ID from address.
Definition: CbmTrdAddress.h:69
CbmStsPoint::GetZOut
Double_t GetZOut() const
Definition: CbmStsPoint.h:86
gTrdPoints
static vector< vector< bool > > gTrdPoints
Definition: CbmBinnedTrackerQA.cxx:170
CbmStsHit::GetFrontClusterId
Int_t GetFrontClusterId() const
Definition: CbmStsHit.h:93
clonesNofSameHits
static TH1F * clonesNofSameHits
Definition: CbmBinnedTrackerQA.cxx:191
TrackDesc::tofStationNo
static Int_t tofStationNo
Definition: CbmBinnedTrackerQA.cxx:50
CbmHit::GetRefId
Int_t GetRefId() const
Definition: CbmHit.h:72
CbmGlobalTrack::GetChi2
Double_t GetChi2() const
Definition: CbmGlobalTrack.h:47
stsTrackPullFirstY
static TH1F * stsTrackPullFirstY
Definition: CbmBinnedTrackerQA.cxx:203
ECbmModuleId::kTof
@ kTof
Time-of-flight Detector.
CbmStsPoint
Definition: CbmStsPoint.h:27
ppiNone
@ ppiNone
Definition: Settings.h:25
CbmMatch.h
CbmBinnedTrackerQA::fTofPoints
CbmMCDataArray * fTofPoints
Definition: CbmBinnedTrackerQA.h:100
TrackDesc::nearestHitDistTrd
Double_t * nearestHitDistTrd
Definition: CbmBinnedTrackerQA.cxx:64
gMuchPoints
static vector< vector< bool > > gMuchPoints
Definition: CbmBinnedTrackerQA.cxx:169
CbmPixelHit::GetDy
Double_t GetDy() const
Definition: CbmPixelHit.h:86
TrackDesc::pullYtrd
Double_t * pullYtrd
Definition: CbmBinnedTrackerQA.cxx:73
stsTrackResidualFirstX
static TH1F * stsTrackResidualFirstX
Definition: CbmBinnedTrackerQA.cxx:200
CbmHit::GetTimeError
Double_t GetTimeError() const
Definition: CbmHit.h:76
ppiJpsi
@ ppiJpsi
Definition: Settings.h:25
effByPolarAngleNonPrimary
static TProfile * effByPolarAngleNonPrimary
Definition: CbmBinnedTrackerQA.cxx:179
CbmMuchTrack
Definition: CbmMuchTrack.h:16
trdTrackPullLastY
static TH1F * trdTrackPullLastY
Definition: CbmBinnedTrackerQA.cxx:225
TrackDesc::isReference
bool isReference
Definition: CbmBinnedTrackerQA.cxx:76
CbmBinnedTrackerQA::fPrimaryParticleIds
std::list< EPrimaryParticleId > fPrimaryParticleIds
Definition: CbmBinnedTrackerQA.h:70
trdTrackResidualLastY
static TH1F * trdTrackResidualLastY
Definition: CbmBinnedTrackerQA.cxx:223
CbmStsTrack::GetNofHits
virtual Int_t GetNofHits() const
Definition: CbmStsTrack.h:76
CbmBinnedTrackerQA::fStsClusters
TClonesArray * fStsClusters
Definition: CbmBinnedTrackerQA.h:81
CbmBinnedTrackerQA::fTrdClusters
TClonesArray * fTrdClusters
Definition: CbmBinnedTrackerQA.h:83
TrackDesc::isPrimary
bool isPrimary
Definition: CbmBinnedTrackerQA.cxx:60
effByMomPrimary
static TProfile * effByMomPrimary
Definition: CbmBinnedTrackerQA.cxx:174
TrackDesc::nearestPointsSts
const CbmStsPoint ** nearestPointsSts
Definition: CbmBinnedTrackerQA.cxx:65
CbmCluster::GetNofDigis
Int_t GetNofDigis() const
Number of digis in cluster.
Definition: CbmCluster.h:69
CbmMuchPoint::GetYOut
Double_t GetYOut() const
Definition: CbmMuchPoint.h:74
CbmMuchCluster.h
Data container for MUCH clusters.
CbmTrdCluster
Data Container for TRD clusters.
Definition: CbmTrdCluster.h:23
effByYAnglePrimary
static TProfile * effByYAnglePrimary
Definition: CbmBinnedTrackerQA.cxx:186
CbmMCTrack::GetStartZ
Double_t GetStartZ() const
Definition: CbmMCTrack.h:77
CbmStsHit
data class for a reconstructed 3-d hit in the STS
Definition: CbmStsHit.h:31
CbmTrdDigi.h
CbmStsDigi.h
CbmGlobalTrack::GetStsTrackIndex
Int_t GetStsTrackIndex() const
Definition: CbmGlobalTrack.h:38
CbmMuchGeoScheme::GetLayerIndex
static Int_t GetLayerIndex(Int_t address)
Definition: CbmMuchGeoScheme.h:71
z2
Double_t z2[nSects2]
Definition: pipe_v16a_mvdsts100.h:11
CbmMuchGeoScheme::GetStationIndex
static Int_t GetStationIndex(Int_t address)
Definition: CbmMuchGeoScheme.h:68
TrackDesc::pullYsts
Double_t * pullYsts
Definition: CbmBinnedTrackerQA.cxx:69
TrackDesc::trd
pair< set< Int_t >, set< Int_t > > * trd
Definition: CbmBinnedTrackerQA.cxx:55
CbmMuchPoint.h
TrackDesc::much
pair< set< Int_t >, set< Int_t > > * much
Definition: CbmBinnedTrackerQA.cxx:54
tracks
TClonesArray * tracks
Definition: Analyze_matching.h:17
CbmBinnedTrackerQA::fGlobalTracks
TClonesArray * fGlobalTracks
Definition: CbmBinnedTrackerQA.h:73
TrackDesc::nofTrdStations
static Int_t nofTrdStations
Definition: CbmBinnedTrackerQA.cxx:44
CbmBinnedTrackerQA::fStsPoints
CbmMCDataArray * fStsPoints
Definition: CbmBinnedTrackerQA.h:97
CbmBinnedSettings::GetNofMuchStations
Int_t GetNofMuchStations() const
Definition: Settings.h:178
CbmBinnedSettings::IsOnlyPrimary
bool IsOnlyPrimary() const
Definition: Settings.h:162
CbmStsSetup::GetStationNumber
Int_t GetStationNumber(Int_t address)
Definition: CbmStsSetup.cxx:187
CbmMCDataArray::Get
TObject * Get(const CbmLink *lnk)
Definition: CbmMCDataArray.h:47
CbmHit::GetTime
Double_t GetTime() const
Definition: CbmHit.h:75
CbmStsPoint::GetYOut
Double_t GetYOut() const
Definition: CbmStsPoint.h:85
CbmBinnedTrackerQA::HandleSts
void HandleSts(Int_t stsTrackIndex, std::map< Int_t, std::set< Int_t >> &mcTrackIds, std::set< Int_t > *globalTrackMCRefs, Int_t *globalTracksHitInds)
Definition: CbmBinnedTrackerQA.cxx:1345
CbmTrack::GetHitIndex
Int_t GetHitIndex(Int_t iHit) const
Definition: CbmTrack.h:54
effByXAngleNonPrimary
static TProfile * effByXAngleNonPrimary
Definition: CbmBinnedTrackerQA.cxx:183
CbmBinnedSettings::GetNofTrdStations
Int_t GetNofTrdStations() const
Definition: Settings.h:180
CbmGlobalTrack::GetTrdTrackIndex
Int_t GetTrdTrackIndex() const
Definition: CbmGlobalTrack.h:39
CbmHit::GetAddress
Int_t GetAddress() const
Definition: CbmHit.h:73
TrackDesc::operator=
TrackDesc & operator=(const TrackDesc &)=default
CbmBinnedSettings::Instance
static CbmBinnedSettings * Instance()
Definition: Settings.h:29
TrackDesc::muchPoints
set< const CbmMuchPoint * > * muchPoints
Definition: CbmBinnedTrackerQA.cxx:58
CbmBinnedTrackerQA::fMuchHits
TClonesArray * fMuchHits
Definition: CbmBinnedTrackerQA.h:78
effByMom
static TProfile * effByMom
Definition: CbmBinnedTrackerQA.cxx:173
CbmBinnedTrackerQA::fMuchDigis
TClonesArray * fMuchDigis
Definition: CbmBinnedTrackerQA.h:91
CbmBinnedTrackerQA::HandleTrd
void HandleTrd(Int_t trdTrackIndex, std::map< Int_t, std::set< Int_t >> &mcTrackIds, std::set< Int_t > *globalTrackMCRefs, Int_t *globalTracksHitInds)
Definition: CbmBinnedTrackerQA.cxx:1577
CbmBinnedTrackerQA::fSettings
CbmBinnedSettings * fSettings
Definition: CbmBinnedTrackerQA.h:72
CbmBinnedTrackerQA::fStsDigis
TClonesArray * fStsDigis
Definition: CbmBinnedTrackerQA.h:89
CbmBinnedTrackerQA::fMuchDigiMatches
TClonesArray * fMuchDigiMatches
Definition: CbmBinnedTrackerQA.h:92
TrackDesc::nofMuchStations
static Int_t nofMuchStations
Definition: CbmBinnedTrackerQA.cxx:43
TrackDesc::TrackDesc
TrackDesc()
Definition: CbmBinnedTrackerQA.cxx:79
CbmBinnedTrackerQA::CbmBinnedTrackerQA
CbmBinnedTrackerQA()
Definition: CbmBinnedTrackerQA.cxx:273
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
TrackDesc::nofStsStations
static Int_t nofStsStations
Definition: CbmBinnedTrackerQA.cxx:42
trdTrackResidualFirstY
static TH1F * trdTrackResidualFirstY
Definition: CbmBinnedTrackerQA.cxx:219
CbmStsPoint::GetXIn
Double_t GetXIn() const
Definition: CbmStsPoint.h:81
stsTrackResidualLastX
static TH1F * stsTrackResidualLastX
Definition: CbmBinnedTrackerQA.cxx:204
TrackDesc::pullXtrd
Double_t * pullXtrd
Definition: CbmBinnedTrackerQA.cxx:72
xMath::Pi
double Pi()
Definition: xMath.h:5
CbmStsSetup::Init
Bool_t Init(const char *geometryFile=nullptr)
Initialise the setup.
Definition: CbmStsSetup.cxx:201
CbmBinnedTrackerQA::IterateTrdHits
void IterateTrdHits(std::function< void(const CbmTrdHit *, const CbmTrdPoint *)> handleData)
Definition: CbmBinnedTrackerQA.cxx:809
CbmTrdPoint::GetZOut
Double_t GetZOut() const
Definition: CbmTrdPoint.h:68
SaveHisto
static void SaveHisto(TH1 *histo)
Definition: CbmBinnedTrackerQA.cxx:1729
CbmTrack::GetParamFirst
const FairTrackParam * GetParamFirst() const
Definition: CbmTrack.h:61
CbmStsSetup
Class representing the top level of the STS setup.
Definition: CbmStsSetup.h:39
TrackDesc::nearestPointsMuch
const CbmMuchPoint ** nearestPointsMuch
Definition: CbmBinnedTrackerQA.cxx:66
CbmStsPoint::GetYIn
Double_t GetYIn() const
Definition: CbmStsPoint.h:82
TrackDesc::firstMuchStationNo
static Int_t firstMuchStationNo
Definition: CbmBinnedTrackerQA.cxx:48
lambdaChildrenMoms
static TH1F * lambdaChildrenMoms
Definition: CbmBinnedTrackerQA.cxx:189
TrackDesc::tof
pair< set< Int_t >, set< Int_t > > tof
Definition: CbmBinnedTrackerQA.cxx:56
CbmTrdPoint
Definition: CbmTrdPoint.h:23
CbmMCDataManager
Task class creating and managing CbmMCDataArray objects.
Definition: CbmMCDataManager.h:27
CbmBinnedTrackerQA
Definition: CbmBinnedTrackerQA.h:29
ECbmModuleId::kTrd
@ kTrd
Transition Radiation Detector.
CbmTrdTrack
Definition: CbmTrdTrack.h:22
muchHitPullX
static TH1F * muchHitPullX
Definition: CbmBinnedTrackerQA.cxx:196
CbmGlobalTrack
Definition: CbmGlobalTrack.h:26
trdTrackPullLastX
static TH1F * trdTrackPullLastX
Definition: CbmBinnedTrackerQA.cxx:224
CbmMCTrack::GetStartY
Double_t GetStartY() const
Definition: CbmMCTrack.h:76
TrackDesc::sts
pair< set< Int_t >, set< Int_t > > * sts
Definition: CbmBinnedTrackerQA.cxx:53
CbmBinnedTrackerQA::fMuchClusters
TClonesArray * fMuchClusters
Definition: CbmBinnedTrackerQA.h:82
CbmBinnedTrackerQA::fStsTracks
TClonesArray * fStsTracks
Definition: CbmBinnedTrackerQA.h:74
gStsPoints
static vector< vector< bool > > gStsPoints
Definition: CbmBinnedTrackerQA.cxx:168
CbmStsPoint.h
points
TClonesArray * points
Definition: Analyze_matching.h:18
CbmMCTrack.h
TrackDesc::firstStsStationNo
static Int_t firstStsStationNo
Definition: CbmBinnedTrackerQA.cxx:47
CbmStsHit::GetBackClusterId
Int_t GetBackClusterId() const
Definition: CbmStsHit.h:69
CbmTrdPoint::GetXIn
Double_t GetXIn() const
Definition: CbmTrdPoint.h:63
CbmBinnedTrackerQA::fStsDigiMatches
TClonesArray * fStsDigiMatches
Definition: CbmBinnedTrackerQA.h:90
gIsRecoClone
static vector< bool > gIsRecoClone
Definition: CbmBinnedTrackerQA.cxx:843
CbmBinnedTrackerQA::Finish
void Finish()
Definition: CbmBinnedTrackerQA.cxx:1796
muchTrackPullLastX
static TH1F * muchTrackPullLastX
Definition: CbmBinnedTrackerQA.cxx:215
CbmMCTrack
Definition: CbmMCTrack.h:34
stsTrackResidualFirstY
static TH1F * stsTrackResidualFirstY
Definition: CbmBinnedTrackerQA.cxx:201
CbmBinnedTrackerQA::Init
InitStatus Init()
Definition: CbmBinnedTrackerQA.cxx:304
CbmMuchPoint::GetYIn
Double_t GetYIn() const
Definition: CbmMuchPoint.h:71
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTrdPoint::GetModuleAddress
Int_t GetModuleAddress() const
Definition: CbmTrdPoint.h:76
muchTrackResidualFirstX
static TH1F * muchTrackResidualFirstX
Definition: CbmBinnedTrackerQA.cxx:209
CbmBinnedTrackerQA::fTofDigiPointMatches
TClonesArray * fTofDigiPointMatches
Definition: CbmBinnedTrackerQA.h:87
effByPolarAnglePrimary
static TProfile * effByPolarAnglePrimary
Definition: CbmBinnedTrackerQA.cxx:178
CbmStsPoint::GetZIn
Double_t GetZIn() const
Definition: CbmStsPoint.h:83
CbmTofPoint.h
CbmBinnedTrackerQA::fStsHits
TClonesArray * fStsHits
Definition: CbmBinnedTrackerQA.h:77
stsTrackPullLastY
static TH1F * stsTrackPullLastY
Definition: CbmBinnedTrackerQA.cxx:207
effByXAngle
static TProfile * effByXAngle
Definition: CbmBinnedTrackerQA.cxx:181
m
__m128 m
Definition: L1/vectors/P4_F32vec4.h:26
CbmMuchPixelHit.h
Class for pixel hits in MUCH detector.
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmBinnedTrackerQA::fMuchPoints
CbmMCDataArray * fMuchPoints
Definition: CbmBinnedTrackerQA.h:98
TrackDesc::~TrackDesc
~TrackDesc()
Definition: CbmBinnedTrackerQA.cxx:132
effByPolarAngle
static TProfile * effByPolarAngle
Definition: CbmBinnedTrackerQA.cxx:177
TrackDesc
Definition: CbmBinnedTrackerQA.cxx:41
CbmMuchPoint::GetXIn
Double_t GetXIn() const
Definition: CbmMuchPoint.h:70
lambdaList
static list< TrackDesc * > lambdaList
Definition: CbmBinnedTrackerQA.cxx:271
gEventNumber
static Int_t gEventNumber
Definition: CbmBinnedTrackerQA.cxx:839
CbmBinnedSettings
Definition: Settings.h:27
TrackDesc::firstTrdStationNo
static Int_t firstTrdStationNo
Definition: CbmBinnedTrackerQA.cxx:49
ECbmModuleId::kMuch
@ kMuch
Muon detection system.
gTofPoints
static vector< vector< char > > gTofPoints
Definition: CbmBinnedTrackerQA.cxx:171
globalTrackResidualLastY
static TH1F * globalTrackResidualLastY
Definition: CbmBinnedTrackerQA.cxx:232
GeoReader.h
trdTrackResidualFirstX
static TH1F * trdTrackResidualFirstX
Definition: CbmBinnedTrackerQA.cxx:218
CbmTofPoint
Geometric intersection of a MC track with a TOFb detector.
Definition: CbmTofPoint.h:40
CbmBinnedTrackerQA::fTrdTracks
TClonesArray * fTrdTracks
Definition: CbmBinnedTrackerQA.h:76
EPrimaryParticleId
EPrimaryParticleId
Definition: Settings.h:25
stsTrackPullLastX
static TH1F * stsTrackPullLastX
Definition: CbmBinnedTrackerQA.cxx:206
muchHitPullY
static TH1F * muchHitPullY
Definition: CbmBinnedTrackerQA.cxx:197
CbmGlobalTrack::GetTofHitIndex
Int_t GetTofHitIndex() const
Definition: CbmGlobalTrack.h:42
CbmBinnedTrackerQA::fIsOnlyPrimary
bool fIsOnlyPrimary
Definition: CbmBinnedTrackerQA.h:71
CbmMuchPixelHit
Definition: CbmMuchPixelHit.h:17
CbmTrdCluster.h
Data Container for TRD clusters.
CbmBinnedSettings::GetNofStations
Int_t GetNofStations() const
Definition: Settings.h:182
TrackDesc::stsPoints
set< const CbmStsPoint * > * stsPoints
Definition: CbmBinnedTrackerQA.cxx:57
CbmMuchGeoScheme.h
CbmStsTrack::GetStsHitIndex
Int_t GetStsHitIndex(Int_t iHit) const
Definition: CbmStsTrack.h:98
CbmStsCluster.h
Data class for STS clusters.
CbmBinnedTrackerQA::fMCTracks
CbmMCDataArray * fMCTracks
Definition: CbmBinnedTrackerQA.h:96
muchHitResidualT
static TH1F * muchHitResidualT
Definition: CbmBinnedTrackerQA.cxx:195
z1
Double_t z1[nSects1]
Definition: pipe_v16a_mvdsts100.h:6
TrackDesc::nearestHitDistSts
Double_t * nearestHitDistSts
Definition: CbmBinnedTrackerQA.cxx:62
trdTrackPullFirstX
static TH1F * trdTrackPullFirstX
Definition: CbmBinnedTrackerQA.cxx:220
CbmStsTrack
Definition: CbmStsTrack.h:37
TrackDesc::isReconstructed
bool isReconstructed
Definition: CbmBinnedTrackerQA.cxx:77
TrackDesc::ptr
const CbmMCTrack * ptr
Definition: CbmBinnedTrackerQA.cxx:61
ECbmModuleId::kSts
@ kSts
Silicon Tracking System.
CbmTrdPoint::GetYIn
Double_t GetYIn() const
Definition: CbmTrdPoint.h:64
CbmMuchStation.h
CbmCluster::GetDigi
Int_t GetDigi(Int_t index) const
Get digi at position index.
Definition: CbmCluster.h:76
CbmBinnedTrackerQA::fTofHitDigiMatches
TClonesArray * fTofHitDigiMatches
Definition: CbmBinnedTrackerQA.h:86
TrackDesc::pullYmuch
Double_t * pullYmuch
Definition: CbmBinnedTrackerQA.cxx:71
CbmBinnedTrackerQA::fTrdDigiMatches
TClonesArray * fTrdDigiMatches
Definition: CbmBinnedTrackerQA.h:85
IncrementForId
static void IncrementForId(map< Int_t, set< Int_t >> &ids, Int_t id, Int_t stId)
Definition: CbmBinnedTrackerQA.cxx:1341
TrackDesc::nearestPointsTrd
const CbmTrdPoint ** nearestPointsTrd
Definition: CbmBinnedTrackerQA.cxx:67
CbmMCTrack::GetP
Double_t GetP() const
Definition: CbmMCTrack.h:100
effByYAngleNonPrimary
static TProfile * effByYAngleNonPrimary
Definition: CbmBinnedTrackerQA.cxx:187
CbmBinnedTrackerQA::fTofDigis
TClonesArray * fTofDigis
Definition: CbmBinnedTrackerQA.h:94
gNofNonGhosts
static Int_t gNofNonGhosts
Definition: CbmBinnedTrackerQA.cxx:841
globalTrackResidualLastX
static TH1F * globalTrackResidualLastX
Definition: CbmBinnedTrackerQA.cxx:231
muchTrackResidualFirstY
static TH1F * muchTrackResidualFirstY
Definition: CbmBinnedTrackerQA.cxx:210
CbmStsSetup::IsInit
Bool_t IsInit() const
Initialisation status for sensor parameters.
Definition: CbmStsSetup.h:124
stsTrackPullFirstX
static TH1F * stsTrackPullFirstX
Definition: CbmBinnedTrackerQA.cxx:202
TrackDesc::trdPoints
set< const CbmTrdPoint * > * trdPoints
Definition: CbmBinnedTrackerQA.cxx:59
globalTrackPullLastY
static TH1F * globalTrackPullLastY
Definition: CbmBinnedTrackerQA.cxx:234
stsTrackResidualLastY
static TH1F * stsTrackResidualLastY
Definition: CbmBinnedTrackerQA.cxx:205
CbmStsHit.h
Data class for a reconstructed hit in the STS.
TrackDesc::children
list< TrackDesc * > children
Definition: CbmBinnedTrackerQA.cxx:75
effOfMCPoints
static void effOfMCPoints(const char *name, const vector< vector< bool >> &points)
Definition: CbmBinnedTrackerQA.cxx:1748
CbmTrdHit::GetPlaneId
Int_t GetPlaneId() const
Inherited from CbmBaseHit.
Definition: CbmTrdHit.h:73