CbmRoot
CbmLitTrackingQaReport.cxx
Go to the documentation of this file.
1 
7 #include "CbmDrawHist.h"
8 #include "CbmHistManager.h"
9 #include "CbmReportElement.h"
10 #include "CbmUtils.h"
11 #include "TCanvas.h"
12 #include "TH1.h"
13 #include "TLine.h"
14 #include <boost/assign/list_of.hpp>
15 #include <set>
16 #include <vector>
17 
18 using boost::assign::list_of;
21 using Cbm::Split;
22 using std::endl;
23 using std::make_pair;
24 using std::map;
25 using std::pair;
26 using std::set;
27 using std::vector;
28 
29 string DefaultEfficiencyLabelFormatter(const string& histName,
30  Double_t efficiency) {
31  vector<string> split = Split(histName, '_');
32  return split[1] + ":" + split[3] + "("
33  + NumberToString<Double_t>(efficiency, 1) + ")";
34 }
35 
36 string ElectronIdEfficiencyLabelFormatter(const string& histName,
37  Double_t efficiency) {
38  vector<string> split = Split(histName, '_');
39  return FindAndReplace(split[1], "Sts", "") + " ("
40  + NumberToString<Double_t>(efficiency, 1) + ")";
41 }
42 
43 string DefaultPionSuppressionLabelFormatter(const string& histName,
44  Double_t efficiency) {
45  vector<string> split = Split(histName, '_');
46  return split[1] + " (" + NumberToString<Double_t>(efficiency, 1) + ")";
47 }
48 
50  : CbmSimulationReport(), fGlobalTrackVariants() {
51  SetReportName("tracking_qa");
52 }
53 
55 
57  Out().precision(3);
58  Out() << R()->DocumentBegin();
59  Out() << R()->Title(0, GetTitle());
60 
61  Out() << "Number of events: "
62  << HM()->H1("hen_EventNo_TrackingQa")->GetEntries() << endl;
63 
64  Out() << PrintNofObjects();
65  Out() << PrintTrackHits();
66  Out() << PrintNofGhosts();
67  Out() << PrintTrackingEfficiency(false, false);
68  Out() << PrintTrackingEfficiency(true, false);
69  Out() << PrintTrackingEfficiency(false, true);
70  Out() << PrintTrackingEfficiency(true, true);
72 
73  PrintCanvases();
74 
75  Out() << R()->DocumentEnd();
76 }
77 
79  vector<TH1*> histos = HM()->H1Vector("hno_NofObjects_.+");
80  Int_t nofHistos = histos.size();
81  string str =
82  R()->TableBegin("Number of objects per event", list_of("Name")("Value"));
83  for (Int_t iHist = 0; iHist < nofHistos; iHist++) {
84  string cellName = Split(histos[iHist]->GetName(), '_')[2];
85  str += R()->TableRow(
86  list_of(cellName)(NumberToString<Int_t>(histos[iHist]->GetMean())));
87  }
88  str += R()->TableEnd();
89  return str;
90 }
91 
93  vector<TH1*> histos = HM()->H1Vector("hth_.+_TrackHits_All");
94  Int_t nofHistos = histos.size();
95  string str =
96  R()->TableBegin("Number of all, true and fake hits in tracks and rings",
97  list_of("")("all")("true")("fake")("true/all")("fake/all"));
98  for (Int_t iHist = 0; iHist < nofHistos; iHist++) {
99  string name = histos[iHist]->GetName();
100  string cellName = Split(name, '_')[1];
101  string all = NumberToString<Double_t>(histos[iHist]->GetMean(), 2);
102  string trueh = NumberToString<Double_t>(
103  HM()->H1(FindAndReplace(name, "_All", "_True"))->GetMean(), 2);
104  string fakeh = NumberToString<Double_t>(
105  HM()->H1(FindAndReplace(name, "_All", "_Fake"))->GetMean(), 2);
106  string toa = NumberToString<Double_t>(
107  HM()->H1(FindAndReplace(name, "_All", "_TrueOverAll"))->GetMean(), 2);
108  string foa = NumberToString<Double_t>(
109  HM()->H1(FindAndReplace(name, "_All", "_FakeOverAll"))->GetMean(), 2);
110  str += R()->TableRow(list_of(cellName)(all)(trueh)(fakeh)(toa)(foa));
111  }
112  str += R()->TableEnd();
113  return str;
114 }
115 
117  Double_t nofEvents = HM()->H1("hen_EventNo_TrackingQa")->GetEntries();
118  vector<TH1*> histos = HM()->H1Vector("hng_NofGhosts_.+");
119  Int_t nofHistos = histos.size();
120  string str =
121  R()->TableBegin("Number of ghosts per event", list_of("Name")("Value"));
122  for (Int_t iHist = 0; iHist < nofHistos; iHist++) {
123  string cellName = Split(histos[iHist]->GetName(), '_')[2];
124  str += R()->TableRow(list_of(cellName)(
125  NumberToString<Double_t>(histos[iHist]->GetEntries() / nofEvents, 2)));
126  }
127  str += R()->TableEnd();
128  return str;
129 }
130 
131 string
133  Bool_t isPidEfficiency) const {
134  // If includeRich == true than search for tracking efficiency histograms which contain "Rich"
135  // otherwise search for tracking efficiency histograms excluding those which contain "Rich"
136  string effRegex = "";
137  if (!isPidEfficiency)
138  effRegex = (includeRich) ? "hte_.*Rich.*_Eff_p" : "hte_((?!Rich).)*_Eff_p";
139  else
140  effRegex = (includeRich) ? "hpe_.*Rich.*_Eff_p" : "hpe_((?!Rich).)*_Eff_p";
141 
142  vector<TH1*> histos = HM()->H1Vector(effRegex);
143  Int_t nofHistos = histos.size();
144  if (nofHistos == 0) return "";
145 
146  // Find track and ring categories from the histogram names
147  map<string, Int_t> catToCell;
148  for (Int_t iHist = 0; iHist < nofHistos; iHist++) {
149  string effName = histos[iHist]->GetName();
150  pair<string, Int_t> tmp =
151  make_pair(Split(effName, '_')[3], catToCell.size());
152  catToCell.insert(tmp);
153  }
154  Int_t nofCats = catToCell.size();
155  Int_t nofRows = nofHistos / nofCats;
156 
157  vector<string> cat(nofCats);
158  map<string, Int_t>::const_iterator it;
159  for (it = catToCell.begin(); it != catToCell.end(); it++) {
160  cat[(*it).second] = (*it).first;
161  }
162 
163  Int_t nofEvents = HM()->H1("hen_EventNo_TrackingQa")->GetEntries();
164  string tableTitle =
165  (isPidEfficiency) ? "PID efficiency" : "Tracking efficiency";
166  if (includeRich)
167  tableTitle += " (with RICH)";
168  else
169  tableTitle += " (without RICH)";
170 
171  string str = R()->TableBegin(tableTitle, list_of(string("")).range(cat));
172  Int_t histCounter = 0;
173  for (Int_t iRow = 0; iRow < nofRows; iRow++) {
174  vector<string> cells(nofCats);
175  string rowName;
176  for (Int_t iCat = 0; iCat < nofCats; iCat++) {
177  string effName = histos[histCounter]->GetName();
178  string accName = FindAndReplace(effName, "_Eff_", "_Acc_");
179  string recName = FindAndReplace(effName, "_Eff_", "_Rec_");
180  Double_t acc = HM()->H1(accName)->GetEntries() / nofEvents;
181  Double_t rec = HM()->H1(recName)->GetEntries() / nofEvents;
182  Double_t eff = (acc != 0.) ? 100. * rec / acc : 0.;
183  string accStr = NumberToString<Double_t>(acc, 2);
184  string recStr = NumberToString<Double_t>(rec, 2);
185  string effStr = NumberToString<Double_t>(eff);
186  vector<string> split = Split(effName, '_');
187  cells[catToCell[split[3]]] = effStr + "(" + recStr + "/" + accStr + ")";
188  histCounter++;
189  rowName = split[1] + " (" + split[2] + ")";
190  }
191  str += R()->TableRow(list_of(rowName).range(cells));
192  }
193  str += R()->TableEnd();
194  return str;
195 }
196 
198  vector<TH1*> histos = HM()->H1Vector("hps_.*_PionSup_p");
199  Int_t nofHistos = histos.size();
200  if (nofHistos == 0) return "";
201 
202  Int_t nofEvents = HM()->H1("hen_EventNo_TrackingQa")->GetEntries();
203  string str = R()->TableBegin("Pion suppression",
204  list_of(string(""))("Pion suppression"));
205  for (Int_t iHist = 0; iHist < nofHistos; iHist++) {
206  string psName = histos[iHist]->GetName();
207  string recName = FindAndReplace(psName, "_PionSup_", "_Rec_");
208  string recPionsName = FindAndReplace(psName, "_PionSup_", "_RecPions_");
209  Double_t rec = HM()->H1(recName)->GetEntries() / nofEvents;
210  Double_t recPions = HM()->H1(recPionsName)->GetEntries() / nofEvents;
211  Double_t pionSup = (rec != 0.) ? recPions / rec : 0.;
212  string pionSupStr = NumberToString<Double_t>(pionSup) + " ("
213  + NumberToString<Double_t>(recPions) + "/"
214  + NumberToString<Double_t>(rec) + ")";
215  vector<string> split = Split(psName, '_');
216  string rowName = split[1];
217  string category = split[2];
218  str += R()->TableRow(list_of(rowName + " - " + category)(pionSupStr));
219  }
220  str += R()->TableEnd();
221  return str;
222 }
223 
224 
231  DrawYPtHistos();
232  DrawHitsHistos();
233 }
234 
236  // Draw global tracking efficiency
237  for (UInt_t i = 0; i < fGlobalTrackVariants.size(); i++) {
238  string variant = fGlobalTrackVariants[i];
239  DrawEfficiency("tracking_qa_global_tracking_efficiency_all_" + variant
240  + "_p",
241  "hte_Sts.*_" + variant + "_All_Eff_p",
243  DrawEfficiency("tracking_qa_global_tracking_efficiency_muon_" + variant
244  + "_p",
245  "hte_Sts.*_" + variant + "_Muon_Eff_p",
247  DrawEfficiency("tracking_qa_global_tracking_efficiency_electron_" + variant
248  + "_p",
249  "hte_Sts.*_" + variant + "_Electron_Eff_p",
251  DrawEfficiency("tracking_qa_pid_efficiency_electron_" + variant + "_p",
252  "hpe_((?!Sts_))Sts.*_" + variant + "_Electron_Eff_p",
254  //DrawEfficiency("tracking_qa_global_tracking_efficiency_" + variant + "_pt", "hte_Sts.*_" + variant + "_All_Eff_pt");
255  //DrawEfficiency("tracking_qa_global_tracking_efficiency_" + variant + "_y", "hte_Sts.*_" + variant + "_All_Eff_y");
256  DrawEfficiency("tracking_qa_global_tracking_efficiency_" + variant
257  + "_angle",
258  "hte_Sts.*_" + variant + "_All_Eff_Angle",
260  if (variant.find("Rich") != string::npos) {
261  DrawEfficiency("tracking_qa_global_tracking_efficiency_electron_"
262  + variant + "_RingXc",
263  "hte_Sts.*_" + variant + "_Electron_Eff_RingXc",
265  DrawEfficiency("tracking_qa_global_tracking_efficiency_electron_"
266  + variant + "_RingYc",
267  "hte_Sts.*_" + variant + "_Electron_Eff_RingYc",
269  }
270  }
271 
272  // Draw local tracking efficiency
273  vector<string> localTrackVariants =
274  list_of("Sts")("Trd")("Much")("Rich")("Tof");
275  for (UInt_t i = 0; i < localTrackVariants.size(); i++) {
276  string variant = localTrackVariants[i];
277  string re = (variant == "Sts")
278  ? "hte_Sts_Sts_(All|Muon|Electron)_Eff"
279  : "hte_" + variant + "_.*_(All|Muon|Electron)_Eff";
280  if (variant == "Rich")
281  re = "hte_" + variant + "_.*_(Electron|ElectronReference)_Eff";
282  DrawEfficiency("tracking_qa_local_tracking_efficiency_" + variant + "_p",
283  re + "_p",
285  //DrawEfficiency("tracking_qa_local_tracking_efficiency_" + variant + "_pt", re + "_pt");
286  //DrawEfficiency("tracking_qa_local_tracking_efficiency_" + variant + "_y", "hte_" + variant + "_.*" + variant + ".*_(All|Electron)_Eff_y");
287 
288  string re2 = (variant == "Sts") ? "hte_Sts_Sts_All_Eff"
289  : "hte_" + variant + "_.*_All_Eff";
290  DrawEfficiency("tracking_qa_local_tracking_efficiency_" + variant
291  + "_angle",
292  re2 + "_Angle",
294  }
295 
296  // Draw RICH efficiency in dependence on different parameters
297  DrawEfficiency("tracking_qa_local_tracking_efficiency_Rich_RingNh",
298  "hte_Rich_Rich_Electron_Eff_RingNh",
300  DrawEfficiency("tracking_qa_local_tracking_efficiency_Rich_BoA",
301  "hte_Rich_Rich_Electron_Eff_BoA",
303  DrawEfficiency("tracking_qa_local_tracking_efficiency_Rich_RingXc",
304  "hte_Rich_Rich_Electron_Eff_RingXc",
306  DrawEfficiency("tracking_qa_local_tracking_efficiency_Rich_RingYc",
307  "hte_Rich_Rich_Electron_Eff_RingYc",
309  DrawYPt("tracking_qa_Rich_Rich_Electron_Eff_RingXcYc",
310  "hte_Rich_Rich_Electron_Eff_RingXcYc",
311  true);
312 
313  // Draw local accepted and reconstructed tracks vs number of points
314  HM()->ShrinkEmptyBinsH1ByPattern("hte_.+_.+_.+_.+_Np");
315  vector<string> accRecTracks = list_of("Sts")("Trd")("Much")("Tof");
316  for (UInt_t i = 0; i < accRecTracks.size(); i++) {
317  string variant = accRecTracks[i];
318 
319  string re = (variant == "Sts")
320  ? "hte_Sts_Sts_(All|Muon|Electron)_(Acc|Rec)_Np"
321  : "hte_" + variant + "_.*_(All|Muon|Electron)_(Acc|Rec)_Np";
322  DrawAccAndRec("tracking_qa_local_acc_and_rec_" + variant + "_Np", re);
323 
324  re = (variant == "Sts") ? "hte_Sts_Sts_(All)_(Acc|Rec)_p"
325  : "hte_" + variant + "_.*_(All)_(Acc|Rec)_p";
326  DrawAccAndRec("tracking_qa_local_acc_and_rec_" + variant + "_All_p", re);
327 
328  re = (variant == "Sts")
329  ? "hte_Sts_Sts_(Muon|Electron)_(Acc|Rec)_p"
330  : "hte_" + variant + "_.*_(Muon|Electron)_(Acc|Rec)_p";
332  "tracking_qa_local_acc_and_rec_" + variant + "_ElectronMuon_p", re);
333  }
334 
335  //
336  DrawPionSuppression("tracking_qa_pion_suppression_wo_Rich_p",
337  "hps_((?!Rich)).*All_PionSup_p",
339  DrawPionSuppression("tracking_qa_pion_suppression_with_rich_p",
340  "hps_Rich.*All_PionSup_p",
342 
343 
344  // Draw ghost RICH rings vs position on photodetector plane
345  if (HM()->Exists("hng_NofGhosts_Rich_RingXcYc")) {
346  TCanvas* canvas = CreateCanvas("tracking_qa_hng_NofGhosts_Rich_RingXcYc",
347  "tracking_qa_hng_NofGhosts_Rich_RingXcYc",
348  800,
349  800);
350  Int_t nofEvents = HM()->H1("hen_EventNo_TrackingQa")->GetEntries();
351  HM()->H2("hng_NofGhosts_Rich_RingXcYc")->Scale(1. / nofEvents);
352  DrawH2(HM()->H2("hng_NofGhosts_Rich_RingXcYc"));
353  }
354 }
355 
357  const string& canvasName,
358  const string& histNamePattern,
359  string (*labelFormatter)(const string&, Double_t)) {
360  vector<TH1*> histos = HM()->H1Vector(histNamePattern);
361  if (histos.size() == 0) return;
362 
363  TCanvas* canvas =
364  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 600, 500);
365  canvas->SetGrid();
366  canvas->cd();
367 
368  Int_t nofHistos = histos.size();
369  vector<string> labels(nofHistos);
370  vector<Double_t> efficiencies(nofHistos);
371  for (UInt_t iHist = 0; iHist < nofHistos; iHist++) {
372  string name = histos[iHist]->GetName();
373  efficiencies[iHist] =
374  CalcEfficiency(HM()->H1(FindAndReplace(name, "_Eff_", "_Rec_")),
375  HM()->H1(FindAndReplace(name, "_Eff_", "_Acc_")),
376  100.);
377  labels[iHist] = labelFormatter(name, efficiencies[iHist]);
378  }
379 
380  DrawH1(histos, labels, kLinear, kLinear, true, 0.50, 0.78, 0.99, 0.99, "PE1");
381  DrawMeanEfficiencyLines(histos, efficiencies);
382 }
383 
385  const string& canvasName,
386  const string& histNamePattern,
387  string (*labelFormatter)(const string&, Double_t)) {
388  vector<TH1*> histos = HM()->H1Vector(histNamePattern);
389  if (histos.size() == 0) return;
390 
391  TCanvas* canvas =
392  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 600, 500);
393  canvas->SetGrid();
394  canvas->cd();
395 
396  Int_t nofHistos = histos.size();
397  vector<string> labels(nofHistos);
398  vector<Double_t> ps(nofHistos);
399  for (UInt_t iHist = 0; iHist < nofHistos; iHist++) {
400  string name = histos[iHist]->GetName();
401  ps[iHist] =
402  CalcEfficiency(HM()->H1(FindAndReplace(name, "_PionSup_", "_RecPions_")),
403  HM()->H1(FindAndReplace(name, "_PionSup_", "_Rec_")),
404  1.);
405  labels[iHist] = labelFormatter(name, ps[iHist]);
406  }
407 
408  DrawH1(histos, labels, kLinear, kLog, true, 0.50, 0.78, 0.99, 0.99, "PE1");
409  DrawMeanEfficiencyLines(histos, ps);
410 }
411 
413  const vector<TH1*>& histos,
414  const vector<Double_t>& efficiencies) {
415  assert(histos.size() != 0 && efficiencies.size() == histos.size());
416 
417  Double_t minX = histos[0]->GetXaxis()->GetXmin();
418  Double_t maxX = histos[0]->GetXaxis()->GetXmax();
419  Int_t nofHistos = histos.size();
420  for (UInt_t iHist = 0; iHist < nofHistos; iHist++) {
421  TLine* line =
422  new TLine(minX, efficiencies[iHist], maxX, efficiencies[iHist]);
423  line->SetLineWidth(1);
424  line->SetLineColor(histos[iHist]->GetLineColor());
425  line->Draw();
426  }
427 }
428 
429 void CbmLitTrackingQaReport::DrawAccAndRec(const string& canvasName,
430  const string& histNamePattern) {
431  vector<TH1*> histos = HM()->H1Vector(histNamePattern);
432  if (histos.size() == 0) return;
433 
434  TCanvas* canvas =
435  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 600, 500);
436  canvas->SetGrid();
437  canvas->cd();
438 
439  Int_t nofEvents = HM()->H1("hen_EventNo_TrackingQa")->GetEntries();
440  Int_t nofHistos = histos.size();
441  vector<string> labels(nofHistos);
442  for (UInt_t iHist = 0; iHist < nofHistos; iHist++) {
443  TH1* hist = histos[iHist];
444  hist->Scale(1. / nofEvents);
445  string name = hist->GetName();
446  vector<string> split = Split(name, '_');
447  labels[iHist] =
448  split[4] + ":" + split[3] + "("
449  + NumberToString<Double_t>(hist->GetEntries() / nofEvents, 2) + ")";
450  }
451 
452  DrawH1(histos, labels, kLinear, kLinear, true, 0.50, 0.78, 0.99, 0.99);
453 }
454 
456  // Draw global tracking efficiency
457  for (UInt_t i = 0; i < fGlobalTrackVariants.size(); i++) {
458  string variant = fGlobalTrackVariants[i];
459  string effHistName = "hte_" + variant + "_" + variant;
460  DrawYPt("tracking_qa_" + variant + "_all_ypt",
461  effHistName + "_All_Eff_YPt");
462  DrawYPt("tracking_qa_" + variant + "_proton_ypt",
463  effHistName + "_Proton_Eff_YPt");
464  DrawYPt("tracking_qa_" + variant + "_pion_plus_ypt",
465  effHistName + "_PionPlus_Eff_YPt");
466  DrawYPt("tracking_qa_" + variant + "_pion_minus_ypt",
467  effHistName + "_PionMinus_Eff_YPt");
468  DrawYPt("tracking_qa_" + variant + "_kaon_plus_ypt",
469  effHistName + "_KaonPlus_Eff_YPt");
470  DrawYPt("tracking_qa_" + variant + "_kaon_minus_ypt",
471  effHistName + "_KaonMinus_Eff_YPt");
472  }
473 }
474 
475 void CbmLitTrackingQaReport::DrawYPt(const string& canvasName,
476  const string& effHistName,
477  Bool_t drawOnlyEfficiency) {
478  string accHistName = FindAndReplace(effHistName, "_Eff_", "_Acc_");
479  string recHistName = FindAndReplace(effHistName, "_Eff_", "_Rec_");
480 
481  if (!(HM()->Exists(effHistName) && HM()->Exists(accHistName)
482  && HM()->Exists(recHistName)))
483  return;
484 
485  TH2* accHist = HM()->H2(accHistName);
486  TH2* recHist = HM()->H2(recHistName);
487  TH2* effHist = HM()->H2(effHistName);
488 
489  if (drawOnlyEfficiency) {
490  TCanvas* canvas =
491  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 800, 800);
492  //canvas->SetGrid();
493  DrawH2(effHist);
494  } else {
495  TCanvas* canvas =
496  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 1800, 600);
497  canvas->Divide(3, 1);
498  canvas->SetGrid();
499  canvas->cd(1);
500  DrawH2(accHist);
501 
502  canvas->cd(2);
503  DrawH2(recHist);
504 
505  canvas->cd(3);
506  DrawH2(effHist);
507  }
508 }
509 
511  HM()->ShrinkEmptyBinsH1ByPattern("hth_.*(_All|_True|_Fake)");
512  DrawHitsHistos("tracking_qa_mvd_hits", "hth_Mvd_TrackHits");
513  DrawHitsHistos("tracking_qa_sts_hits", "hth_Sts_TrackHits");
514  DrawHitsHistos("tracking_qa_trd_hits", "hth_Trd_TrackHits");
515  DrawHitsHistos("tracking_qa_much_hits", "hth_Much_TrackHits");
516  DrawHitsHistos("tracking_qa_rich_hits", "hth_Rich_TrackHits");
517 }
518 
519 void CbmLitTrackingQaReport::DrawHitsHistos(const string& canvasName,
520  const string& hist) {
521  if (!(HM()->Exists(hist + "_All") && HM()->Exists(hist + "_True")
522  && HM()->Exists(hist + "_Fake") && HM()->Exists(hist + "_TrueOverAll")
523  && HM()->Exists(hist + "_FakeOverAll")))
524  return;
525 
526  TCanvas* canvas =
527  CreateCanvas(canvasName.c_str(), canvasName.c_str(), 1200, 600);
528  canvas->Divide(2, 1);
529  canvas->SetGrid();
530 
531  canvas->cd(1);
532  TH1* hAll = HM()->H1(hist + "_All");
533  TH1* hTrue = HM()->H1(hist + "_True");
534  TH1* hFake = HM()->H1(hist + "_Fake");
535  DrawH1(list_of(hAll)(hTrue)(hFake),
536  list_of("all: " + NumberToString<Double_t>(hAll->GetMean(), 1))(
537  "true: " + NumberToString<Double_t>(hTrue->GetMean(), 1))(
538  "fake: " + NumberToString<Double_t>(hFake->GetMean(), 1)),
539  kLinear,
540  kLog,
541  true,
542  0.50,
543  0.78,
544  0.99,
545  0.99);
546 
547  canvas->cd(2);
548  TH1* hTrueOverAll = HM()->H1(hist + "_TrueOverAll");
549  TH1* hFakeOverAll = HM()->H1(hist + "_FakeOverAll");
550  DrawH1(
551  list_of(hTrueOverAll)(hFakeOverAll),
552  list_of("true/all: " + NumberToString<Double_t>(hTrueOverAll->GetMean()))(
553  "fake/all: " + NumberToString<Double_t>(hFakeOverAll->GetMean())),
554  kLinear,
555  kLog,
556  true,
557  0.50,
558  0.78,
559  0.99,
560  0.99);
561 }
562 
563 Double_t CbmLitTrackingQaReport::CalcEfficiency(const TH1* histRec,
564  const TH1* histAcc,
565  Double_t scale) const {
566  if (histAcc->Integral() == 0 || histRec->Integral() == 0) {
567  return 0.;
568  } else {
569  return scale * Double_t(histRec->Integral())
570  / Double_t(histAcc->Integral());
571  }
572 }
573 
575  fGlobalTrackVariants.clear();
576  vector<TH1*> histos = HM()->H1Vector("hte_.*_Eff_p");
577  Int_t nofHistos = histos.size();
578  set<string> variants;
579  for (Int_t iHist = 0; iHist < nofHistos; iHist++) {
580  string effName = histos[iHist]->GetName();
581  variants.insert(Split(effName, '_')[2]);
582  }
583  fGlobalTrackVariants.assign(variants.begin(), variants.end());
584 }
585 
587  TH1* histo2,
588  TH1* histo3,
589  Double_t scale) {
590  histo1->Sumw2();
591  histo2->Sumw2();
592  histo3->Sumw2();
593  histo3->Divide(histo1, histo2, 1., 1., "B");
594  histo3->Scale(scale);
595 }
596 
598  vector<TH1*> effHistos = HM()->H1Vector("(hte|hpe)_.+_Eff_.+");
599  Int_t nofEffHistos = effHistos.size();
600  for (Int_t iHist = 0; iHist < nofEffHistos; iHist++) {
601  TH1* effHist = effHistos[iHist];
602  string effHistName = effHist->GetName();
603  string accHistName = FindAndReplace(effHistName, "_Eff_", "_Acc_");
604  string recHistName = FindAndReplace(effHistName, "_Eff_", "_Rec_");
605  DivideHistos(HM()->H1(recHistName), HM()->H1(accHistName), effHist, 100.);
606  effHist->SetMinimum(0.);
607  effHist->SetMaximum(100.);
608  }
609 }
610 
612  vector<TH1*> histos = HM()->H1Vector("hps_.+_PionSup_.+");
613  Int_t nofHistos = histos.size();
614  for (Int_t iHist = 0; iHist < nofHistos; iHist++) {
615  TH1* psHist = histos[iHist];
616  string psHistName = psHist->GetName();
617  string recHistName = FindAndReplace(psHistName, "_PionSup_", "_Rec_");
618  string pionRecHistName =
619  FindAndReplace(psHistName, "_PionSup_", "_RecPions_");
620  DivideHistos(HM()->H1(pionRecHistName), HM()->H1(recHistName), psHist, 1.);
621  // psHist->SetMinimum(1.);
622  // psHist->SetMaximum(20000.);
623  }
624 }
625 
CbmReportElement::TableBegin
virtual std::string TableBegin(const std::string &caption, const std::vector< std::string > &colNames) const =0
Return string with table open tag.
CbmReport::CreateCanvas
TCanvas * CreateCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
Create canvas and put it to vector of TCanvases. Canvases created with this function will be automati...
Definition: CbmReport.cxx:82
CbmLitTrackingQaReport::~CbmLitTrackingQaReport
virtual ~CbmLitTrackingQaReport()
Destructor.
Definition: CbmLitTrackingQaReport.cxx:54
split
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
Definition: ThermalParticleSystem.cxx:144
CbmLitTrackingQaReport::PrintTrackingEfficiency
string PrintTrackingEfficiency(Bool_t includeRich, Bool_t isPidEfficiency) const
Return string with tracking efficiency.
Definition: CbmLitTrackingQaReport.cxx:132
CbmLitTrackingQaReport::PrintTrackHits
string PrintTrackHits() const
Return string with hits histogram statistics (nof all, true, fake hits in track/ring).
Definition: CbmLitTrackingQaReport.cxx:92
CbmSimulationReport::H2
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
Definition: CbmSimulationReport.h:80
CbmReportElement::DocumentBegin
virtual std::string DocumentBegin() const =0
Return string with open tags for document.
Cbm::FindAndReplace
string FindAndReplace(const string &name, const string &oldSubstr, const string &newSubstr)
Definition: CbmUtils.cxx:45
CbmLitTrackingQaReport::DivideHistos
void DivideHistos(TH1 *histo1, TH1 *histo2, TH1 *histo3, Double_t scale)
Divide two histograms.
Definition: CbmLitTrackingQaReport.cxx:586
CbmReportElement::TableRow
virtual std::string TableRow(const std::vector< std::string > &row) const =0
Return string with table row tags.
CbmHistManager::ShrinkEmptyBinsH1ByPattern
void ShrinkEmptyBinsH1ByPattern(const std::string &pattern)
Shrink empty bins in H1.
Definition: core/base/CbmHistManager.cxx:174
CbmReportElement::DocumentEnd
virtual std::string DocumentEnd() const =0
Return string with close tags of the document.
CbmLitTrackingQaReport
Create report for tracking QA.
Definition: CbmLitTrackingQaReport.h:23
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmLitTrackingQaReport::CbmLitTrackingQaReport
CbmLitTrackingQaReport()
Constructor.
Definition: CbmLitTrackingQaReport.cxx:49
CbmHistManager::H2
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
Definition: CbmHistManager.h:190
DefaultPionSuppressionLabelFormatter
string DefaultPionSuppressionLabelFormatter(const string &histName, Double_t efficiency)
Definition: CbmLitTrackingQaReport.cxx:43
CbmLitTrackingQaReport.h
Create report for tracking QA.
CbmLitTrackingQaReport::fGlobalTrackVariants
vector< string > fGlobalTrackVariants
Definition: CbmLitTrackingQaReport.h:168
CbmReport::R
const CbmReportElement * R() const
Accessor to CbmReportElement object. User has to write the report using available tags from CbmReport...
Definition: CbmReport.h:51
CbmDrawHist.h
Helper functions for drawing 1D and 2D histograms and graphs.
CbmLitTrackingQaReport::PrintNofObjects
string PrintNofObjects() const
Return string with number of objects statistics.
Definition: CbmLitTrackingQaReport.cxx:78
CbmReportElement.h
Abstract class for basic report elements (headers, tables, images etc.).
CbmHistManager.h
Histogram manager.
CbmReport::SetReportName
void SetReportName(const std::string &name)
Definition: CbmReport.h:59
CbmLitTrackingQaReport::PrintNofGhosts
string PrintNofGhosts() const
Return string with number of ghosts statistics.
Definition: CbmLitTrackingQaReport.cxx:116
CbmLitTrackingQaReport::FillGlobalTrackVariants
void FillGlobalTrackVariants()
Definition: CbmLitTrackingQaReport.cxx:574
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
CbmReport::PrintCanvases
void PrintCanvases() const
Print images created from canvases in the report.
Definition: CbmReport.cxx:109
CbmLitTrackingQaReport::CalculateEfficiencyHistos
void CalculateEfficiencyHistos()
Calculate efficiency histograms.
Definition: CbmLitTrackingQaReport.cxx:597
CbmLitTrackingQaReport::Create
virtual void Create()
Inherited from CbmSimulationReport.
Definition: CbmLitTrackingQaReport.cxx:56
CbmLitTrackingQaReport::CalculatePionSuppressionHistos
void CalculatePionSuppressionHistos()
Definition: CbmLitTrackingQaReport.cxx:611
CbmReportElement::TableEnd
virtual std::string TableEnd() const =0
Return string with table close tag.
kLinear
@ kLinear
Definition: CbmDrawHist.h:79
CbmLitTrackingQaReport::DrawYPt
void DrawYPt(const string &canvasName, const string &effHistName, Bool_t drawOnlyEfficiency=false)
Draw Rapidity-Pt histograms.
Definition: CbmLitTrackingQaReport.cxx:475
CbmLitTrackingQaReport::DrawPionSuppression
void DrawPionSuppression(const string &canvasName, const string &histNamePattern, string(*labelFormatter)(const string &, Double_t))
Definition: CbmLitTrackingQaReport.cxx:384
CbmLitTrackingQaReport::DrawMeanEfficiencyLines
void DrawMeanEfficiencyLines(const vector< TH1 * > &histos, const vector< Double_t > &efficiencies)
Draw mean efficiency lines on histogram.
Definition: CbmLitTrackingQaReport.cxx:412
CbmSimulationReport::H1
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
Definition: CbmSimulationReport.h:73
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmHistManager::H1
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
Definition: CbmHistManager.h:170
CbmUtils.h
CbmLitTrackingQaReport::Draw
virtual void Draw()
Inherited from CbmSimulationReport.
Definition: CbmLitTrackingQaReport.cxx:225
CbmLitTrackingQaReport::DrawYPtHistos
void DrawYPtHistos()
Main function for drawing Rapidity-Pt histograms.
Definition: CbmLitTrackingQaReport.cxx:455
CbmLitTrackingQaReport::PrintPionSuppression
string PrintPionSuppression() const
Return string with pion suppression efficiency.
Definition: CbmLitTrackingQaReport.cxx:197
CbmHistManager::H1Vector
std::vector< TH1 * > H1Vector(const std::string &pattern) const
Return vector of pointers to TH1 histogram.
Definition: core/base/CbmHistManager.cxx:79
CbmLitTrackingQaReport::DrawEfficiencyHistos
void DrawEfficiencyHistos()
Main function for drawing efficiency histograms.
Definition: CbmLitTrackingQaReport.cxx:235
CbmSimulationReport::HM
CbmHistManager * HM() const
Return pointer to Histogram manager.
Definition: CbmSimulationReport.h:92
ElectronIdEfficiencyLabelFormatter
string ElectronIdEfficiencyLabelFormatter(const string &histName, Double_t efficiency)
Definition: CbmLitTrackingQaReport.cxx:36
CbmSimulationReport
Base class for simulation reports.
Definition: CbmSimulationReport.h:28
CbmReport::Out
std::ostream & Out() const
All text output goes to this stream.
Definition: CbmReport.h:56
DrawH2
void DrawH2(TH2 *hist, HistScale logx, HistScale logy, HistScale logz, const string &drawOpt)
Definition: CbmDrawHist.cxx:84
SetDefaultDrawStyle
void SetDefaultDrawStyle()
Definition: CbmDrawHist.cxx:33
CbmLitTrackingQaReport::DrawAccAndRec
void DrawAccAndRec(const string &canvasName, const string &histNamePattern)
Draw accepted and reconstructed tracks histograms.
Definition: CbmLitTrackingQaReport.cxx:429
CbmLitTrackingQaReport::DrawEfficiency
void DrawEfficiency(const string &canvasName, const string &histNamePattern, string(*labelFormatter)(const string &, Double_t))
Draw efficiency histogram.
Definition: CbmLitTrackingQaReport.cxx:356
CbmReportElement::Title
virtual std::string Title(int size, const std::string &title) const =0
Return string with title.
Cbm::NumberToString
std::string NumberToString(const T &value, int precision=1)
Definition: CbmUtils.h:23
CbmLitTrackingQaReport::CalcEfficiency
Double_t CalcEfficiency(const TH1 *histRec, const TH1 *histAcc, Double_t scale=1.) const
Calculate efficiency for two histograms.
Definition: CbmLitTrackingQaReport.cxx:563
Cbm::Split
vector< string > Split(const string &name, char delimiter)
Definition: CbmUtils.cxx:54
kLog
@ kLog
Definition: CbmDrawHist.h:78
CbmLitTrackingQaReport::DrawHitsHistos
void DrawHitsHistos()
Draw histograms for hits.
Definition: CbmLitTrackingQaReport.cxx:510
DefaultEfficiencyLabelFormatter
string DefaultEfficiencyLabelFormatter(const string &histName, Double_t efficiency)
Definition: CbmLitTrackingQaReport.cxx:29