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