CbmRoot
Loading...
Searching...
No Matches
CbmMvdMcQaTask.cxx
Go to the documentation of this file.
1/* Copyright (C) 2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Ajit Kumar [committer] */
4
9
10#include "CbmMvdMcQaTask.h"
11
12#include "CbmMCDataArray.h"
13#include "CbmMCDataManager.h"
14#include "CbmMCEventList.h"
15#include "CbmMCTrack.h"
16#include "CbmMvdPoint.h"
17
18#include <FairRootManager.h>
19
21
22CbmMvdMcQaTask::CbmMvdMcQaTask(int verbose, bool isMcUsed) : CbmQaTask("CbmMvdMcQaTask", verbose, isMcUsed) {}
23
24// --------------------------------------------------------------------------------------------------------------------- //
26{
27 fManager = FairRootManager::Instance();
28
29 if (!fManager) {
30 LOG(error) << "No FairRootManager found";
31 return kERROR;
32 }
33 if (IsMCUsed()) {
34 fMcManager = dynamic_cast<CbmMCDataManager*>(fManager->GetObject("MCDataManager"));
35 if (!fMcManager) LOG(fatal) << GetName() << ": No MCDataManager!";
36
37 fMcEventList = dynamic_cast<CbmMCEventList*>(fManager->GetObject("MCEventList."));
38 if (!fMcEventList) {
39 fMcEventList = dynamic_cast<CbmMCEventList*>(fManager->GetObject("EventList."));
40 if (!fMcEventList)
41 LOG(fatal) << GetName()
42 << ": No MCEventList.! Add digitization and reconstruction files in the macro. MCEventList comes in "
43 "digitzation or reconstruction.";
44 }
45
46 // Get MCTrack array
47 fMcTracks = fMcManager->InitBranch("MCTrack");
48 if (!fMcTracks) {
49 LOG(error) << "No MC tracks array found in CbmMCDataManager!";
50 return kERROR;
51 }
52 // Get MvdPoint array
53 fMvdPoints = fMcManager->InitBranch("MvdPoint");
54 if (!fMvdPoints) {
55 LOG(error) << "No MC points array found in CbmMCDataManager!";
56 return kERROR;
57 }
58 }
59 for (int oi = 0; oi < kNumOrigins; ++oi) {
60 fLists[oi] = new TList();
61 fLists[oi]->SetOwner(kTRUE);
62 fLists[oi]->SetName(Form("MvdMcQa_%s", kOriginName[oi]));
63 fManager->Register(Form("MvdMcQaHists_%s", kOriginName[oi]), "MVD", fLists[oi], kTRUE);
64 }
65
66 BookHists_();
67
68 return kSUCCESS;
69}
70// ----- Book histograms ----------------------------------------------------- //
72{
73 // MCTrack level histograms
74 TString name = Form("mc_tracks_per_event");
75 TString title = Form("MC tracks per event;# MC tracks;Counts");
76 fh_nTracksAll = MakeQaObject<TH1D>(name, title, 20000, 0, 20000);
77
78 // --- MCTrack-level QA ---
79 const int nSpeciesBins = 18;
80
81 fh_mc_pdg_all = MakeQaObject<TH1D>("h_mc_pdg_all", "MCTrack particle species (all);particle;counts", nSpeciesBins,
82 0.5, nSpeciesBins + 0.5);
83 fh_mc_pdg_prim = MakeQaObject<TH1D>("h_mc_pdg_prim", "MCTrack particle species (primaries);particle;counts",
84 nSpeciesBins, 0.5, nSpeciesBins + 0.5);
85 fh_mc_pdg_sec = MakeQaObject<TH1D>("h_mc_pdg_sec", "MCTrack particle species (secondaries);particle;counts",
86 nSpeciesBins, 0.5, nSpeciesBins + 0.5);
87
88 auto labelSpecies = [](TH1* h) {
89 auto* ax = h->GetXaxis();
90 ax->SetBinLabel(1, "#gamma");
91 ax->SetBinLabel(2, "e^{-}");
92 ax->SetBinLabel(3, "e^{+}");
93 ax->SetBinLabel(4, "#mu^{-}");
94 ax->SetBinLabel(5, "#mu^{+}");
95 ax->SetBinLabel(6, "#pi^{+}");
96 ax->SetBinLabel(7, "#pi^{-}");
97 ax->SetBinLabel(8, "#pi^{0}");
98 ax->SetBinLabel(9, "K^{+}");
99 ax->SetBinLabel(10, "K^{-}");
100 ax->SetBinLabel(11, "K^{0}_{S}");
101 ax->SetBinLabel(12, "K^{0}_{L}");
102 ax->SetBinLabel(13, "p");
103 ax->SetBinLabel(14, "#bar{p}");
104 ax->SetBinLabel(15, "n");
105 ax->SetBinLabel(16, "#bar{n}");
106 ax->SetBinLabel(17, "ions");
107 ax->SetBinLabel(18, "other");
108 };
109
110 labelSpecies(fh_mc_pdg_all);
111 labelSpecies(fh_mc_pdg_prim);
112 labelSpecies(fh_mc_pdg_sec);
113
114 // momentum distributions (tune max if you like)
115 fh_mc_p_prim = MakeQaObject<TH1D>("h_mc_p_prim", "MCTrack momentum (primaries);p [GeV/c];counts", 200, 0., 10.);
116 fh_mc_p_sec = MakeQaObject<TH1D>("h_mc_p_sec", "MCTrack momentum (secondaries);p [GeV/c];counts", 200, 0., 10.);
117
118 // start vertex distributions
119 fh_mc_startZ = MakeQaObject<TH1D>("h_mc_startZ", "MCTrack start z;z_{start} [cm];counts", 400, -200., 200.);
120
121 fh_mc_startX_vs_Z = MakeQaObject<TH2D>("h_mc_startX_vs_Z", "MCTrack start x vs z;x_{start} [cm];z_{start} [cm]", 400,
122 -50., 50., 400, -200., 200.);
123
124 fh_mc_startY_vs_Z = MakeQaObject<TH2D>("h_mc_startY_vs_Z", "MCTrack start y vs z;y_{start} [cm];z_{start} [cm]", 400,
125 -50., 50., 400, -200., 200.);
126
127 fh_mc_startY_vs_X = MakeQaObject<TH2D>("h_mc_startY_vs_X", "MCTrack start y vs x;x_{start} [cm];y_{start} [cm]", 400,
128 -50., 50., 400, -50., 50.);
129
130 // MvdPoint histograms
131 // per-event per-station
133 for (int iSt = 0; iSt < fNStations; ++iSt) {
134 TString namest = Form("h_mvd_nPointsEvt_station_%d", iSt);
135 TString titlest = Form("MVD points per event, station %d;N_{MVD points};Events", iSt);
136 fh_mvd_nPointsEvt_station[iSt] = MakeQaObject<TH1D>(namest, titlest, 5000, 0., 5000.);
137 }
138
139 // XY maps per station, split by origin
142
143 for (int iSt = 0; iSt < fNStations; ++iSt) {
144 TString nameP = Form("h_mvd_xy_prim_station_%d", iSt);
145 TString titleP = Form("MVD primary points X-Y, station %d;x [cm];y [cm]", iSt);
147 MakeQaObject<TH2D>(nameP, titleP, 400, -5., 5., 400, -5., 5.); // adjust ranges to your detector
148
149 TString nameS = Form("h_mvd_xy_sec_station_%d", iSt);
150 TString titleS = Form("MVD secondary points X-Y, station %d;x [cm];y [cm]", iSt);
151 fh_mvd_xy_sec_station[iSt] = MakeQaObject<TH2D>(nameS, titleS, 400, -5., 5., 400, -5., 5.);
152 }
153
154 fh_mvd_pdg_all = MakeQaObject<TH1D>("h_mvd_pdg_all", "MVD point particle species (all);particle;counts", nSpeciesBins,
155 0.5, nSpeciesBins + 0.5);
156
157 fh_mvd_pdg_prim = MakeQaObject<TH1D>("h_mvd_pdg_prim", "MVD point particle species (primaries);particle;counts",
158 nSpeciesBins, 0.5, nSpeciesBins + 0.5);
159
160 fh_mvd_pdg_sec = MakeQaObject<TH1D>("h_mvd_pdg_sec", "MVD point particle species (secondaries);particle;counts",
161 nSpeciesBins, 0.5, nSpeciesBins + 0.5);
162
163 labelSpecies(fh_mvd_pdg_all);
164 labelSpecies(fh_mvd_pdg_prim);
165 labelSpecies(fh_mvd_pdg_sec);
166
167 // Momentum distributions from parent MCTrack
169 MakeQaObject<TH1D>("h_mvd_p_prim", "Momentum at MVD point (primaries);p [GeV/c];counts", 200, 0., 10.);
170
172 MakeQaObject<TH1D>("h_mvd_p_sec", "Momentum at MVD point (secondaries);p [GeV/c];counts", 200, 0., 10.);
173
174 // dE vs momentum and dE vs PDG species
175 fh_mvd_dEkeV_vs_p = MakeQaObject<TH2D>("h_mvd_dEkeV_vs_p", "MVD dE vs momentum; p [GeV/c]; dE [keV]", 200, 0., 10.,
176 200, 0., 500.); // tune dE range
177
178 fh_mvd_dEkeV_vs_pdg = MakeQaObject<TH2D>("h_mvd_dEkeV_vs_pdg", "MVD dE vs particle species;particle;dE [keV]",
179 nSpeciesBins, 0.5, nSpeciesBins + 0.5, 200, 0., 500.);
180
181 labelSpecies(fh_mvd_dEkeV_vs_pdg);
182
183
184 fh_nMvdPointsEvt = MakeQaObject<TH1D>("h_nMvdPointsEvt", "MVD points per event;N points;Events", 5000, 0, 5000);
186 MakeQaObject<TH1D>("h_nDeltaEvt", "Secondary e^{#pm} with MVD hits per event;N tracks;Events", 1000, 0, 1000);
187
188 const int nbin = std::max(1, fKeVMax / fKeVBin);
190 MakeQaObject<TH1D>("h_sec_count_bySpecies", "Secondary tracks with MVD hits by species;Class;Counts", 9, 0.5, 9.5);
191 fh_sec_count_bySpecies->GetXaxis()->SetBinLabel(1, "#gamma");
192 fh_sec_count_bySpecies->GetXaxis()->SetBinLabel(2, "e^{#pm}");
193 fh_sec_count_bySpecies->GetXaxis()->SetBinLabel(3, "#mu^{#pm}");
194 fh_sec_count_bySpecies->GetXaxis()->SetBinLabel(4, "#pi^{#pm}");
195 fh_sec_count_bySpecies->GetXaxis()->SetBinLabel(5, "K^{#pm}");
196 fh_sec_count_bySpecies->GetXaxis()->SetBinLabel(6, "p/p#bar");
197 fh_sec_count_bySpecies->GetXaxis()->SetBinLabel(7, "n/n#bar");
198 fh_sec_count_bySpecies->GetXaxis()->SetBinLabel(8, "ions");
199 fh_sec_count_bySpecies->GetXaxis()->SetBinLabel(9, "other");
200
202 "h_dEkeV_vs_pidClass", "#DeltaE per MVD point (keV) vs PID class (non-primaries with hits);PID class;#DeltaE [keV]",
203 9, 0.5, 9.5, nbin, 0., fKeVMax);
204 for (int b = 1; b <= 9; ++b) {
205 const char* lbl = nullptr;
206 switch (b) {
207 case 1: lbl = "#gamma"; break;
208 case 2: lbl = "e^{#pm}"; break;
209 case 3: lbl = "#mu^{#pm}"; break;
210 case 4: lbl = "#pi^{#pm}"; break;
211 case 5: lbl = "K^{#pm}"; break;
212 case 6: lbl = "p/p#bar"; break;
213 case 7: lbl = "n/n#bar"; break;
214 case 8: lbl = "ions"; break;
215 default: lbl = "other"; break;
216 }
217 fh_dEkeV_vs_pidClass->GetXaxis()->SetBinLabel(b, lbl);
218 }
219
220 fhZdistMvd = MakeQaObject<TH1D>("hZdistMvd", "MVD hit z, z[cm]", 200, -100, 100);
221
222 // dE (keV) vs momentum (GeV/c) at the point (non-primaries)
224 MakeQaObject<TH2D>("h_dEkeV_vs_p", "#DeltaE (keV) vs p at point (non-primaries);p [GeV/c];#DeltaE [keV]", 200, 0.,
225 10., // tune to beam
226 nbin, 0., fKeVMax);
227}
228// --------------------------------------------------------------------------------------------------------------------- //
230{
231 if (!IsMCUsed()) return;
232 int nMcEvents = fMcEventList->GetNofEvents();
233 for (int iEv = 0; iEv < nMcEvents; iEv++) {
234 const auto fileId = fMcEventList->GetFileIdByIndex(iEv);
235 const auto eventId = fMcEventList->GetEventIdByIndex(iEv);
236 ProcessMcTracks(fileId, eventId);
237 ProcessMvdPoints(fileId, eventId);
238 }
239}
240
241void CbmMvdMcQaTask::ProcessMcTracks(const int& fileId, const int& eventId)
242{
243 const int nMcTracks = fMcTracks->Size(fileId, eventId);
244 fh_nTracksAll->Fill(nMcTracks);
245
246 fPdgBuf.assign(nMcTracks, 0);
247 fOriginBuf.assign(nMcTracks, Origin::Other);
248
249 for (int iTrack = 0; iTrack < nMcTracks; iTrack++) {
250 const auto* mcTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, iTrack));
251 if (!mcTrack) continue;
252 // const auto* motherTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, mcTrack->GetMotherId()));
253 // if (!motherTrack) continue;
254 const int pdg = mcTrack->GetPdgCode();
255 const Origin org = ClassifyTrack_(fileId, eventId, iTrack);
256 const double p = mcTrack->GetP();
257 const double x0 = mcTrack->GetStartX();
258 const double y0 = mcTrack->GetStartY();
259 const double z0 = mcTrack->GetStartZ();
260
261 fPdgBuf[iTrack] = pdg;
262 fOriginBuf[iTrack] = org;
263 // map PDG to species bin for labelled histograms
264 const int bin = MapPdgToSpeciesBin_(pdg);
265 fh_mc_pdg_all->Fill(bin);
266 fh_mc_startZ->Fill(z0);
267 fh_mc_startX_vs_Z->Fill(x0, z0);
268 fh_mc_startY_vs_Z->Fill(y0, z0);
269 fh_mc_startY_vs_X->Fill(x0, y0);
270
271 if (org == Origin::Primary) {
272 ++fAllNPrim;
273 ++fAllCountsPrim[pdg];
274
275 fh_mc_pdg_prim->Fill(bin);
276 fh_mc_p_prim->Fill(p);
277 }
278 else if (org == Origin::Secondary || org == Origin::DeltaSec) {
279 ++fAllNSec;
280 ++fAllCountsSec[pdg];
281
282 fh_mc_pdg_sec->Fill(bin);
283 fh_mc_p_sec->Fill(p);
284 }
285 else {
286 // Origin::Other: ignore for now
287 }
288 }
289}
290// --------------------------------------------------------------------------------------------------------------------- //
291void CbmMvdMcQaTask::ProcessMvdPoints(const int& fileId, const int& eventId)
292{
293 std::vector<int> nPointsStation(fNStations, 0);
294 int nDeltaThisEvt = 0;
295 TVector3 vIn;
296 TVector3 vOut;
297
298 const int nMvdPoints = fMvdPoints->Size(fileId, eventId);
299 const int nMcTracks = fMcTracks->Size(fileId, eventId);
300
301 fh_nMvdPointsEvt->Fill(nMvdPoints);
302 for (int iPoint = 0; iPoint < nMvdPoints; iPoint++) {
303 auto* mvdPoint = static_cast<CbmMvdPoint*>(fMvdPoints->Get(fileId, eventId, iPoint));
304 if (!mvdPoint) continue;
305
306 const auto* mcTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, mvdPoint->GetTrackID()));
307 if (!mcTrack) continue;
308 // const auto* motherTrack = static_cast<CbmMCTrack*>(fMcTracks->Get(fileId, eventId, mcTrack->GetMotherId()));
309 // if (!motherTrack) continue;
310 const int trackId = mvdPoint->GetTrackID();
311
312 if (trackId < 0 || trackId >= nMcTracks) {
313 LOG(fatal) << "Mvd point " << iPoint << ": trackId " << trackId << " doesn't belong to [0," << nMcTracks - 1
314 << "]";
315 break;
316 }
317
318 const int pdg = fPdgBuf[trackId];
319 const auto origin = fOriginBuf[trackId];
320 const int speciesBin = MapPdgToSpeciesBin_(pdg);
321 Int_t motherId = mcTrack->GetMotherId();
322 Int_t pdgCode = mcTrack->GetPdgCode();
323
324 mvdPoint->Position(vIn);
325 mvdPoint->PositionOut(vOut);
326 Double_t xMC = 0.5 * (vIn.X() + vOut.X());
327 Double_t yMC = 0.5 * (vIn.Y() + vOut.Y());
328 Double_t zMC = 0.5 * (vIn.Z() + vOut.Z());
329
330 fhZdistMvd->Fill(zMC);
332 const int stationId = GetStationIdFromZ_(zMC);
333 if (stationId < 0 || stationId >= fNStations) continue;
334
335 const int cls = PidClass_(pdgCode);
336
337 double p = 0.;
338 p = mcTrack->GetP();
339 const double dE_keV = PointELossGeV_(mvdPoint) * 1e6;
340 fh_mvd_pdg_all->Fill(speciesBin);
341
342 nPointsStation[stationId]++;
343
344 if (origin == Origin::Primary) {
345 fh_mvd_xy_prim_station[stationId]->Fill(xMC, yMC);
346 fh_mvd_pdg_prim->Fill(speciesBin);
347 fh_mvd_p_prim->Fill(p);
348 }
349 else {
350 fh_mvd_xy_sec_station[stationId]->Fill(xMC, yMC);
351 fh_mvd_pdg_sec->Fill(speciesBin);
352 fh_mvd_p_sec->Fill(p);
353 }
354 fh_mvd_dEkeV_vs_p->Fill(p, dE_keV);
355 fh_mvd_dEkeV_vs_pdg->Fill(speciesBin, dE_keV);
356
357 if (motherId < 0) {
358 GetOrBookElossHist(pdgCode, Origin::Primary)->Fill(dE_keV);
359 }
360 else {
361 GetOrBookElossHist(pdgCode, Origin::Secondary)->Fill(dE_keV);
362 fh_sec_count_bySpecies->Fill(cls);
363 }
364 fh_dEkeV_vs_pidClass->Fill(cls, dE_keV);
365
366 if (fh_dEkeV_vs_p) {
367 const double px = mvdPoint->GetPx();
368 const double py = mvdPoint->GetPy();
369 const double pz = mvdPoint->GetPz();
370 const double mom = std::sqrt(px * px + py * py + pz * pz);
371 fh_dEkeV_vs_p->Fill(mom, dE_keV);
372 }
373
374 if (std::abs(pdgCode) == 11) ++nDeltaThisEvt;
375 }
376 for (int iSt = 0; iSt < fNStations; ++iSt) {
377 fh_mvd_nPointsEvt_station[iSt]->Fill(nPointsStation[iSt]);
378 }
379
380 fh_nDeltaEvt->Fill(nDeltaThisEvt);
381}
383{
384 if (z > fZMinStation0 && z < fZMaxStation0) return 0;
385 if (z > fZMinStation1 && z < fZMaxStation1) return 1;
386 if (z > fZMinStation2 && z < fZMaxStation2) return 2;
387 if (z > fZMinStation3 && z < fZMaxStation3) return 3;
388 return -1;
389}
390
391// ----- helpers: PDG naming ------------------------------------------------- //
392bool CbmMvdMcQaTask::DecodeIonPDG_(int pdg, int& Z, int& A)
393{
394 // PDG for ions: 10LZZZAAAI -> commonly used as 1000000000 + Z*10000 + A*10 + I
395 // where L is strangeness, Z is charge,
396 // A is number of nucleons, and I is isomer level.
397
398 int apdg = std::abs(pdg);
399 if (apdg < 1000000000) return false;
400 int code = apdg - 1000000000;
401 Z = (code / 10000) % 1000;
402 A = (code / 10) % 1000;
403 return (Z > 0 && A >= Z);
404}
405
406// --------------------------------------------------------------------------------------------------------------------- //
408{
409 if (!IsMCUsed()) {
410 return;
411 }
413}
414
415// --------------------------------------------------------------------------------------------------------------------- //
417{
419 LOG(info) << "=== MC primary species counts ===";
420 for (auto& kv : fAllCountsPrim)
421 LOG(info) << "PDG " << kv.first << " : " << kv.second;
422
423 LOG(info) << "=== MC secondary species counts ===";
424 for (auto& kv : fAllCountsSec)
425 LOG(info) << "PDG " << kv.first << " : " << kv.second;
426}
427// --------------------------------------------------------------------------------------------------------------------- //
429{
430 int oi = static_cast<int>(origin);
431 if (oi < 0 || oi >= kNumOrigins) oi = static_cast<int>(Origin::Other);
432
433 auto& map = fHistsElossKeVByPDG[oi];
434 auto* list = fLists[oi];
435
436 if (auto it = map.find(pdg); it != map.end()) return it->second;
437
438 const int nbins = 400;
439 const double xmin = 0.0;
440 const double xmax = 4000.0; // keV
441
442 std::string name = Form("hEloss_keV_%s_pdg_%s%d", kOriginName[oi], pdg < 0 ? "m" : "", std::abs(pdg));
443 std::string title = Form("dE (keV) [%s], PDG %d;dE [keV];counts", kOriginName[oi], pdg);
444
445 TH1F* h = new TH1F(name.c_str(), title.c_str(), nbins, xmin, xmax);
446 h->SetDirectory(nullptr);
447
448 map[pdg] = h;
449 list->Add(h);
450 return h;
451}
452// ----- per-event classification helpers ----------------------------------- //
454{
455 if (pdg == 22) return 1;
456 const int a = std::abs(pdg);
457 if (a == 11) return 2;
458 if (a == 13) return 3;
459 if (a == 211) return 4;
460 if (a == 321) return 5;
461 if (a == 2212) return 6;
462 if (a == 2112) return 7;
463 if (a > 1000000000) return 8;
464 return 9;
465}
466// --------------------------------------------------------------------------------------------------------------------- //
468{
469 // bin layout:
470 // 1: Gamma
471 // 2: e-
472 // 3: e+
473 // 4: mu-
474 // 5: mu+
475 // 6: pi+
476 // 7: pi-
477 // 8: pi0
478 // 9: K+
479 // 10: K-
480 // 11: K0_S
481 // 12: K0_L
482 // 13: p
483 // 14: pbar
484 // 15: n
485 // 16: nbar
486 // 17: ions (PDG > 1e9)
487 // 18: other
488
489 if (pdg == 22) return 1;
490
491 if (pdg == 11) return 2;
492 if (pdg == -11) return 3;
493
494 if (pdg == 13) return 4;
495 if (pdg == -13) return 5;
496
497 if (pdg == 211) return 6;
498 if (pdg == -211) return 7;
499
500 if (pdg == 111) return 8;
501
502 if (pdg == 321) return 9;
503 if (pdg == -321) return 10;
504
505 if (pdg == 310) return 11;
506 if (pdg == 130) return 12;
507
508 if (pdg == 2212) return 13;
509 if (pdg == -2212) return 14;
510
511 if (pdg == 2112) return 15;
512 if (pdg == -2112) return 16;
513
514 if (std::abs(pdg) > 1000000000) return 17; // ions
515
516 return 18; // everything else
517}
518// --------------------------------------------------------------------------------------------------------------------- //
519CbmMvdMcQaTask::Origin CbmMvdMcQaTask::ClassifyTrack_(const int& fileId, const int& eventId, Int_t trackindex) const
520{
521 auto* trk = static_cast<const CbmMCTrack*>(fMcTracks->Get(fileId, eventId, trackindex));
522 if (!trk) {
523 LOG(info) << GetName() << ": MCTrack not found for file " << fileId << " event " << eventId << " track "
524 << trackindex;
525 return Origin::Other;
526 }
527 const int pdg = std::abs(trk->GetPdgCode());
528 const int motherId = trk->GetMotherId();
529
530 if (motherId < 0) {
531 return Origin::Primary;
532 }
533
534 if (pdg == 11) {
535 return Origin::DeltaSec;
536 }
537
538 return Origin::Secondary;
539}
540// --------------------------------------------------------------------------------------------------------------------- //
541double CbmMvdMcQaTask::PointELossGeV_(const void* vp) const
542{
543 const auto* p = static_cast<const FairMCPoint*>(vp);
544 return p ? p->GetEnergyLoss() : 0.0;
545}
Copied from CbmTutorialMyQaTask.
int Int_t
Some class A.
Task class creating and managing CbmMCDataArray objects.
Container class for MC events with number, file and start time.
int32_t GetPdgCode() const
Definition CbmMCTrack.h:67
CbmMvdMcQaTask(int verbose, bool isMcUsed)
T * MakeQaObject(TString sName, TString sTitle, Args... args)
Definition CbmQaIO.h:260
CbmQaTask(const char *name, int verbose, bool isMCUsed, ECbmRecoMode recoMode=ECbmRecoMode::Timeslice)
Constructor from parameters.
Definition CbmQaTask.cxx:32
bool IsMCUsed() const
Returns flag, whether MC information is used or not in the task.
Definition CbmQaTask.h:126
Data class with information on a STS local track.
TH1D * fh_nMvdPointsEvt
MVD points per event.
void Check() override
Function to check, if the QA results are acceptable.
void ExecQa() override
Method to fill histograms per event or time-slice.
Long64_t fAllNPrim
global counters (over all events)
TH1D * fh_sec_count_bySpecies
overall counts (non-primary tracks with hits) by coarse species class
Int_t fNStations
Number of stations in MVD: TODO: Get Number of station from data file itself.
std::array< TList *, kNumOrigins > fLists
TH2D * fh_dEkeV_vs_pidClass
dE per point vs species class (non-primaries with hits)
TH2D * fh_mc_startY_vs_Z
start Y vs Z
Origin
track origin tag (public to avoid any ROOT dictionary issues)
std::vector< Origin > fOriginBuf
origin by track index
double fZMinStation0
TODO: Remove when we have getter for number of station directly from CbmMvdPoint.
TH2D * fh_mvd_dEkeV_vs_p
dE (keV) vs p (GeV/c) at MVD point
TH1D * fh_mc_pdg_sec
species for secondary MCTracks
TH2D * fh_mc_startY_vs_X
start Y vs X
CbmMCDataArray * fMcTracks
CbmMCEventList * fMcEventList
containers
int PidClass_(int pdg) const
static bool DecodeIonPDG_(int pdg, int &Z, int &A)
TH2D * fh_mvd_dEkeV_vs_pdg
dE (keV) vs species bin
std::unordered_map< int, uint64_t > fAllCountsSec
PDG -> count (all secondaries)
static constexpr const char * kOriginName[kNumOrigins]
std::vector< int > fPdgBuf
per-event caches
TH1D * fh_mc_p_sec
momentum of secondaries
CbmMCDataManager * fMcManager
std::vector< TH1D * > fh_mvd_nPointsEvt_station
MvdPoint histograms.
TH2D * fh_mc_startX_vs_Z
start X vs Z
int MapPdgToSpeciesBin_(int pdg) const
std::vector< TH2D * > fh_mvd_xy_sec_station
X-Y for secondary MVD points per station.
std::array< std::unordered_map< int, TH1F * >, kNumOrigins > fHistsElossKeVByPDG
TH1D * fh_mc_pdg_all
MCTrack-level histograms.
TH1D * fh_mc_startZ
start-z of MCTracks
TH1F * GetOrBookElossHist(int pdg, Origin origin)
double PointELossGeV_(const void *vp) const
std::unordered_map< int, uint64_t > fAllCountsPrim
PDG -> count (all primaries)
TH1D * fh_mvd_pdg_sec
species for secondary MVD points
TH1D * fh_mvd_pdg_prim
species for primary MVD points
void ProcessMcTracks(const int &fileId, const int &eventId)
FairRootManager * fManager
setup
TH1D * fh_mc_p_prim
momentum of primaries
InitStatus InitQa() override
Initializes the task.
void ProcessMvdPoints(const int &fileId, const int &eventId)
Origin ClassifyTrack_(const int &fileId, const int &eventId, Int_t trackindex) const
TH1D * fh_mc_pdg_prim
species for primary MCTracks
int GetStationIdFromZ_(double z) const
TH1D * fh_nDeltaEvt
number of secondary e+- with hits per event
std::vector< TH2D * > fh_mvd_xy_prim_station
X-Y for primary MVD points per station.
void CreateSummary() override
Initializes QA-task summary: canvases, tables etc.
static constexpr int kNumOrigins
CbmMCDataArray * fMvdPoints
TH1D * fh_mvd_pdg_all
species for all MVD points
TH2D * fh_dEkeV_vs_p
dE (keV) vs p (GeV/c) at point (non-primaries)
TH1D * fh_nTracksAll
Histograms.
int fKeVBin
1 keV bins by default