CbmRoot
alignment/CbmRichRecoQa.cxx
Go to the documentation of this file.
1 
2 #include "CbmRichRecoQa.h"
3 
4 #include "TCanvas.h"
5 #include "TClonesArray.h"
6 #include "TEllipse.h"
7 #include "TF1.h"
8 #include "TH1.h"
9 #include "TH1D.h"
10 #include "TMCProcess.h"
11 #include "TMarker.h"
12 #include "TStyle.h"
13 
14 #include "CbmDrawHist.h"
15 #include "CbmGlobalTrack.h"
16 #include "CbmMCTrack.h"
17 #include "CbmMatchRecoToMC.h"
18 #include "CbmRichDraw.h"
19 #include "CbmRichGeoManager.h"
20 #include "CbmRichHit.h"
21 #include "CbmRichPoint.h"
22 #include "CbmRichRing.h"
23 #include "CbmRichUtil.h"
24 #include "CbmTrackMatchNew.h"
25 #include "FairMCPoint.h"
26 #include "FairTrackParam.h"
28 
29 #include "CbmHistManager.h"
30 #include "CbmUtils.h"
31 
32 #include <boost/assign/list_of.hpp>
33 #include <iostream>
34 #include <sstream>
35 #include <string>
36 
37 using namespace std;
38 using boost::assign::list_of;
39 
41  : FairTask("CbmRichRecoQa")
42  , fHM(nullptr)
43  , fEventNum(0)
44  , fOutputDir("")
45  , fMCTracks(nullptr)
46  , fRichPoints(nullptr)
47  , fRichDigis(nullptr)
48  , fRichHits(nullptr)
49  , fRichRings(nullptr)
50  , fRichRingMatches(nullptr)
51  , fGlobalTracks(nullptr)
52  , fStsTracks(nullptr)
53  , fStsTrackMatches(nullptr)
54  , fRichProjections(nullptr)
55  , fNofHitsInRingMap()
56  , fCanvas()
57  , fCorrection("") {}
58 
59 InitStatus CbmRichRecoQa::Init() {
60  cout << "CbmRichRecoQa::Init" << endl;
61  FairRootManager* ioman = FairRootManager::Instance();
62  if (nullptr == ioman) {
63  Fatal("CbmRichRecoQa::Init", "RootManager not instantised!");
64  }
65 
66  fMCTracks = (TClonesArray*) ioman->GetObject("MCTrack");
67  if (nullptr == fMCTracks) { Fatal("CbmRichRecoQa::Init", "No MC Tracks!"); }
68 
69  fRichPoints = (TClonesArray*) ioman->GetObject("RichPoint");
70  if (nullptr == fRichPoints) {
71  Fatal("CbmRichRecoQa::Init", "No Rich Points!");
72  }
73 
74  fRichDigis = (TClonesArray*) ioman->GetObject("RichDigi");
75  if (nullptr == fRichDigis) { Fatal("CbmRichRecoQa::Init", "No Rich Digis!"); }
76 
77  fRichHits = (TClonesArray*) ioman->GetObject("RichHit");
78  if (nullptr == fRichHits) { Fatal("CbmRichRecoQa::Init", "No RichHits!"); }
79 
80  fRichRings = (TClonesArray*) ioman->GetObject("RichRing");
81  if (nullptr == fRichRings) { Fatal("CbmRichRecoQa::Init", "No RichRings!"); }
82 
83  fRichRingMatches = (TClonesArray*) ioman->GetObject("RichRingMatch");
84  if (nullptr == fRichRingMatches) {
85  Fatal("CbmRichRecoQa::Init", "No RichRingMatch array!");
86  }
87 
88  fGlobalTracks = (TClonesArray*) ioman->GetObject("GlobalTrack");
89  if (nullptr == fGlobalTracks) {
90  Fatal("CbmRichRecoQa::Init", "No GlobalTrack array!");
91  }
92 
93  fStsTracks = (TClonesArray*) ioman->GetObject("StsTrack");
94  if (nullptr == fStsTracks) {
95  Fatal("CbmRichRecoQa::Init", ": No StsTrack array!");
96  }
97 
98  fStsTrackMatches = (TClonesArray*) ioman->GetObject("StsTrackMatch");
99  if (nullptr == fStsTrackMatches) {
100  Fatal("CbmRichRecoQa::Init", ": No StsTrackMatch array!");
101  }
102 
103  fRichProjections = (TClonesArray*) ioman->GetObject("RichProjection");
104  if (nullptr == fRichProjections) {
105  Fatal("CbmRichUrqmdTest::Init", "No fRichProjections array!");
106  }
107 
108  InitHistograms();
109 
110  // CbmLitGlobalElectronId::GetInstance();
111 
112  return kSUCCESS;
113 }
114 
116  fHM = new CbmHistManager();
117 
118  // 2D histogramm XY
119  double xMin = -120.;
120  double xMax = 120.;
121  int nBinsX = 30;
122  double yMin = -208;
123  double yMax = 208.;
124  int nBinsY = 52;
125 
126  // 1D histogram X or Y
127  int nBinsX1 = 60;
128  int xMin1 = -120;
129  int xMax1 = 120;
130  int nBinsY1 = 25;
131  int yMin1 = 100;
132  int yMax1 = 200;
133 
134  for (Int_t i = 0; i < 4; i++) {
135  string s;
136  if (i == 0) s = "Primel";
137  if (i == 1) s = "Pi";
138  if (i == 2) s = "PrimelPlus";
139  if (i == 3) s = "PrimelMinus";
140 
141  // Ring-Track VS momentum: (20, 0., 10., 100, 0., 5.)
142  fHM->Create2<TH2D>("fhRingTrackDistVsMomTruematch" + s,
143  "fhRingTrackDistVsMomTruematch" + s
144  + ";P [GeV/c];Ring-track distance [cm];Yield (a.u.)",
145  40,
146  0.,
147  10.,
148  120,
149  0.,
150  3.);
151  fHM->Create2<TH2D>("fhRingTrackDistVsMomWrongmatch" + s,
152  "fhRingTrackDistVsMomWrongmatch" + s
153  + ";P [GeV/c];Ring-track distance [cm];Yield (a.u.)",
154  20,
155  0.,
156  10.,
157  100,
158  0.,
159  5.);
160 
161  // Ring-Track VS nb hits found in ring: (40, -.5, 39.5, 100, 0., 5.)
162  fHM->Create2<TH2D>(
163  "fhRingTrackDistVsNofHitsTruematch" + s,
164  "fhRingTrackDistVsNofHitsTruematch" + s
165  + ";Nof hits in found ring;Ring-track distance [cm];Yield (a.u.)",
166  41,
167  -.5,
168  40.5,
169  100,
170  0.,
171  5.);
172  // Ring-Track 3D: (nBinsX, xMin, xMax, nBinsY, yMin, yMax, 100, 0., 5.)
173  fHM->Create3<TH3D>("fhRingTrackDistVsXYTruematch" + s,
174  "fhRingTrackDistVsXYTruematch" + s
175  + ";X [cm];Y [cm];Ring-track distance [cm]",
176  240,
177  xMin,
178  xMax,
179  416,
180  -200.,
181  200.,
182  400,
183  0.,
184  5.);
185  fHM->Create2<TH2D>("fhRingTrackDistVsXTruematch" + s,
186  "fhRingTrackDistVsXTruematch" + s
187  + ";X [cm];Ring-track distance [cm]",
188  nBinsX1,
189  xMin1,
190  xMax1,
191  100,
192  0.,
193  5.);
194  // Ring-Track VS Absolute Y distance: (nBinsY1, yMin1, yMax1, 100, 0., 5.)
195  fHM->Create2<TH2D>("fhRingTrackDistVsYTruematch" + s,
196  "fhRingTrackDistVsYTruematch" + s
197  + ";Abs(Y) [cm];Ring-track distance [cm]",
198  34,
199  110.,
200  yMax1,
201  100,
202  0.,
203  5.);
204 
205  Double_t range = 3., nbBinsX = 120., nbBinsY = 208;
206  fHM->Create3<TH3D>("fhRingTrackDistDiffXRingVsXYTruematchUp" + s,
207  "fhRingTrackDistDiffXRingVsXYTruematchUp" + s
208  + ";X [cm];Y [cm];X Ring-track distance [cm]",
209  nbBinsX,
210  xMin,
211  xMax,
212  nbBinsY,
213  110,
214  200,
215  200,
216  -range,
217  range);
218  fHM->Create3<TH3D>("fhRingTrackDistDiffYRingVsXYTruematchUp" + s,
219  "fhRingTrackDistDiffYRingVsXYTruematchUp" + s
220  + ";X [cm];Y [cm];Y Ring-track distance [cm]",
221  nbBinsX,
222  xMin,
223  xMax,
224  nbBinsY,
225  110,
226  200,
227  200,
228  -range,
229  range);
230  fHM->Create3<TH3D>("fhRingTrackDistDiffXTrackVsXYTruematchUp" + s,
231  "fhRingTrackDistDiffXTrackVsXYTruematchUp" + s
232  + ";X [cm];Y [cm];X Track-ring distance [cm]",
233  nbBinsX,
234  xMin,
235  xMax,
236  nbBinsY,
237  110,
238  200,
239  200,
240  -range,
241  range);
242  fHM->Create3<TH3D>("fhRingTrackDistDiffYTrackVsXYTruematchUp" + s,
243  "fhRingTrackDistDiffYTrackVsXYTruematchUp" + s
244  + ";X [cm];Y [cm];Y Track-ring distance [cm]",
245  nbBinsX,
246  xMin,
247  xMax,
248  nbBinsY,
249  110,
250  200,
251  200,
252  -range,
253  range);
254 
255  fHM->Create3<TH3D>("fhRingTrackDistDiffXRingVsXYTruematchDown" + s,
256  "fhRingTrackDistDiffXRingVsXYTruematchDown" + s
257  + ";X [cm];Y [cm];X Ring-track distance [cm]",
258  nbBinsX,
259  xMin,
260  xMax,
261  nbBinsY,
262  -200,
263  -110,
264  200,
265  -range,
266  range);
267  fHM->Create3<TH3D>("fhRingTrackDistDiffYRingVsXYTruematchDown" + s,
268  "fhRingTrackDistDiffYRingVsXYTruematchDown" + s
269  + ";X [cm];Y [cm];Y Ring-track distance [cm]",
270  nbBinsX,
271  xMin,
272  xMax,
273  nbBinsY,
274  -200,
275  -110,
276  200,
277  -range,
278  range);
279  fHM->Create3<TH3D>("fhRingTrackDistDiffXTrackVsXYTruematchDown" + s,
280  "fhRingTrackDistDiffXTrackVsXYTruematchDown" + s
281  + ";X [cm];Y [cm];X Track-ring distance [cm]",
282  nbBinsX,
283  xMin,
284  xMax,
285  nbBinsY,
286  -200,
287  -110,
288  200,
289  -range,
290  range);
291  fHM->Create3<TH3D>("fhRingTrackDistDiffYTrackVsXYTruematchDown" + s,
292  "fhRingTrackDistDiffYTrackVsXYTruematchDown" + s
293  + ";X [cm];Y [cm];Y Track-ring distance [cm]",
294  nbBinsX,
295  xMin,
296  xMax,
297  nbBinsY,
298  -200,
299  -110,
300  200,
301  -range,
302  range);
303 
304  fHM->Create3<TH3D>("fhRingTrackDistVsXYHalfUpTruematch" + s,
305  "fhRingTrackDistVsXYHalfUpTruematch" + s
306  + ";X [cm];Y [cm];Ring-track distance [cm]",
307  nbBinsX,
308  xMin,
309  xMax,
310  nbBinsY,
311  110.,
312  200.,
313  100,
314  0.,
315  range);
316  fHM->Create3<TH3D>("fhRingTrackDistVsXYHalfDownTruematch" + s,
317  "fhRingTrackDistVsXYHalfDownTruematch" + s
318  + ";X [cm];Y [cm];Ring-track distance [cm]",
319  nbBinsX,
320  xMin,
321  xMax,
322  nbBinsY,
323  -200.,
324  -110.,
325  100,
326  0.,
327  range);
328  }
329 
330  // after electron identification
331  Double_t range_2 = 3.;
332  //fHM->Create2<TH2D>("fhRingTrackDistVsMomTruematchElId", "fhRingTrackDistVsMomTruematchElId;P [GeV/c];Ring-track distance [cm];Yield (a.u.)", 20, 0., 10., 100, 0., 5.);
333  fHM->Create2<TH2D>("fhRingTrackDistVsMomTruematchElId",
334  "fhRingTrackDistVsMomTruematchElId;P [GeV/c];Ring-track "
335  "distance [cm];Yield (a.u.)",
336  40,
337  0.,
338  10.,
339  120,
340  0.,
341  3.);
342  fHM->Create3<TH3D>(
343  "fhRingTrackDistDiffXAfterEl",
344  "fhRingTrackDistDiffXAfterEl;X [cm];Y [cm];X Ring-track distance [cm]",
345  60,
346  xMin,
347  xMax,
348  104,
349  110,
350  200,
351  200,
352  -range_2,
353  range_2);
354  fHM->Create3<TH3D>(
355  "fhRingTrackDistDiffYAfterEl",
356  "fhRingTrackDistDiffYAfterEl;X [cm];Y [cm];Y Ring-track distance [cm]",
357  60,
358  xMin,
359  xMax,
360  104,
361  110,
362  200,
363  200,
364  -range_2,
365  range_2);
366 
367  fHM->Create1<TH1D>("fhMismatchSource",
368  "fhMismatchSource;Global track category;% from MC",
369  13,
370  -0.5,
371  12.5);
372 
373  fHM->Create1<TH1D>("fhMismatchSourceMomMc",
374  "fhMismatchSourceMomMc;Momentum [GeV/c];Yield",
375  40,
376  0.,
377  10.);
378  fHM->Create1<TH1D>("fhMismatchSourceMomSts",
379  "fhMismatchSourceMomSts;Momentum [GeV/c];Yield",
380  40,
381  0.,
382  10.);
383  fHM->Create1<TH1D>("fhMismatchSourceMomStsAccRich",
384  "fhMismatchSourceMomStsAccRich;Momentum [GeV/c];Yield",
385  40,
386  0.,
387  10.);
388  fHM->Create1<TH1D>("fhMismatchSourceMomStsRich",
389  "fhMismatchSourceMomStsRich;Momentum [GeV/c];Yield",
390  40,
391  0.,
392  10.);
393  fHM->Create1<TH1D>("fhMismatchSourceMomStsRichTrue",
394  "fhMismatchSourceMomStsRichTrue;Momentum [GeV/c];Yield",
395  40,
396  0.,
397  10.);
398  fHM->Create1<TH1D>("fhMismatchSourceMomStsNoRich",
399  "fhMismatchSourceMomStsNoRich;Momentum [GeV/c];Yield",
400  40,
401  0.,
402  10.);
403  fHM->Create1<TH1D>("fhMismatchSourceMomStsNoRichRF",
404  "fhMismatchSourceMomStsNoRichRF;Momentum [GeV/c];Yield",
405  40,
406  0.,
407  10.);
408  fHM->Create1<TH1D>("fhMismatchSourceMomStsNoRichRM",
409  "fhMismatchSourceMomStsNoRichRM;Momentum [GeV/c];Yield",
410  40,
411  0.,
412  10.);
413  fHM->Create1<TH1D>("fhMismatchSourceMomStsNoRichNoRF",
414  "fhMismatchSourceMomStsNoRichNoRF;Momentum [GeV/c];Yield",
415  40,
416  0.,
417  10.);
418  fHM->Create1<TH1D>(
419  "fhMismatchSourceMomStsNoRichNoProj",
420  "fhMismatchSourceMomStsNoRichNoProj;Momentum [GeV/c];Yield",
421  40,
422  0.,
423  10.);
424  fHM->Create1<TH1D>("fhMismatchSourceMomStsRichWrong",
425  "fhMismatchSourceMomStsRichWrong;Momentum [GeV/c];Yield",
426  40,
427  0.,
428  10.);
429  fHM->Create1<TH1D>("fhMismatchSourceMomStsRichWrongRF",
430  "fhMismatchSourceMomStsRichWrongRF;Momentum [GeV/c];Yield",
431  40,
432  0.,
433  10.);
434  fHM->Create1<TH1D>("fhMismatchSourceMomStsRichWrongRM",
435  "fhMismatchSourceMomStsRichWrongRM;Momentum [GeV/c];Yield",
436  40,
437  0.,
438  10.);
439 }
440 
441 void CbmRichRecoQa::Exec(Option_t* option) {
442  fEventNum++;
443  cout << "CbmRichRecoQa, event No. " << fEventNum << endl;
444 
448 }
449 
451  fNofHitsInRingMap.clear();
452  Int_t nofRichHits = fRichHits->GetEntriesFast();
453  for (Int_t iHit = 0; iHit < nofRichHits; iHit++) {
454  CbmRichHit* hit = static_cast<CbmRichHit*>(fRichHits->At(iHit));
455  if (nullptr == hit) continue;
456 
457  vector<Int_t> motherIds = CbmMatchRecoToMC::GetMcTrackMotherIdsForRichHit(
459  for (UInt_t i = 0; i < motherIds.size(); i++) {
460  fNofHitsInRingMap[motherIds[i]]++;
461  }
462  }
463 }
464 
466  Int_t nofMcTracks = fMCTracks->GetEntriesFast();
467  for (Int_t iTrack = 0; iTrack < nofMcTracks; iTrack++) {
468  const CbmMCTrack* mcTrack =
469  static_cast<const CbmMCTrack*>(fMCTracks->At(iTrack));
470  if (mcTrack == nullptr) continue;
471  bool isEl = IsMcPrimaryElectron(mcTrack);
472  if (isEl) {
473  //MC
474  fHM->H1("fhMismatchSource")->Fill(0);
475  fHM->H1("fhMismatchSourceMomMc")->Fill(mcTrack->GetP());
476  }
477  }
478 
479 
480  Int_t nofGlobalTracks = fGlobalTracks->GetEntriesFast();
481  for (Int_t iTrack = 0; iTrack < nofGlobalTracks; iTrack++) {
482  const CbmGlobalTrack* globalTrack =
483  static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(iTrack));
484 
485  Int_t stsId = globalTrack->GetStsTrackIndex();
486  if (stsId < 0) continue;
487  const CbmTrackMatchNew* stsTrackMatch =
488  static_cast<const CbmTrackMatchNew*>(fStsTrackMatches->At(stsId));
489  if (stsTrackMatch == nullptr) continue;
490  int stsMcTrackId = stsTrackMatch->GetMatchedLink().GetIndex();
491 
492  CbmMCTrack* mctrack = static_cast<CbmMCTrack*>(fMCTracks->At(stsMcTrackId));
493  if (mctrack == nullptr) continue;
494  Double_t mom = mctrack->GetP();
495 
496  bool isEl = IsMcPrimaryElectron(mctrack);
497  if (!isEl) continue;
498 
499  //STS
500  fHM->H1("fhMismatchSource")->Fill(1);
501  fHM->H1("fhMismatchSourceMomSts")->Fill(mom);
502 
503  if (fNofHitsInRingMap[stsMcTrackId] >= 7) {
504  //Sts-AccRich
505  fHM->H1("fhMismatchSource")->Fill(2);
506  fHM->H1("fhMismatchSourceMomStsAccRich")->Fill(mctrack->GetP());
507  }
508 
509  Int_t richId = globalTrack->GetRichRingIndex();
510 
511  // No RICH segment
512  if (richId < 0) {
513  //STS-noRICH
514  fHM->H1("fhMismatchSource")->Fill(5);
515  fHM->H1("fhMismatchSourceMomStsNoRich")->Fill(mom);
516  bool ringFound = WasRingFound(stsMcTrackId);
517  bool ringMatched = WasRingMatched(stsMcTrackId);
518  bool hasProj = HasRichProjection(stsId);
519  if (ringFound) {
520  //STS-NoRich RF
521  fHM->H1("fhMismatchSource")->Fill(6);
522  fHM->H1("fhMismatchSourceMomStsNoRichRF")->Fill(mom);
523  } else {
524  //STS-NoRich NoRF
525  fHM->H1("fhMismatchSource")->Fill(8);
526  fHM->H1("fhMismatchSourceMomStsNoRichNoRF")->Fill(mom);
527  }
528 
529  if (ringMatched) {
530  //STS-NoRich RM
531  fHM->H1("fhMismatchSource")->Fill(7);
532  fHM->H1("fhMismatchSourceMomStsNoRichRM")->Fill(mom);
533  }
534 
535  if (!hasProj) {
536  //STS-NoRich NoProj
537  fHM->H1("fhMismatchSource")->Fill(9);
538  fHM->H1("fhMismatchSourceMomStsNoRichNoProj")->Fill(mom);
539  }
540 
541  continue;
542  }
543 
544  //STS-RICH
545  fHM->H1("fhMismatchSource")->Fill(3);
546  fHM->H1("fhMismatchSourceMomStsRich")->Fill(mom);
547 
548  const CbmTrackMatchNew* richRingMatch =
549  static_cast<const CbmTrackMatchNew*>(fRichRingMatches->At(richId));
550  if (richRingMatch == nullptr) continue;
551  int richMcTrackId = richRingMatch->GetMatchedLink().GetIndex();
552  const CbmRichRing* ring =
553  static_cast<const CbmRichRing*>(fRichRings->At(richId));
554  if (nullptr == ring) continue;
555 
556  if (stsMcTrackId == richMcTrackId) {
557  //STS-RICH true
558  fHM->H1("fhMismatchSource")->Fill(4);
559  fHM->H1("fhMismatchSourceMomStsRichTrue")->Fill(mom);
560  } else {
561  //STS-RICH wrong
562  fHM->H1("fhMismatchSource")->Fill(10);
563  fHM->H1("fhMismatchSourceMomStsRichWrong")->Fill(mom);
564  if (WasRingFound(stsMcTrackId)) {
565  //STS-RICH wrong RF
566  fHM->H1("fhMismatchSource")->Fill(11);
567  fHM->H1("fhMismatchSourceMomStsRichWrongRF")->Fill(mom);
568  }
569 
570  if (WasRingFound(stsMcTrackId)) {
571  //STS-RICH wrong RM
572  fHM->H1("fhMismatchSource")->Fill(12);
573  fHM->H1("fhMismatchSourceMomStsRichWrongRM")->Fill(mom);
574  }
575  }
576  }
577 }
578 
579 bool CbmRichRecoQa::WasRingFound(Int_t mcTrackId) {
580  Int_t nofRings = fRichRings->GetEntriesFast();
581  for (Int_t iR = 0; iR < nofRings; iR++) {
582  const CbmRichRing* ring =
583  static_cast<const CbmRichRing*>(fRichRings->At(iR));
584  if (ring == nullptr) continue;
585  const CbmTrackMatchNew* richRingMatch =
586  static_cast<const CbmTrackMatchNew*>(fRichRingMatches->At(iR));
587  if (richRingMatch == nullptr) continue;
588  int richMcTrackId = richRingMatch->GetMatchedLink().GetIndex();
589  if (richMcTrackId == mcTrackId) return true;
590  }
591  return false;
592 }
593 
594 bool CbmRichRecoQa::WasRingMatched(Int_t mcTrackId) {
595  Int_t nofGlobalTracks = fGlobalTracks->GetEntriesFast();
596  for (Int_t iTrack = 0; iTrack < nofGlobalTracks; iTrack++) {
597  const CbmGlobalTrack* globalTrack =
598  static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(iTrack));
599 
600  Int_t richId = globalTrack->GetRichRingIndex();
601  if (richId < 0) continue;
602  const CbmTrackMatchNew* richRingMatch =
603  static_cast<const CbmTrackMatchNew*>(fRichRingMatches->At(richId));
604  if (richRingMatch == nullptr) continue;
605  int richMcTrackId = richRingMatch->GetMatchedLink().GetIndex();
606  if (richMcTrackId == mcTrackId) { return true; }
607  }
608 
609  return false;
610 }
611 
612 bool CbmRichRecoQa::HasRichProjection(Int_t stsTrackId) {
613  if (stsTrackId < 0) { return false; }
614  FairTrackParam* pTrack = (FairTrackParam*) fRichProjections->At(stsTrackId);
615  if (pTrack == nullptr) { return false; }
616 
617  if (pTrack->GetX() == 0. && pTrack->GetY() == 0.) {
618  return false;
619  } else {
620  return true;
621  }
622 }
623 
625  Int_t nofGlobalTracks = fGlobalTracks->GetEntriesFast();
626  for (Int_t iTrack = 0; iTrack < nofGlobalTracks; iTrack++) {
627  const CbmGlobalTrack* globalTrack =
628  static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(iTrack));
629 
630  Int_t stsId = globalTrack->GetStsTrackIndex();
631  Int_t richId = globalTrack->GetRichRingIndex();
632  if (stsId < 0 || richId < 0) continue;
633 
634  const CbmTrackMatchNew* stsTrackMatch =
635  static_cast<const CbmTrackMatchNew*>(fStsTrackMatches->At(stsId));
636  if (stsTrackMatch == nullptr) continue;
637  int stsMcTrackId = stsTrackMatch->GetMatchedLink().GetIndex();
638 
639  const CbmTrackMatchNew* richRingMatch =
640  static_cast<const CbmTrackMatchNew*>(fRichRingMatches->At(richId));
641  if (richRingMatch == nullptr) continue;
642  int richMcTrackId = richRingMatch->GetMatchedLink().GetIndex();
643  const CbmRichRing* ring =
644  static_cast<const CbmRichRing*>(fRichRings->At(richId));
645  if (nullptr == ring) continue;
646 
647  double rtDistance = CbmRichUtil::GetRingTrackDistance(iTrack);
648  double rtDistanceX = CbmRichUtil::GetRingTrackDistanceX(iTrack);
649  double rtDistanceY = CbmRichUtil::GetRingTrackDistanceY(iTrack);
650  double xc = ring->GetCenterX();
651  double yc = ring->GetCenterY();
652  int nofHits = ring->GetNofHits();
653 
654  CbmMCTrack* mctrack = static_cast<CbmMCTrack*>(fMCTracks->At(stsMcTrackId));
655  if (mctrack == nullptr) continue;
656  double mom = mctrack->GetP();
657  int charge = mctrack->GetCharge();
658 
659  bool isEl = IsMcPrimaryElectron(mctrack);
660  bool isPi = IsMcPion(mctrack);
661 
662  if (!isEl && !isPi) continue;
663 
664  string s = "";
665 
666  for (int i = 0; i < 2; i++) {
667  if (i == 0) {
668  if (isEl) {
669  s = "Primel";
670  } else if (isPi) {
671  s = "Pi";
672  } else {
673  continue;
674  }
675  } else if (i == 1) {
676  if (isEl) {
677  if (charge > 0) {
678  s = "PrimelPlus";
679  } else if (charge < 0) {
680  s = "PrimelMinus";
681  } else {
682  continue;
683  }
684  } else {
685  continue;
686  }
687  }
688 
689  if (stsMcTrackId == richMcTrackId) {
690  fHM->H2("fhRingTrackDistVsMomTruematch" + s)->Fill(mom, rtDistance);
691  fHM->H3("fhRingTrackDistVsXYTruematch" + s)->Fill(xc, yc, rtDistance);
692  fHM->H2("fhRingTrackDistVsXTruematch" + s)->Fill(xc, rtDistance);
693  fHM->H2("fhRingTrackDistVsYTruematch" + s)->Fill(abs(yc), rtDistance);
694  fHM->H2("fhRingTrackDistVsNofHitsTruematch" + s)
695  ->Fill(nofHits, rtDistance);
696 
697  Double_t rtX = -1 * rtDistanceX;
698  Double_t rtY = -1 * rtDistanceY;
699 
700  if (yc > 0) {
701  fHM->H3("fhRingTrackDistDiffXRingVsXYTruematchUp" + s)
702  ->Fill(xc, yc, rtDistanceX);
703  fHM->H3("fhRingTrackDistDiffYRingVsXYTruematchUp" + s)
704  ->Fill(xc, yc, rtDistanceY);
705  fHM->H3("fhRingTrackDistDiffXTrackVsXYTruematchUp" + s)
706  ->Fill(xc, yc, rtX);
707  fHM->H3("fhRingTrackDistDiffYTrackVsXYTruematchUp" + s)
708  ->Fill(xc, yc, rtY);
709  fHM->H3("fhRingTrackDistVsXYHalfUpTruematch" + s)
710  ->Fill(xc, yc, rtDistance);
711  }
712 
713  else if (yc < 0) {
714  fHM->H3("fhRingTrackDistDiffXRingVsXYTruematchDown" + s)
715  ->Fill(xc, yc, rtDistanceX);
716  fHM->H3("fhRingTrackDistDiffYRingVsXYTruematchDown" + s)
717  ->Fill(xc, yc, rtDistanceY);
718  fHM->H3("fhRingTrackDistDiffXTrackVsXYTruematchDown" + s)
719  ->Fill(xc, yc, rtX);
720  fHM->H3("fhRingTrackDistDiffYTrackVsXYTruematchDown" + s)
721  ->Fill(xc, yc, rtY);
722  fHM->H3("fhRingTrackDistVsXYHalfDownTruematch" + s)
723  ->Fill(xc, yc, rtDistance);
724  }
725 
726  //std::cout << "CbmRichRecoQa::FillRingTrackDistance:" << std::endl << "rtDistanceX & rtDistanceY = " << rtDistanceX << ", " << rtDistanceY << std::endl;
727 
728  if (i == 0 && isEl) {
729  //if (CbmLitGlobalElectronId::GetInstance().IsRichElectron(iTrack, mom)){
730  fHM->H2("fhRingTrackDistVsMomTruematchElId")->Fill(mom, rtDistance);
731  fHM->H3("fhRingTrackDistDiffXAfterEl")->Fill(xc, yc, rtDistanceX);
732  fHM->H3("fhRingTrackDistDiffYAfterEl")->Fill(xc, yc, rtDistanceY);
733  //}
734  }
735 
736  } else {
737  fHM->H2("fhRingTrackDistVsMomWrongmatch" + s)->Fill(mom, rtDistance);
738  }
739  }
740  }
741 }
742 
744  cout.precision(4);
745 
746 
748  //fHM->ScaleByPattern("fh_.*", 1./fEventNum);
749 
750  {
751  TCanvas* c =
752  fHM->CreateCanvas("fh_ring_track_distance_truematch_comparison_primel",
753  "fh_ring_track_distance_truematch_comparison_primel",
754  800,
755  800);
756  TH1D* py_minus =
757  (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchPrimelMinus")
758  ->ProjectionY("fhRingTrackDistVsMomTruematchPrimelMinus_py")
759  ->Clone());
760  py_minus->Scale(1. / py_minus->Integral());
761  TH1D* py_plus =
762  (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchPrimelPlus")
763  ->ProjectionY("fhRingTrackDistVsMomTruematchPrimelPlus_py")
764  ->Clone());
765  py_plus->Scale(1. / py_plus->Integral());
766  DrawH1(
767  {py_minus, py_plus},
768  {"e_{prim}^{-} (" + this->GetMeanRmsOverflowString(py_minus, false) + ")",
769  "e_{prim}^{+} (" + this->GetMeanRmsOverflowString(py_plus, false) + ")"},
770  kLinear,
771  kLog,
772  true,
773  0.5,
774  0.85,
775  0.99,
776  0.99);
777  }
778 
779  {
780  TCanvas* c =
781  fHM->CreateCanvas("fh_ring_track_distance_truematch_comparison_elpi",
782  "fh_ring_track_distance_truematch_comparison_elpi",
783  800,
784  800);
785  TH1D* py_el =
786  (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchPrimel")
787  ->ProjectionY("fhRingTrackDistVsMomTruematchPrimel_py")
788  ->Clone());
789  py_el->Scale(1. / py_el->Integral());
790  TH1D* py_pi = (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchPi")
791  ->ProjectionY("fhRingTrackDistVsMomTruematchPi_py")
792  ->Clone());
793  py_pi->Scale(1. / py_pi->Integral());
794  DrawH1(
795  {py_el, py_pi},
796  {"e_{prim}^{#pm} (" + this->GetMeanRmsOverflowString(py_el, false) + ")",
797  "#pi^{#pm} (" + this->GetMeanRmsOverflowString(py_pi, false) + ")"},
798  kLinear,
799  kLog,
800  true,
801  0.5,
802  0.85,
803  0.99,
804  0.99);
805  }
806 
807  {
808  gStyle->SetPaintTextFormat("4.1f");
809  TCanvas* c =
810  fHM->CreateCanvas("fh_mismatch_source", "fh_mismatch_source", 1000, 800);
811  Double_t nofMcEl = fHM->H1("fhMismatchSource")->GetBinContent(1);
812  cout << "nofMcEl = " << nofMcEl << endl;
813  fHM->H1("fhMismatchSource")->Scale(100. / nofMcEl);
814  DrawH1(fHM->H1("fhMismatchSource"), kLinear, kLog, "hist text");
815  fHM->H1("fhMismatchSource")->SetMarkerSize(1.9);
816 
817  vector<string> labels = {"MC",
818  "STS",
819  "STS-Acc RICH",
820  "STS-RICH",
821  "STS-RICH true",
822  "STS-NoRICH",
823  "STS-NoRICH RF",
824  "STS-NoRICH RM",
825  "STS-NoRICH NoRF",
826  "STS-NoRICH NoPrj",
827  "STS-RICH wrong",
828  "STS-RICH wrong RF",
829  "STS-RICH wrong RM"};
830  for (int i = 0; i < labels.size(); i++) {
831  fHM->H1("fhMismatchSource")
832  ->GetXaxis()
833  ->SetBinLabel(i + 1, labels[i].c_str());
834  }
835  fHM->H1("fhMismatchSource")->GetXaxis()->SetLabelSize(0.03);
836  }
837 
838  {
839  TCanvas* c = fHM->CreateCanvas(
840  "fh_mismatch_source_mom", "fh_mismatch_source_mom", 1000, 800);
841  vector<string> labels = {"MC",
842  "STS",
843  "STS-Acc RICH",
844  "STS-RICH",
845  "STS-RICH true",
846  "STS-NoRICH",
847  "STS-NoRICH RF",
848  "STS-NoRICH RM",
849  "STS-NoRICH NoRF",
850  "STS-NoRICH NoPrj",
851  "STS-RICH wrong",
852  "STS-RICH wrong RF",
853  "STS-RICH wrong RM"};
854  vector<TH1*> hists = {fHM->H1("fhMismatchSourceMomMc"),
855  fHM->H1("fhMismatchSourceMomSts"),
856  fHM->H1("fhMismatchSourceMomStsAccRich"),
857  fHM->H1("fhMismatchSourceMomStsRich"),
858  fHM->H1("fhMismatchSourceMomStsRichTrue"),
859  fHM->H1("fhMismatchSourceMomStsNoRich"),
860  fHM->H1("fhMismatchSourceMomStsNoRichRF"),
861  fHM->H1("fhMismatchSourceMomStsNoRichRM"),
862  fHM->H1("fhMismatchSourceMomStsNoRichNoRF"),
863  fHM->H1("fhMismatchSourceMomStsNoRichNoProj"),
864  fHM->H1("fhMismatchSourceMomStsRichWrong"),
865  fHM->H1("fhMismatchSourceMomStsRichWrongRF"),
866  fHM->H1("fhMismatchSourceMomStsRichWrongRM")};
867 
868  DrawH1(hists, labels, kLinear, kLog, true, 0.8, 0.35, 0.99, 0.99);
869  fHM->H1("fhMismatchSourceMomMc")->SetMinimum(0.9);
870  }
871 
873  DrawRingTrackDistHistWithSuffix("PrimelPlus");
874  DrawRingTrackDistHistWithSuffix("PrimelMinus");
875  //DrawRingTrackDistHistWithSuffix("Pi");
876 
878  //DrawRingTrackDistHistWithSuffixPmtHalf("PrimelPlus");
879  //DrawRingTrackDistHistWithSuffixPmtHalf("PrimelMinus");
880  //DrawRingTrackDistHistWithSuffixPmtHalf("Pi");
881 
882  // before and after electron identification
883  {
884  TCanvas* c = fHM->CreateCanvas("fh_ring_track_distance_truematch_elid",
885  "fh_ring_track_distance_truematch_elid",
886  1400,
887  1400);
888  c->Divide(2, 2);
889  c->cd(1);
891  fHM->H2("fhRingTrackDistVsMomTruematchPrimel"), false, true);
892  fHM->H2("fhRingTrackDistVsMomTruematchPrimel")
893  ->GetYaxis()
894  ->SetRangeUser(0., 2.);
895  c->cd(2);
897  fHM->H2("fhRingTrackDistVsMomTruematchElId"), false, true);
898  fHM->H2("fhRingTrackDistVsMomTruematchElId")
899  ->GetYaxis()
900  ->SetRangeUser(0., 2.);
901  c->cd(3);
902  TH1D* py =
903  (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchPrimel")
904  ->ProjectionY(
905  string("fhRingTrackDistVsMomTruematchPrimel_py2").c_str())
906  ->Clone());
907  TH1D* pyElId =
908  (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchElId")
909  ->ProjectionY(
910  string("fhRingTrackDistVsMomTruematchElId_py").c_str())
911  ->Clone());
912  TH1D* pyElId2 = (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematchElId")
913  ->ProjectionY("test_py", 0, 40));
914  // DrawH1({py, pyElId}, {string("before ElId (" + this->GetMeanRmsOverflowString(py) + ")"), string("after ElId (" + this->GetMeanRmsOverflowString(pyElId) + ")")},
915  // kLinear, kLog, true, 0.45, 0.2, 0.9, 0.35);
916  DrawH1({py},
917  {string("before ElId (" + this->GetMeanRmsOverflowString(py) + ")")},
918  kLinear,
919  kLog,
920  false,
921  0.45,
922  0.2,
923  0.9,
924  0.35);
925  c->cd(4);
926  DrawH1(
927  {pyElId},
928  {string("after ElId (" + this->GetMeanRmsOverflowString(pyElId) + ")")},
929  kLinear,
930  kLog,
931  false,
932  0.45,
933  0.2,
934  0.9,
935  0.35);
936  }
937 
938  Double_t range = 2.5;
939  {
940  TCanvas* c = fHM->CreateCanvas(
941  "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_after_el",
942  "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_after_el",
943  1800,
944  600);
945  c->Divide(2, 1);
946  c->cd(1);
948  fHM->H3("fhRingTrackDistDiffXAfterEl"), true, false, -range, range);
949  c->cd(2);
951  fHM->H3("fhRingTrackDistDiffYAfterEl"), true, false, -range, range);
952  }
953 }
954 
955 string CbmRichRecoQa::GetMeanRmsOverflowString(TH1* h, Bool_t withOverflow) {
956  if (withOverflow) {
957  double overflow = h->GetBinContent(h->GetNbinsX() + 1);
958  return Cbm::NumberToString<Double_t>(h->GetMean(), 2) + " / "
959  + Cbm::NumberToString<Double_t>(h->GetRMS(), 2) + " / "
960  + Cbm::NumberToString<Double_t>(
961  100. * overflow / h->Integral(0, h->GetNbinsX() + 1), 2)
962  + "%";
963  } else {
964  return Cbm::NumberToString<Double_t>(h->GetMean(), 2) + " / "
965  + Cbm::NumberToString<Double_t>(h->GetRMS(), 2);
966  }
967 }
968 
970  {
971  TCanvas* c = fHM->CreateCanvas("fh_ring_track_distance_truematch_" + s,
972  "fh_ring_track_distance_truematch_" + s,
973  1800,
974  600);
975  c->Divide(3, 1);
976  c->cd(1);
978  fHM->H2("fhRingTrackDistVsMomTruematch" + s), false, true);
979  c->cd(2);
981  fHM->H2("fhRingTrackDistVsNofHitsTruematch" + s), false, true);
982  c->cd(3);
983  TH1D* py =
984  (TH1D*) (fHM->H2("fhRingTrackDistVsMomTruematch" + s)
985  ->ProjectionY(("fhRingTrackDistVsMomTruematch_py" + s).c_str())
986  ->Clone());
987  DrawH1(py);
988  DrawTextOnPad(this->GetMeanRmsOverflowString(py), 0.2, 0.9, 0.8, 0.99);
989  gPad->SetLogy(true);
990 
991  fHM->H2("fhRingTrackDistVsMomTruematch" + s)
992  ->GetYaxis()
993  ->SetRangeUser(0., 2.);
994  fHM->H2("fhRingTrackDistVsNofHitsTruematch" + s)
995  ->GetYaxis()
996  ->SetRangeUser(0., 2.);
997  }
998 
999  {
1000  TCanvas* c = fHM->CreateCanvas("fh_ring_track_distance_wrongmatch" + s,
1001  "fh_ring_track_distance_wrongmatch" + s,
1002  600,
1003  600);
1004  TH1D* py = (TH1D*) (fHM->H2("fhRingTrackDistVsMomWrongmatch" + s)
1005  ->ProjectionY(
1006  ("fhRingTrackDistVsMomWrongmatch_py" + s).c_str())
1007  ->Clone());
1008  DrawH1(py);
1009  DrawTextOnPad(this->GetMeanRmsOverflowString(py), 0.2, 0.9, 0.8, 0.99);
1010  gPad->SetLogy(true);
1011  }
1012 
1013  {
1014  TCanvas* c = fHM->CreateCanvas("fh_ring_track_distance_vs_xy_truematch" + s,
1015  "fh_ring_track_distance_vs_xy_truematch" + s,
1016  1800,
1017  600);
1018  c->Divide(3, 1);
1019  c->cd(1);
1020  DrawH3Profile(
1021  fHM->H3("fhRingTrackDistVsXYTruematch" + s), true, false, 0., 2.);
1022  c->cd(2);
1023  DrawH2WithProfile(fHM->H2("fhRingTrackDistVsXTruematch" + s), false, true);
1024  fHM->H2("fhRingTrackDistVsXTruematch" + s)
1025  ->GetYaxis()
1026  ->SetRangeUser(0., 1.5);
1027  c->cd(3);
1028  DrawH2WithProfile(fHM->H2("fhRingTrackDistVsYTruematch" + s), false, true);
1029  fHM->H2("fhRingTrackDistVsYTruematch" + s)
1030  ->GetYaxis()
1031  ->SetRangeUser(0., 1.5);
1032  }
1033 }
1034 
1036  {
1037  TCanvas* c =
1038  fHM->CreateCanvas("fh_ring_track_distance_vs_xy_truematch_half_" + s,
1039  "fh_ring_track_distance_vs_xy_truematch_half_" + s,
1040  1800,
1041  600);
1042  c->Divide(2, 1);
1043  TH3D* h1 = (TH3D*) fHM->H3("fhRingTrackDistVsXYTruematch" + s)->Clone();
1044  TH3D* h2 = (TH3D*) fHM->H3("fhRingTrackDistVsXYTruematch" + s)->Clone();
1045  c->cd(1);
1046  h1->GetYaxis()->SetRangeUser(110., 200.);
1047  DrawH3Profile(h1, true, false, 0., 2.);
1048  c->cd(2);
1049  h2->GetYaxis()->SetRangeUser(-200., -110.);
1050  DrawH3Profile(h2, true, false, 0., 2.);
1051  }
1052 
1053  {
1054  TCanvas* c = fHM->CreateCanvas(
1055  "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_projection_" + s,
1056  "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_projection_" + s,
1057  1800,
1058  600);
1059  c->Divide(2, 1);
1060  TH3D* h1 = (TH3D*) fHM->H3("fhRingTrackDistVsXYTruematch" + s)->Clone();
1061  c->cd(1);
1062  TH2D* h2 = (TH2D*) h1->Project3D("yx")->Clone();
1063  h2->GetYaxis()->SetRangeUser(110., 200.);
1064  h2->Scale(1. / .15);
1065  h2->Draw("colz");
1066  c->cd(2);
1067  TH2D* h3 = (TH2D*) h1->Project3D("yx")->Clone();
1068  h3->GetYaxis()->SetRangeUser(-200., -110.);
1069  h3->Scale(1. / .15);
1070  h3->Draw("colz");
1071  }
1072 
1073  Double_t range = 1.;
1074  {
1075  TCanvas* c = fHM->CreateCanvas(
1076  "fh_ring_track_distance_diff_x_y_ring_vs_xy_truematch_up_" + s,
1077  "fh_ring_track_distance_diff_x_y_ring_vs_xy_truematch_up_" + s,
1078  1800,
1079  600);
1080  c->Divide(2, 1);
1081  c->cd(1);
1082  DrawH3Profile(fHM->H3("fhRingTrackDistDiffXRingVsXYTruematchUp" + s),
1083  true,
1084  false,
1085  -range,
1086  range);
1087  c->cd(2);
1088  DrawH3Profile(fHM->H3("fhRingTrackDistDiffYRingVsXYTruematchUp" + s),
1089  true,
1090  false,
1091  -range,
1092  range);
1093  }
1094 
1095  {
1096  TCanvas* c = fHM->CreateCanvas(
1097  "fh_ring_track_distance_diff_x_y_ring_vs_xy_truematch_down_" + s,
1098  "fh_ring_track_distance_diff_x_y_ring_vs_xy_truematch_down_" + s,
1099  1800,
1100  600);
1101  c->Divide(2, 1);
1102  c->cd(1);
1103  DrawH3Profile(fHM->H3("fhRingTrackDistDiffXRingVsXYTruematchDown" + s),
1104  true,
1105  false,
1106  -range,
1107  range);
1108  c->cd(2);
1109  DrawH3Profile(fHM->H3("fhRingTrackDistDiffYRingVsXYTruematchDown" + s),
1110  true,
1111  false,
1112  -range,
1113  range);
1114  }
1115 
1116  /* {
1117  TCanvas* c = fHM->CreateCanvas("fh_track_ring_distance_diff_x_y_ring_single_vs_xy_truematch"+s, "fh_track_ring_distance_diff_x_y_ring_single_vs_xy_truematch"+s, 1800, 600);
1118  c->Divide(2, 2);
1119  c->cd(1);
1120  DrawH3Profile(fHM->H3("fhRingTrackDistDiffXRingVsXYTruematch"+s), true, false, 0, 2*range);
1121  c->cd(2);
1122  DrawH3Profile(fHM->H3("fhRingTrackDistDiffXRingVsXYTruematch"+s), true, false, -2*range, 0);
1123  c->cd(3);
1124  DrawH3Profile(fHM->H3("fhRingTrackDistDiffYRingVsXYTruematch"+s), true, false, 0, 2*range);
1125  c->cd(4);
1126  DrawH3Profile(fHM->H3("fhRingTrackDistDiffYRingVsXYTruematch"+s), true, false, -2*range, 0);
1127  }
1128 */
1129  {
1130  TCanvas* c = fHM->CreateCanvas(
1131  "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_up_" + s,
1132  "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_up_" + s,
1133  1800,
1134  600);
1135  c->Divide(2, 1);
1136  c->cd(1);
1137  DrawH3Profile(fHM->H3("fhRingTrackDistDiffXTrackVsXYTruematchUp" + s),
1138  true,
1139  false,
1140  -range,
1141  range);
1142  c->cd(2);
1143  DrawH3Profile(fHM->H3("fhRingTrackDistDiffYTrackVsXYTruematchUp" + s),
1144  true,
1145  false,
1146  -range,
1147  range);
1148  }
1149 
1150  {
1151  TCanvas* c = fHM->CreateCanvas(
1152  "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_down_" + s,
1153  "fh_track_ring_distance_diff_x_y_track_vs_xy_truematch_down_" + s,
1154  1800,
1155  600);
1156  c->Divide(2, 1);
1157  c->cd(1);
1158  DrawH3Profile(fHM->H3("fhRingTrackDistDiffXTrackVsXYTruematchDown" + s),
1159  true,
1160  false,
1161  -range,
1162  range);
1163  c->cd(2);
1164  DrawH3Profile(fHM->H3("fhRingTrackDistDiffYTrackVsXYTruematchDown" + s),
1165  true,
1166  false,
1167  -range,
1168  range);
1169  }
1170 
1171  {
1172  TCanvas* c =
1173  fHM->CreateCanvas("fh_track_ring_distance_vs_xy_truematch_halves_" + s,
1174  "fh_track_ring_distance_vs_xy_truematch_halves_" + s,
1175  1800,
1176  600);
1177  c->Divide(2, 1);
1178  c->cd(1);
1179  DrawH3Profile(fHM->H3("fhRingTrackDistVsXYHalfUpTruematch" + s),
1180  true,
1181  false,
1182  0.,
1183  range);
1184  c->cd(2);
1185  DrawH3Profile(fHM->H3("fhRingTrackDistVsXYHalfDownTruematch" + s),
1186  true,
1187  false,
1188  0.,
1189  range);
1190  }
1191 }
1192 
1194  if (mctrack == nullptr) return false;
1195  int pdg = TMath::Abs(mctrack->GetPdgCode());
1196  if (mctrack->GetGeantProcessId() == kPPrimary && pdg == 11) return true;
1197  return false;
1198 }
1199 
1200 bool CbmRichRecoQa::IsMcPion(const CbmMCTrack* mctrack) {
1201  if (mctrack == nullptr) return false;
1202  int pdg = TMath::Abs(mctrack->GetPdgCode());
1203  if (pdg == 211) return true;
1204  return false;
1205 }
1206 
1208  DrawHist();
1209 
1210  TDirectory* oldir = gDirectory;
1211  TFile* outFile = FairRootManager::Instance()->GetOutFile();
1212  if (outFile != NULL) {
1213  fHM->WriteToFile();
1214  // fHM->WriteToFileNew(fOutputDir + "/histos.root");
1215  }
1216  gDirectory->cd(oldir->GetPath());
1217 
1219  //fHM->H3("fhRingTrackDistVsXYTruematchPrimel")->Write();
1220 }
1221 
1222 void CbmRichRecoQa::DrawFromFile(const string& fileName,
1223  const string& outputDir) {
1224  fOutputDir = outputDir;
1225 
1226  if (fHM != nullptr) delete fHM;
1227 
1228  fHM = new CbmHistManager();
1229  TFile* file = new TFile(fileName.c_str());
1230  fHM->ReadFromFile(file);
1231 
1232  DrawHist();
1233 
1235 }
1236 
CbmRichRecoQa::WasRingMatched
bool WasRingMatched(Int_t mcTrackId)
Definition: alignment/CbmRichRecoQa.cxx:594
CbmRichPoint.h
CbmMatch::GetMatchedLink
const CbmLink & GetMatchedLink() const
Definition: CbmMatch.h:37
h
Generates beam ions for transport simulation.
Definition: CbmBeamGenerator.h:17
CbmRichRecoQa::fGlobalTracks
TClonesArray * fGlobalTracks
Definition: alignment/CbmRichRecoQa.h:148
CbmHistManager::WriteToFile
void WriteToFile()
Write all histograms to current opened file.
Definition: core/base/CbmHistManager.cxx:103
CbmRichRecoQa::fStsTracks
TClonesArray * fStsTracks
Definition: alignment/CbmRichRecoQa.h:149
CbmHistManager::Create3
void Create3(const std::string &name, const std::string &title, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY, Int_t nofBinsZ, Double_t minBinZ, Double_t maxBinZ)
Helper function for creation of 3-dimensional histograms and profiles. Template argument is a real ob...
Definition: CbmHistManager.h:140
CbmRichRecoQa::fEventNum
Int_t fEventNum
Definition: alignment/CbmRichRecoQa.h:138
CbmRichRecoQa::fOutputDir
string fOutputDir
Definition: alignment/CbmRichRecoQa.h:140
CbmHistManager::ReadFromFile
void ReadFromFile(TFile *file)
Read histograms from file.
Definition: core/base/CbmHistManager.cxx:110
DrawH3Profile
TH2D * DrawH3Profile(TH3 *h, Bool_t drawMean, Bool_t doGaussFit, Double_t zMin, Double_t zMax)
Definition: CbmDrawHist.cxx:369
CbmRichRecoQa::IsMcPion
static Bool_t IsMcPion(const CbmMCTrack *mctrack)
Definition: alignment/CbmRichRecoQa.cxx:1200
CbmRichUtil.h
CbmHistManager::Create2
void Create2(const std::string &name, const std::string &title, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY)
Helper function for creation of 2-dimensional histograms and profiles. Template argument is a real ob...
Definition: CbmHistManager.h:104
CbmGlobalTrack::GetRichRingIndex
Int_t GetRichRingIndex() const
Definition: CbmGlobalTrack.h:41
CbmMCTrack::GetPdgCode
Int_t GetPdgCode() const
Definition: CbmMCTrack.h:70
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmHistManager::H2
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
Definition: CbmHistManager.h:190
CbmGlobalTrack.h
CbmRichRing::GetNofHits
Int_t GetNofHits() const
Definition: CbmRichRing.h:40
CbmRichRing
Definition: CbmRichRing.h:17
CbmRichRecoQa
Definition: alignment/CbmRichRecoQa.h:21
CbmRichRecoQa::FillRichRingNofHits
void FillRichRingNofHits()
Fill map mcTrackId -> nof RICH hits.
Definition: alignment/CbmRichRecoQa.cxx:450
CbmRichRing.h
CbmDrawHist.h
Helper functions for drawing 1D and 2D histograms and graphs.
CbmRichDraw.h
CbmHistManager.h
Histogram manager.
CbmMatchRecoToMC.h
FairTask for matching RECO data to MC.
CbmHistManager::H3
TH3 * H3(const std::string &name) const
Return pointer to TH3 histogram.
Definition: CbmHistManager.h:210
CbmRichRecoQa::fMCTracks
TClonesArray * fMCTracks
Definition: alignment/CbmRichRecoQa.h:142
CbmMCTrack::GetCharge
Double_t GetCharge() const
Charge of the associated particle.
Definition: CbmMCTrack.cxx:146
CbmRichGeoManager.h
CbmRichRecoQa::fRichRings
TClonesArray * fRichRings
Definition: alignment/CbmRichRecoQa.h:146
CbmRichUtil::GetRingTrackDistance
static Double_t GetRingTrackDistance(Int_t globalTrackId)
Definition: alignment/CbmRichUtil.h:20
DrawTextOnPad
void DrawTextOnPad(const string &text, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: CbmDrawHist.cxx:253
DrawH1
void DrawH1(TH1 *hist, HistScale logx, HistScale logy, const string &drawOpt, Int_t color, Int_t lineWidth, Int_t lineStyle, Int_t markerSize, Int_t markerStyle)
Definition: CbmDrawHist.cxx:49
CbmGlobalTrack::GetStsTrackIndex
Int_t GetStsTrackIndex() const
Definition: CbmGlobalTrack.h:38
CbmHistManager
Histogram manager.
Definition: CbmHistManager.h:41
CbmRichRecoQa::DrawRingTrackDistHistWithSuffixPmtHalf
void DrawRingTrackDistHistWithSuffixPmtHalf(const string &suffix)
Definition: alignment/CbmRichRecoQa.cxx:1035
CbmRichRecoQa::DrawFromFile
void DrawFromFile(const string &fileName, const string &outputDir)
Draw histogram from file.
Definition: alignment/CbmRichRecoQa.cxx:1222
CbmRichRecoQa::fRichHits
TClonesArray * fRichHits
Definition: alignment/CbmRichRecoQa.h:145
CbmRichRecoQa.h
CbmRichRecoQa::WasRingFound
bool WasRingFound(Int_t mcTrackId)
Definition: alignment/CbmRichRecoQa.cxx:579
kLinear
@ kLinear
Definition: CbmDrawHist.h:79
CbmTrackMatchNew.h
CbmRichRecoQa::GetMeanRmsOverflowString
string GetMeanRmsOverflowString(TH1 *h, Bool_t withOverflow=true)
Return string with mean, RMS and overflow percent for input TH1.
Definition: alignment/CbmRichRecoQa.cxx:955
CbmMatchRecoToMC::GetMcTrackMotherIdsForRichHit
static std::vector< std::pair< Int_t, Int_t > > GetMcTrackMotherIdsForRichHit(CbmDigiManager *digiMan, const CbmRichHit *hit, CbmMCDataArray *richPoints, CbmMCDataArray *mcTracks, Int_t eventNumber)
Return McTrack Ids for RICH hit C++11 efficient way to return vector.
Definition: CbmMatchRecoToMC.cxx:821
CbmRichRecoQa::Finish
virtual void Finish()
Inherited from FairTask.
Definition: alignment/CbmRichRecoQa.cxx:1207
DrawH2WithProfile
void DrawH2WithProfile(TH2 *hist, Bool_t doGaussFit, Bool_t drawOnlyMean, const string &drawOpt2D, Int_t profileColor, Int_t profileLineWidth)
Definition: CbmDrawHist.cxx:296
CbmHistManager::Create1
void Create1(const std::string &name, const std::string &title, Int_t nofBins, Double_t minBin, Double_t maxBin)
Helper function for creation of 1-dimensional histograms and profiles. Template argument is a real ob...
Definition: CbmHistManager.h:81
CbmRichRecoQa::fStsTrackMatches
TClonesArray * fStsTrackMatches
Definition: alignment/CbmRichRecoQa.h:150
CbmRichRecoQa::DrawHist
void DrawHist()
Draw histograms.
Definition: alignment/CbmRichRecoQa.cxx:743
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmMCTrack::GetGeantProcessId
UInt_t GetGeantProcessId() const
Definition: CbmMCTrack.h:69
CbmRichRecoQa::fCorrection
string fCorrection
Definition: alignment/CbmRichRecoQa.h:156
CbmRichRecoQa::fHM
CbmHistManager * fHM
Definition: alignment/CbmRichRecoQa.h:136
CbmRichRecoQa::CbmRichRecoQa
CbmRichRecoQa()
Standard constructor.
Definition: alignment/CbmRichRecoQa.cxx:40
CbmHistManager::H1
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
Definition: CbmHistManager.h:170
CbmRichRecoQa::InitHistograms
void InitHistograms()
Initialize histograms.
Definition: alignment/CbmRichRecoQa.cxx:115
CbmRichRecoQa::FillRingTrackDistance
void FillRingTrackDistance()
Fill histogramms related to ring track distance.
Definition: alignment/CbmRichRecoQa.cxx:624
CbmRichRecoQa::fRichDigis
TClonesArray * fRichDigis
Definition: alignment/CbmRichRecoQa.h:144
CbmUtils.h
CbmHistManager::CreateCanvas
TCanvas * CreateCanvas(const std::string &name, const std::string &title, Int_t width, Int_t height)
Create and draw TCanvas and store pointer to it.
Definition: core/base/CbmHistManager.cxx:267
CbmHistManager::SaveCanvasToImage
void SaveCanvasToImage(const std::string &outputDir, const std::string &options="png,eps")
Save all stored canvases to images.
Definition: core/base/CbmHistManager.cxx:276
CbmRichRecoQa::RingTrackMismatchSource
void RingTrackMismatchSource()
Fill histograms related to study of the source of ring-track mismatch.
Definition: alignment/CbmRichRecoQa.cxx:465
CbmRichUtil::GetRingTrackDistanceX
static Double_t GetRingTrackDistanceX(Int_t globalTrackId)
Definition: alignment/CbmRichUtil.h:25
CbmRichRecoQa::Init
virtual InitStatus Init()
Inherited from FairTask.
Definition: alignment/CbmRichRecoQa.cxx:59
CbmGlobalTrack
Definition: CbmGlobalTrack.h:26
CbmRichRecoQa::IsMcPrimaryElectron
static Bool_t IsMcPrimaryElectron(const CbmMCTrack *mctrack)
Definition: alignment/CbmRichRecoQa.cxx:1193
CbmMCTrack.h
CbmRichRecoQa::DrawRingTrackDistHistWithSuffix
void DrawRingTrackDistHistWithSuffix(const string &suffix)
Draw histograms related to ring-track distance for pions or electrons (+/-).
Definition: alignment/CbmRichRecoQa.cxx:969
CbmMCTrack
Definition: CbmMCTrack.h:34
CbmRichRecoQa::Exec
virtual void Exec(Option_t *option)
Inherited from FairTask.
Definition: alignment/CbmRichRecoQa.cxx:441
CbmRichRecoQa::fRichProjections
TClonesArray * fRichProjections
Definition: alignment/CbmRichRecoQa.h:151
CbmRichRing::GetCenterY
Float_t GetCenterY() const
Definition: CbmRichRing.h:81
CbmRichRecoQa::fRichPoints
TClonesArray * fRichPoints
Definition: alignment/CbmRichRecoQa.h:143
CbmTrackMatchNew
Definition: CbmTrackMatchNew.h:19
SetDefaultDrawStyle
void SetDefaultDrawStyle()
Definition: CbmDrawHist.cxx:33
CbmLitGlobalElectronId.h
CbmRichHit.h
CbmRichUtil::GetRingTrackDistanceY
static Double_t GetRingTrackDistanceY(Int_t globalTrackId)
Definition: alignment/CbmRichUtil.h:30
CbmRichRecoQa::fRichRingMatches
TClonesArray * fRichRingMatches
Definition: alignment/CbmRichRecoQa.h:147
CbmRichRecoQa::fNofHitsInRingMap
std::map< Int_t, Int_t > fNofHitsInRingMap
Definition: alignment/CbmRichRecoQa.h:154
CbmMCTrack::GetP
Double_t GetP() const
Definition: CbmMCTrack.h:100
kLog
@ kLog
Definition: CbmDrawHist.h:78
CbmRichRing::GetCenterX
Float_t GetCenterX() const
Definition: CbmRichRing.h:80
CbmRichHit
Definition: CbmRichHit.h:19
CbmRichRecoQa::HasRichProjection
bool HasRichProjection(Int_t stsTrackId)
Definition: alignment/CbmRichRecoQa.cxx:612