CbmRoot
Loading...
Searching...
No Matches
CbmCaTrackTypeQa.cxx
Go to the documentation of this file.
1/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
10#include "CbmCaTrackTypeQa.h"
11
12#include "CaMcHitInfo.h"
13#include "CbmCaTrackFitQa.h"
14#include "CbmL1Track.h"
15
20
21using namespace cbm::algo;
22
23// ---------------------------------------------------------------------------------------------------------------------
24//
25TrackTypeQa::TrackTypeQa(const char* typeName, const char* prefix, bool bUseMC, std::shared_ptr<ObjList_t> pObjList)
26 : CbmQaIO(Form("%s_%s", prefix, typeName), pObjList)
27 , fbUseMC(bUseMC)
28{
30}
31
32// ---------------------------------------------------------------------------------------------------------------------
33//
35{
36 // TODO: Replace assertions with exceptions
37 assert(fpvRecoTracks);
38 assert(fpvHits);
39 assert(!fbUseMC || fpMCData);
40
41 //
42 // ** Distributions of reconstructed tracks vs. reconstructed quantities **
43 //
44 fph_reco_p = MakeQaObject<TH1F>("reco_p", "", kBinsP, kLoP, kUpP);
60
61 fph_reco_p->SetTitle("Total momentum of reconstructed track;p^{reco} [GeV/c];Counts");
62 fph_reco_pt->SetTitle("Transverse momentum of reconstructed track;p_{T}^{reco} [GeV/c];Counts");
63 fph_reco_phi->SetTitle("Azimuthal angle of reconstructed track;#phi^{reco} [rad];Counts");
64 fph_reco_theta->SetTitle("Polar angle of reconstructed track;#theta^{reco} [rad];Counts");
65 fph_reco_theta_phi->SetTitle(
66 "Polar angle vs. azimuthal angle of reconstructed track;#phi^{reco} [rad];#theta^{reco} [rad];Counts");
67 fph_reco_tx->SetTitle("Slope along x-axis of reconstructed tracks;t_{x}^{reco};Counts");
68 fph_reco_ty->SetTitle("Slope along y-axis of reconstructed tracks;t_{y}^{reco};Counts");
69 fph_reco_ty_tx->SetTitle("Slope along y-axis vs. x-axis of reconstructed tracks;t_{x}^{reco};t_{y}^{reco};");
70 fph_reco_eta->SetTitle("Pseudorapidity of reconstructed track;#eta^{reco};Counts");
71 fph_reco_fhitR->SetTitle("Distance of the first hit from z-axis for reconstructed tracks;R^{reco} [cm];Counts");
72 fph_reco_nhits->SetTitle("Number of hits of reconstructed tracks;N_{hits};Counts");
73 fph_reco_fsta->SetTitle("First station index of reconstructed tracks;ID_{station};Counts");
74 fph_reco_lsta->SetTitle("Last station index of reconstructed tracks;ID_{station};Counts");
75 fph_reco_chi2_ndf->SetTitle("#chi^{2}/NDF of reconstructed tracks;#chi^{2}/NDF;Counts");
76 fph_reco_chi2_ndf_time->SetTitle("Time #chi^{2}/NDF of reconstructed tracks;#chi^{2}/NDF;Counts");
77
79
80 if (fbUseMC) {
81 //
82 // ** Distributions of reconstructed tracks vs. MC quantities **
83 //
84 fph_reco_pMC = MakeQaObject<TH1F>("reco_pMC", "", kBinsP, kLoP, kUpP);
86 fph_reco_yMC = MakeQaObject<TH1F>("reco_yMC", "", kBinsY, kLoY, kUpY);
92 MakeQaObject<TH2F>("reco_thetaMC_phiMC", "", kBinsPHI, kLoPHI, kUpPHI, kBinsTHETA, kLoTHETA, kUpTHETA);
95
96 fph_reco_pMC->SetTitle("MC total momentum of reconstructed track;p^{MC} [GeV/c];Counts");
97 fph_reco_ptMC->SetTitle("MC transverse momentum of reconstructed track;p_{T}^{MC} [GeV/c];Counts");
98 fph_reco_yMC->SetTitle("MC rapidity of reconstructed track;y^{MC};Counts");
99 fph_reco_etaMC->SetTitle("MC pseudorapidity of reconstructed track;#eta^{MC};Counts");
100 fph_reco_ptMC_yMC->SetTitle("MC Transverse momentum of reconstructed track;y^{MC};p_{T}^{MC} [GeV/c];Counts");
101 fph_reco_phiMC->SetTitle("MC Azimuthal angle of reconstructed track;#phi^{MC} [rad];Counts");
102 fph_reco_thetaMC->SetTitle("MC Polar angle of reconstructed track;#theta^{MC} [rad];Counts");
103 fph_reco_thetaMC_phiMC->SetTitle(
104 "MC Polar angle vs. MC azimuthal angle of reconstructed track;#phi^{MC} [rad];#theta^{MC} [rad];Counts");
105 fph_reco_txMC->SetTitle("MC Slope along x-axis of reconstructed tracks;t_{x}^{MC};Counts");
106 fph_reco_tyMC->SetTitle("MC Slope along y-axis of reconstructed tracks;t_{y}^{MC};Counts");
107
108
109 //
110 // ** Distributions of MC tracks **
111 //
112 fph_mc_pMC = MakeQaObject<TH1F>("mc_pMC", "", kBinsP, kLoP, kUpP);
114 fph_mc_yMC = MakeQaObject<TH1F>("mc_yMC", "", kBinsY, kLoY, kUpY);
124
125 fph_mc_pMC->SetTitle("Total momentum of MC tracks;p^{MC} [GeV/c];Counts");
126 fph_mc_etaMC->SetTitle("Pseudorapidity of MC tracks;#eta^{MC};Counts");
127 fph_mc_yMC->SetTitle("Rapidity of MC tracks;y^{MC};Counts");
128 fph_mc_ptMC_yMC->SetTitle("Transverse momentum vs. rapidity of MC tracks;y^{MC};p_{T}^{MC} [GeV/c];Counts");
129 fph_mc_ptMC->SetTitle("Transverse momentum of MC track;p_{T}^{MC} [GeV/c];Counts");
130 fph_mc_phiMC->SetTitle("Azimuthal angle of MC track;#phi^{MC} [rad];Counts");
131 fph_mc_thetaMC->SetTitle("Polar angle of MC track;#theta^{MC} [rad];Counts");
132 fph_mc_thetaMC_phiMC->SetTitle("Polar angle vs. azimuthal angle of MC track;#phi^{MC} [rad];#theta^{MC} [rad]");
133 fph_mc_txMC->SetTitle("Slope along x-axis of MC tracks;t_{x}^{MC};Counts");
134 fph_mc_tyMC->SetTitle("Slope along y-axis of MC tracks;t_{y}^{MC};Counts");
135 fph_mc_tyMC_txMC->SetTitle("Slope along y-axis vs. x-axis of MC tracks;t_{x}^{MC};t_{y}^{MC};");
136
137 //
138 // ** Efficiencies **
139 //
140 fph_eff_int = MakeQaObject<TProfile>("eff_int", "", 1, -0.5, 0.5, 0., 1.);
141 fph_eff_pMC = MakeQaObject<TProfile>("eff_pMC", "", kBinsP, kLoP, kUpP, 0., 1.);
142 fph_eff_yMC = MakeQaObject<TProfile>("eff_yMC", "", kBinsY, kLoY, kUpY, 0., 1.);
143 fph_eff_ptMC = MakeQaObject<TProfile>("eff_ptMC", "", kBinsPT, kLoPT, kUpPT, 0., 1.);
144 fph_eff_thetaMC = MakeQaObject<TProfile>("eff_thetaMC", "", kBinsTHETA, kLoTHETA, kUpTHETA, 0., 1.);
146 fph_eff_phiMC = MakeQaObject<TProfile>("eff_phiMC", "", kBinsPHI, kLoPHI, kUpPHI, 0., 1.);
147 fph_eff_nhitsMC = MakeQaObject<TProfile>("eff_nhitsMC", "", kBinsNSTA, kLoNSTA, kUpNSTA, 0., 1.);
148 fph_eff_txMC = MakeQaObject<TProfile>("eff_txMC", "", kBinsTX, kLoTX, kUpTX, 0., 1.);
149 fph_eff_tyMC = MakeQaObject<TProfile>("eff_tyMC", "", kBinsTY, kLoTY, kUpTX, 0., 1.);
150
151 // clones
152
153 fph_clone_pMC = MakeQaObject<TProfile>("clone_pMC", "", kBinsP, kLoP, kUpP, 0., 1.);
154 fph_clone_yMC = MakeQaObject<TProfile>("clone_yMC", "", kBinsY, kLoY, kUpY, 0., 1.);
155 fph_clone_ptMC = MakeQaObject<TProfile>("clone_ptMC", "", kBinsPT, kLoPT, kUpPT, 0., 1.);
156 fph_clone_thetaMC = MakeQaObject<TProfile>("clone_thetaMC", "", kBinsTHETA, kLoTHETA, kUpTHETA, 0., 1.);
157 fph_clone_etaMC = MakeQaObject<TProfile>("clone_etaMC", "", kBinsTHETA, kLoTHETA, kUpTHETA, 0., 1.);
158 fph_clone_phiMC = MakeQaObject<TProfile>("clone_phiMC", "", kBinsPHI, kLoPHI, kUpPHI, 0., 1.);
159 fph_clone_nhitsMC = MakeQaObject<TProfile>("clone_nhitsMC", "", kBinsNSTA, kLoNSTA, kUpNSTA, 0., 1.);
160 fph_clone_txMC = MakeQaObject<TProfile>("clone_txMC", "", kBinsTX, kLoTX, kUpTX, 0., 1.);
161 fph_clone_tyMC = MakeQaObject<TProfile>("clone_tyMC", "", kBinsTY, kLoTY, kUpTX, 0., 1.);
162
163 //
164
165 fph_rate_reco = MakeQaObject<TProfile>("rate_reco", "", 1, -0.5, 0.5, 0., 1.);
166 fph_rate_killed = MakeQaObject<TProfile>("rate_killed", "", 1, -0.5, 0.5, 0., 1.);
167 fph_rate_clones = MakeQaObject<TProfile>("rate_clones", "", 1, -0.5, 0.5, 0., 1.);
168
169 double nStations = fpParameters->GetNstationsActive();
170 fph_stations_hit = MakeQaObject<TProfile>("rate_stations_hit", "", 1, -0.5, 0.5, 0., nStations);
171 fph_stations_point = MakeQaObject<TProfile>("rate_stations_point", "", 1, -0.5, 0.5, 0., nStations);
172
173 fCounterMC = 0;
174 fCounterClones = 0;
175 fRecoLength = 0.;
176 fFakeLength = 0.;
177
178 fph_eff_int->SetTitle("Integrated efficiency;;#epsilon_{CA}");
179 fph_eff_pMC->SetTitle("Efficiency vs. MC total momentum;p_{MC} [GeV/c];#epsilon_{CA}");
180 fph_eff_yMC->SetTitle("Efficiency vs. MC rapidity;y_{MC};#epsilon");
181 fph_eff_ptMC->SetTitle("Efficiency vs. MC transverse momentum;p_{T}^{MC} [GeV/c];#epsilon_{CA}");
182 fph_eff_thetaMC->SetTitle("Efficiency vs. MC polar angle;#theta^{MC};#epsilon_{CA}");
183 fph_eff_etaMC->SetTitle("Efficiency vs. MC pseudorapidity;#eta^{MC};#epsilon_{CA}");
184 fph_eff_phiMC->SetTitle("Efficiency vs. MC azimuthal angle;#phi^{MC};#epsilon_{CA}");
185 fph_eff_nhitsMC->SetTitle("Efficiency vs. number of hits;N_{hit}^{MC};#epsilon_{CA}");
186 fph_eff_txMC->SetTitle("Efficiency vs. MC slope along x-axis;t_{x}^{MC};#epsilon_{CA}");
187 fph_eff_tyMC->SetTitle("Efficiency vs. MC slope along y-axis;t_{y}^{MC};#epsilon_{CA}");
188
189 fph_eff_ptMC_yMC = MakeQaObject<TProfile2D>("eff_ptMC_yMC", "", kBinsY, kLoY, kUpY, kBinsPT, kLoPT, kUpPT, 0., 1.);
191 MakeQaObject<TProfile2D>("eff_theta_phi", "", kBinsPHI, kLoPHI, kUpPHI, kBinsTHETA, kLoTHETA, kUpTHETA, 0., 1.);
192
193 fph_eff_ptMC_yMC->SetTitle(
194 "Efficiency vs. MC transverse momentum and MC rapidity;y^{MC};p_{T}^{MC} [GeV/c];#epsilon_{CA}");
195 fph_eff_thetaMC_phiMC->SetTitle(
196 "Efficiency vs. MC polar and MC azimuthal angles;#phi^{MC} [rad];#theta^{MC} [rad];#epsilon_{CA}");
197
198 fph_clone_pMC->SetTitle("Clone rate vs. MC total momentum;p_{MC} [GeV/c];clone rate_{CA}");
199 fph_clone_yMC->SetTitle("Clone vs. MC rapidity;y_{MC};clone rate_{CA}");
200 fph_clone_ptMC->SetTitle("Clone vs. MC transverse momentum;p_{T}^{MC} [GeV/c];clone rate_{CA}");
201 fph_clone_thetaMC->SetTitle("Clone vs. MC polar angle;#theta^{MC};clone rate_{CA}");
202 fph_clone_etaMC->SetTitle("Clone vs. MC pseudorapidity;#eta^{MC};clone rate_{CA}");
203 fph_clone_phiMC->SetTitle("Clone vs. MC azimuthal angle;#phi^{MC};clone rate_{CA}");
204 fph_clone_nhitsMC->SetTitle("Clone vs. number of hits;N_{hit}^{MC};clone rate_{CA}");
205 fph_clone_txMC->SetTitle("Clone vs. MC slope along x-axis;t_{x}^{MC};clone rate_{CA}");
206 fph_clone_tyMC->SetTitle("Clone vs. MC slope along y-axis;t_{y}^{MC};clone rate_{CA}");
207
209 MakeQaObject<TProfile2D>("clone_ptMC_yMC", "", kBinsY, kLoY, kUpY, kBinsPT, kLoPT, kUpPT, 0., 1.);
211 MakeQaObject<TProfile2D>("clone_theta_phi", "", kBinsPHI, kLoPHI, kUpPHI, kBinsTHETA, kLoTHETA, kUpTHETA, 0., 1.);
212
213 fph_clone_ptMC_yMC->SetTitle(
214 "Clone vs. MC transverse momentum and MC rapidity;y^{MC};p_{T}^{MC} [GeV/c];clone rate_{CA}");
215 fph_clone_thetaMC_phiMC->SetTitle(
216 "Clone vs. MC polar and MC azimuthal angles;#phi^{MC} [rad];#theta^{MC} [rad];clone rate_{CA}");
217
218
219 //
220 // ** Track fit parameter properties (residuals and pulls) **
221 //
222 fpFitQaFirstHit = std::make_unique<TrackFitQa>("fst_hit", fsPrefix, fpvObjList);
223 fpFitQaFirstHit->SetRootFolderName(fsRootFolderName + "/fst_hit");
224 fpFitQaFirstHit->SetTitle("First hit");
225 fpFitQaFirstHit->SetResidualHistoProperties(ETrackParType::kY, 200, -0.004, +0.004);
226 fpFitQaFirstHit->Init();
227
228 fpFitQaLastHit = std::make_unique<TrackFitQa>("lst_hit", fsPrefix, fpvObjList);
229 fpFitQaLastHit->SetRootFolderName(fsRootFolderName + "/lst_hit");
230 fpFitQaLastHit->SetTitle("Last hit");
231 fpFitQaLastHit->SetResidualHistoProperties(ETrackParType::kX, 200, -0.02, +0.02);
232 fpFitQaLastHit->Init();
233
234 fpFitQaVertex = std::make_unique<TrackFitQa>("vertex", fsPrefix, fpvObjList);
235 fpFitQaVertex->SetRootFolderName(fsRootFolderName + "/vertex");
236 fpFitQaVertex->SetTitle("Vertex");
237 fpFitQaVertex->SetResidualHistoProperties(ETrackParType::kX, 200, -0.05, +0.05);
238 fpFitQaVertex->SetResidualHistoProperties(ETrackParType::kY, 200, -0.05, +0.05);
239 fpFitQaVertex->SetResidualHistoProperties(ETrackParType::kTX, 200, -0.01, +0.01);
240 fpFitQaVertex->Init();
241
242 fpFitQaTrd = std::make_unique<TrackFitQa>("trd", fsPrefix, fpvObjList);
243 fpFitQaTrd->SetRootFolderName(fsRootFolderName + "/trd");
244 fpFitQaTrd->SetTitle("Trd");
245 fpFitQaTrd->SetResidualHistoProperties(ETrackParType::kX, 200, -5., +5.);
246 fpFitQaTrd->SetResidualHistoProperties(ETrackParType::kY, 200, -5., +5.);
247 fpFitQaTrd->SetResidualHistoProperties(ETrackParType::kTX, 200, -0.05, +0.05);
248 fpFitQaTrd->SetResidualHistoProperties(ETrackParType::kTY, 200, -0.05, +0.05);
249 fpFitQaTrd->Init();
250 }
251}
252
253// ---------------------------------------------------------------------------------------------------------------------
254//
255void TrackTypeQa::FillRecoTrack(int iTrkReco, const FitQaPointSet& fitPoints, double weight)
256{
257 const auto& recoTrack = (*fpvRecoTracks)[iTrkReco];
258 const auto& fstHit = (*fpvHits)[recoTrack.GetFirstHitIndex()];
259 const auto& lstHit = (*fpvHits)[recoTrack.GetLastHitIndex()];
260
261 fph_reco_p->Fill(recoTrack.GetP(), weight);
262 fph_reco_pt->Fill(recoTrack.GetPt(), weight);
263 fph_reco_eta->Fill(recoTrack.GetEta(), weight);
264 fph_reco_phi->Fill(recoTrack.GetPhi(), weight);
265 fph_reco_theta->Fill(recoTrack.GetTheta(), weight);
266 fph_reco_theta_phi->Fill(recoTrack.GetPhi(), recoTrack.GetTheta(), weight);
267 fph_reco_tx->Fill(recoTrack.GetTx(), weight);
268 fph_reco_ty->Fill(recoTrack.GetTy(), weight);
269 fph_reco_ty_tx->Fill(recoTrack.GetTx(), recoTrack.GetTy(), weight);
270 fph_reco_nhits->Fill(recoTrack.GetNofHits(), weight);
271 fph_reco_fhitR->Fill(fstHit.GetR());
272 fph_reco_fsta->Fill(fstHit.GetStationId(), weight);
273 fph_reco_lsta->Fill(lstHit.GetStationId(), weight);
274 fph_reco_chi2_ndf->Fill(recoTrack.GetChiSq() / recoTrack.GetNdf());
275 fph_reco_chi2_ndf_time->Fill(recoTrack.GetChiSqTime() / recoTrack.GetNdfTime());
276
278
279 int iTrkMC = recoTrack.GetMatchedMCTrackIndex();
280
281 if (fbUseMC && iTrkMC >= 0) {
282
283 const auto& mcTrack = fpMCData->GetTrack(iTrkMC);
284
285 fph_reco_pMC->Fill(mcTrack.GetP(), weight);
286 fph_reco_ptMC->Fill(mcTrack.GetPt(), weight);
287 fph_reco_yMC->Fill(mcTrack.GetRapidity(), weight);
288 fph_reco_etaMC->Fill(mcTrack.GetEta(), weight);
289 fph_reco_ptMC_yMC->Fill(mcTrack.GetRapidity(), mcTrack.GetPt(), weight);
290 fph_reco_phiMC->Fill(mcTrack.GetPhi(), weight);
291 fph_reco_thetaMC->Fill(mcTrack.GetTheta(), weight);
292 fph_reco_thetaMC_phiMC->Fill(mcTrack.GetPhi(), mcTrack.GetTheta(), weight);
293 fph_reco_txMC->Fill(mcTrack.GetTx(), weight);
294 fph_reco_tyMC->Fill(mcTrack.GetTy(), weight);
295
296 // *****************************
297 // ** Track fit parameters QA **
298 // *****************************
299
300 if (fitPoints.firstHit.isFilled) {
301 fpFitQaFirstHit->Fill(fitPoints.firstHit.trackParam, fitPoints.firstHit.mcPoint, fitPoints.isTimeFitted);
302 }
303
304 if (fitPoints.lastHit.isFilled) {
305 fpFitQaLastHit->Fill(fitPoints.lastHit.trackParam, fitPoints.lastHit.mcPoint, fitPoints.isTimeFitted);
306 }
307
308 if (fitPoints.vertex.isFilled) {
309 fpFitQaVertex->Fill(fitPoints.vertex.trackParam, fitPoints.vertex.mcPoint, fitPoints.isTimeFitted);
310 }
311
312 if (fitPoints.trd.isFilled) {
313 fpFitQaTrd->Fill(fitPoints.trd.trackParam, fitPoints.trd.mcPoint, fitPoints.isTimeFitted);
314 }
315 }
316}
317
318// ---------------------------------------------------------------------------------------------------------------------
319//
320void TrackTypeQa::FillMCTrack(int iTrkMC, double weight)
321{
322 assert(fbUseMC);
323 const McTrack& mcTrack = fpMCData->GetTrack(iTrkMC);
324
325 // ** Distributions **
326 fph_mc_pMC->Fill(mcTrack.GetP(), weight);
327 fph_mc_etaMC->Fill(mcTrack.GetEta(), weight);
328 fph_mc_yMC->Fill(mcTrack.GetRapidity(), weight);
329 fph_mc_ptMC_yMC->Fill(mcTrack.GetRapidity(), mcTrack.GetPt(), weight);
330 fph_mc_ptMC->Fill(mcTrack.GetPt(), weight);
331 fph_mc_phiMC->Fill(mcTrack.GetPhi(), weight);
332 fph_mc_thetaMC->Fill(mcTrack.GetTheta(), weight);
333 fph_mc_thetaMC_phiMC->Fill(mcTrack.GetPhi(), mcTrack.GetTheta(), weight);
334 fph_mc_txMC->Fill(mcTrack.GetTx(), weight);
335 fph_mc_tyMC->Fill(mcTrack.GetTy(), weight);
336 fph_mc_tyMC_txMC->Fill(mcTrack.GetTx(), mcTrack.GetTy(), weight);
337
338 // ** Efficiencies **
339 bool bReco = mcTrack.IsReconstructed();
340 bool bKilled = !bReco && mcTrack.IsDisturbed();
341 double nStaWithHit = mcTrack.GetTotNofStationsWithHit();
342 double nStaWithPoint = mcTrack.GetTotNofStationsWithPoint();
343 int nClones = mcTrack.GetNofClones();
344
345 // NOTE: Weight is ignored in efficiencies
346 fph_rate_reco->Fill(0., bReco);
347 fph_rate_killed->Fill(0., bKilled);
348 fph_rate_clones->Fill(0., nClones);
349 fph_stations_hit->Fill(0., nStaWithHit);
350 fph_stations_point->Fill(0., nStaWithPoint);
351 fCounterClones += nClones;
352 ++fCounterMC;
353 static int statNclone = 0;
354
355 if (fpDebugger && mcTrack.IsReconstructable()) {
356 int istaMin = 999;
357 int istaMax = -1;
358 bool hitMissed[100];
359 for (int i = 0; i < 100; i++)
360 hitMissed[i] = true;
361 for (int ih = 0; ih < mcTrack.GetNofHits(); ih++) {
362 int id = mcTrack.GetHitIndexes()[ih];
363 int ista = (*fpvHits)[id].GetStationId();
364 if (ista < istaMin) istaMin = ista;
365 if (ista > istaMax) istaMax = ista;
366 hitMissed[ista] = false;
367 }
368 for (int ista = istaMin + 1; ista <= istaMax - 1; ista++) {
369 fpDebugger->FillNtuple("mcMissedHits", fCounterMC - 1, ista, mcTrack.GetP(), mcTrack.GetEta(),
370 mcTrack.GetRapidity(), mcTrack.GetPt(), mcTrack.GetTheta(), mcTrack.GetPhi(),
371 mcTrack.GetTx(), mcTrack.GetTy(), hitMissed[ista]);
372 }
373 }
374
375 if (bReco) { // NOTE: ghost tracks are ignored (?)
376 bool prn = (fpDebugger) && (mcTrack.GetNofClones() > 0) && mcTrack.IsPrimary() && (mcTrack.GetP() >= 1.)
377 && mcTrack.IsReconstructable();
378
379 prn = false;
380
381 if (prn) {
382 std::cout << "clones for mc track with " << mcTrack.GetTotNofStationsWithPoint() << " / "
383 << mcTrack.GetTotNofStationsWithHit() << " stations and " << mcTrack.GetNofHits() << " hits : ";
384 for (int ih = 0; ih < mcTrack.GetNofHits(); ih++) {
385 int id = mcTrack.GetHitIndexes()[ih];
386 std::cout << " (" << (*fpvHits)[id].GetStationId() << " " << id << ") ";
387 }
388 std::cout << std::endl;
389 std::cout << " mc track: " << mcTrack.ToString(2, true) << std::endl;
390 std::cout << " " << mcTrack.ToString(2, false) << std::endl;
391 statNclone++;
392 }
393 int icl = 0;
394 for (auto iTrkReco : mcTrack.GetRecoTrackIndexes()) {
395 const auto& recoTrack = (*fpvRecoTracks)[iTrkReco];
396 fRecoLength += static_cast<double>(recoTrack.GetNofHits()) * recoTrack.GetMaxPurity() / nStaWithHit;
397 fFakeLength += (1. - recoTrack.GetMaxPurity());
398
399 if (prn) {
400 std::cout << " " << icl << " nhits " << recoTrack.GetNofHits() << " purity " << recoTrack.GetMaxPurity()
401 << " z " << recoTrack.GetZ() << " .. " << recoTrack.TLast.GetZ();
402 for (int ih = 0; ih < recoTrack.GetNofHits(); ih++) {
403 int id = recoTrack.GetHitIndexes()[ih];
404 auto h = (*fpvHits)[id];
405 std::cout << " (" << h.GetStationId() << " " << id << ") ";
406 if (fpDebugger) {
407 fpDebugger->FillNtuple("clone", statNclone - 1, icl, ih, mcTrack.GetP(), h.GetX(), h.GetY(), h.GetZ(),
408 h.GetT());
409 }
410 }
411 std::cout << std::endl;
412 }
413 icl++;
414 }
415 }
417
418 fph_eff_pMC->Fill(mcTrack.GetP(), bReco);
419 fph_eff_etaMC->Fill(mcTrack.GetEta(), bReco);
420 fph_eff_yMC->Fill(mcTrack.GetRapidity(), bReco);
421 fph_eff_ptMC->Fill(mcTrack.GetPt(), bReco);
422 fph_eff_thetaMC->Fill(mcTrack.GetTheta(), bReco);
423 fph_eff_phiMC->Fill(mcTrack.GetPhi(), bReco);
424 fph_eff_nhitsMC->Fill(mcTrack.GetTotNofStationsWithHit(), bReco);
425 fph_eff_txMC->Fill(mcTrack.GetTx(), bReco);
426 fph_eff_tyMC->Fill(mcTrack.GetTy(), bReco);
427
428 fph_eff_ptMC_yMC->Fill(mcTrack.GetRapidity(), mcTrack.GetPt(), bReco);
429 fph_eff_thetaMC_phiMC->Fill(mcTrack.GetPhi(), mcTrack.GetTheta(), bReco);
430
431 if (bReco) { // clone rate is normalised to the number of reconstructed tracks
432 fph_clone_pMC->Fill(mcTrack.GetP(), nClones);
433 fph_clone_etaMC->Fill(mcTrack.GetEta(), nClones);
434 fph_clone_yMC->Fill(mcTrack.GetRapidity(), nClones);
435 fph_clone_ptMC->Fill(mcTrack.GetPt(), nClones);
436 fph_clone_thetaMC->Fill(mcTrack.GetTheta(), nClones);
437 fph_clone_phiMC->Fill(mcTrack.GetPhi(), nClones);
438 fph_clone_nhitsMC->Fill(mcTrack.GetTotNofStationsWithHit(), nClones);
439 fph_clone_txMC->Fill(mcTrack.GetTx(), nClones);
440 fph_clone_tyMC->Fill(mcTrack.GetTy(), nClones);
441 fph_clone_ptMC_yMC->Fill(mcTrack.GetRapidity(), mcTrack.GetPt(), nClones);
442 fph_clone_thetaMC_phiMC->Fill(mcTrack.GetPhi(), mcTrack.GetTheta(), nClones);
443 }
444}
445
446// ---------------------------------------------------------------------------------------------------------------------
447//
448void TrackTypeQa::SetDrawAtt(Color_t markerCol, Style_t markerSty, Color_t lineCol, Style_t lineSty)
449{
450 fMarkerColor = markerCol;
451 fMarkerStyle = markerSty;
452 fLineColor = (lineCol > -1) ? lineCol : markerCol;
453 fLineStyle = lineSty;
454}
455
456// ---------------------------------------------------------------------------------------------------------------------
457//
458void TrackTypeQa::SetTH1Properties(TH1* pHist) const
459{
460 pHist->SetStats(true);
461 pHist->Sumw2();
462 pHist->SetMarkerStyle(fMarkerStyle);
463 pHist->SetLineStyle(fLineStyle);
464 pHist->SetMarkerColor(fMarkerColor);
465 pHist->SetLineColor(fLineColor);
466}
QA submodule for track fit results (residuals and puls) at selected z-coordinate (header)
QA submodule for different track types (header)
Generates beam ions for transport simulation.
T * MakeQaObject(TString sName, TString sTitle, Args... args)
Definition CbmQaIO.h:260
TString fsPrefix
Unique prefix for all writeable root.
Definition CbmQaIO.h:158
std::shared_ptr< ObjList_t > fpvObjList
List of registered ROOT objects.
Definition CbmQaIO.h:161
CbmQaIO(TString prefixName, std::shared_ptr< ObjList_t > pObjList=nullptr)
Constructor.
Definition CbmQaIO.cxx:19
TString fsRootFolderName
Name of root folder.
Definition CbmQaIO.h:156
@ kSAMEDIR
Objects of different type will be stored to root directory.
Definition CbmQaIO.h:49
EStoringMode fStoringMode
Objects storing mode.
Definition CbmQaIO.h:160
TrackTypeQa(const char *typeName, const char *prefixName, bool bUseMC, std::shared_ptr< ObjList_t > pObjList)
Constructor.
Class describes a unified MC-point, used in CA tracking QA analysis.
Definition CaMcPoint.h:33
double GetEta() const
Gets pseudo-rapidity.
Definition CaMcTrack.h:94
bool IsReconstructed() const
Definition CaMcTrack.h:252
bool IsReconstructable() const
Definition CaMcTrack.h:250
int GetNofClones() const
Gets number of clones.
Definition CaMcTrack.h:127
double GetPhi() const
Gets azimuthal angle [rad].
Definition CaMcTrack.h:154
bool IsPrimary() const
Returns flag, if the track is primary (process ID is 0 either mother ID is -1)
Definition CaMcTrack.h:246
int GetNofHits() const
Gets number of hits.
Definition CaMcTrack.h:136
std::string ToString(int verbose=1, bool header=false) const
Provides string representation of a track.
int GetTotNofStationsWithPoint() const
Gets total number of stations with MC points.
Definition CaMcTrack.h:202
bool IsDisturbed() const
Returns true, if this MC track.
Definition CaMcTrack.h:243
int GetTotNofStationsWithHit() const
Gets total number of stations with hits.
Definition CaMcTrack.h:199
double GetTx() const
Gets track slope along x-axis.
Definition CaMcTrack.h:205
double GetRapidity() const
Gets rapidity.
Definition CaMcTrack.h:175
double GetTheta() const
Gets track polar angle.
Definition CaMcTrack.h:196
double GetP() const
Gets absolute momentum [GeV/c].
Definition CaMcTrack.h:148
double GetTy() const
Gets track slope along y-axis.
Definition CaMcTrack.h:208
const auto & GetRecoTrackIndexes() const
Gets a reference to vector associated reconstructed track indexes.
Definition CaMcTrack.h:178
const auto & GetHitIndexes() const
Gets a reference to associated hit indexes.
Definition CaMcTrack.h:106
double GetPt() const
Gets transverse momentum [GeV/c].
Definition CaMcTrack.h:163
Magnetic field region, corresponding to a hit triplet.
Unified QA for a group of tracks.
static constexpr double kLoTY
Lower boundary, slope along y.
static constexpr double kLoCHI2NDF
Lower boundary, chi2 over NDF.
int fCounterMC
Counter of MC tracks.
static constexpr double kUpCHI2NDF
Upper boundary, chi2 over NDF.
bool fbUseMC
Flag: true - MC information is used.
TH1F * fph_mc_ptMC
Transverse momentum over charge of MC tracks.
TH1F * fph_reco_nhits
Hit number of reconstructed tracks.
std::unique_ptr< TrackFitQa > fpFitQaLastHit
static constexpr double kLoY
Lower boundary, rapidity.
TH1F * fph_reco_etaMC
MC pseudo-rapidity of reconstructed tracks.
void SetDrawAtt(Color_t markerCol=1, Style_t markerSty=20, Color_t lineCol=-1, Style_t lineSty=1)
Sets drawing attributes for histograms.
TH2F * fph_reco_ptMC_yMC
MC transverse momentum vs MC rapidity of reconstructed tracks.
TH1F * fph_reco_fhitR
Distance of the first hit from z-axis for reconstructed tracks.
TProfile * fph_clone_ptMC
Efficiency vs. MC transverse momentum.
TProfile * fph_clone_nhitsMC
Efficiency vs. MC number of hits (total number of stations with a)
TProfile * fph_stations_hit
Average number of stations with hit.
TProfile2D * fph_eff_ptMC_yMC
Efficiency vs. MC transverse momentum and MC rapidity.
static constexpr double kLoP
Lower boundary, total momentum [GeV/c].
static constexpr double kLoETA
Lower boundary, pseudo-rapidity.
Style_t fLineStyle
Line style.
static constexpr double kLoNSTA
Lower boundary, number of stations.
TH2F * fph_mc_thetaMC_phiMC
Polar angle vs. azimuthal angle of MC tracks.
static constexpr int kBinsTHETA
Number of bins, polar angle.
TH1F * fph_reco_tyMC
MC Slope along y-axis of reconstructed tracks.
static constexpr int kBinsCHI2NDF
Number of bins, chi2 over NDF.
TH1F * fph_reco_fsta
First station index of reconstructed tracks.
TH1F * fph_reco_phiMC
MC Azimuthal angle of reconstructed tracks.
int fCounterRecoTotal
Counter of reco tracks (total = reco + ghost + clones)
TH1F * fph_reco_txMC
MC Slope along x-axis of reconstructed tracks.
TH1F * fph_mc_phiMC
Azimuthal angle of MC tracks.
ca::Vector< CbmL1Track > * fpvRecoTracks
Pointer to vector of reconstructed tracks.
static constexpr int kBinsTX
Number of bins, slope along x.
static constexpr int kBinsFHITR
Number of bins, transverse dist. of the 1st hit from z-axis.
TProfile * fph_eff_pMC
Efficiency vs. MC momentum.
void FillRecoTrack(int iTrkReco, const FitQaPointSet &fitPoints, double weight=1)
Fills histograms with various track information.
double fMCLength
Total length of MC tracks.
cbm::algo::ca::utils::Debugger * fpDebugger
debugger
TH1F * fph_mc_pMC
MC total momentum over charge of MC tracks.
TProfile * fph_eff_yMC
Efficiency vs. MC rapidity.
TProfile * fph_eff_thetaMC
Efficiency vs. MC polar angle.
TH1F * fph_reco_lsta
Last station index of reconstructed tracks.
TH1F * fph_mc_txMC
Slope along x-axis of MC tracks.
TProfile * fph_clone_etaMC
Efficiency vs. MC pseudorapidity.
std::shared_ptr< const ca::Parameters< double > > fpParameters
Pointer to parameters object.
static constexpr int kBinsPT
Number of bins, transverse momentum.
TProfile * fph_rate_clones
Rate of clone tracks / mc.
TH1F * fph_reco_tx
Slope along x-axis of reconstructed tracks.
TProfile * fph_eff_ptMC
Efficiency vs. MC transverse momentum.
TH2F * fph_mc_ptMC_yMC
MC transverse momentum vs. MC rapidity of MC tracks.
static constexpr double kUpTX
Upper boundary, slope along x.
void Init()
Initializes histograms.
static constexpr double kLoPHI
Lower boundary, azimuthal angle [rad].
static constexpr double kUpTHETA
Upper boundary, polar angle [rad].
static constexpr double kUpNSTA
Upper boundary, number of stations.
static constexpr double kUpY
Upper boundary, rapidity.
Color_t fMarkerColor
Marker color.
TH1F * fph_reco_eta
Pseudo-rapidity of reconstructed tracks.
std::unique_ptr< TrackFitQa > fpFitQaFirstHit
TH1F * fph_reco_phi
Azimuthal angle of reconstructed tracks.
TH1F * fph_reco_ptMC
MC transverse momentum over charge of reconstructed tracks.
static constexpr int kBinsNHITS
Number of bins, number of hits.
TProfile2D * fph_clone_ptMC_yMC
Efficiency vs. MC transverse momentum and MC rapidity.
TH1F * fph_reco_chi2_ndf_time
Fit chi2 over NDF of reconstructed tracks for time.
static constexpr double kUpFHITR
Upper boundary, transverse dist. of the 1st hit from z-axis [cm].
TProfile * fph_clone_tyMC
Efficiency vs. MC slope along y-axis.
TH2F * fph_reco_ty_tx
Slope along x-axis vs y-axis of reconstructed tracks.
TProfile * fph_clone_phiMC
Efficiency vs. MC azimuthal angle.
double fFakeLength
Total length of fake tracks.
static constexpr int kBinsPHI
Number of bins, azimuthal angle.
TH2F * fph_reco_theta_phi
Polar angle vs. azimuthal angle of reconstructed tracks.
TH1F * fph_reco_chi2_ndf
Fit chi2 over NDF of reconstructed tracks.
static constexpr int kBinsP
Number of bins, total momentum.
TH1F * fph_mc_yMC
MC rapidity of MC tracks.
TH1F * fph_reco_ty
Slope along y-axis of reconstructed tracks.
TH1F * fph_mc_thetaMC
Polar angle of MC tracks.
static constexpr double kUpPT
Upper boundary, transverse momentum [GeV/c].
TProfile * fph_clone_pMC
Clone rate vs. MC momentum.
int fCounterClones
Counter of clone tracks.
TProfile * fph_clone_txMC
Efficiency vs. MC slope along x-axis.
static constexpr double kUpNHITS
Upper boundary, number of hits.
TProfile * fph_rate_killed
Rate of killed tracks / mc.
TProfile * fph_rate_reco
Rate of reconstructed tracks / mc.
TH2F * fph_mc_tyMC_txMC
Slope along x-axis vs y-axis of MC tracks.
cbm::algo::ca::McData * fpMCData
Pointer to MC data object.
TH1F * fph_reco_pMC
MC total momentum over charge of reconstructed tracks.
TProfile * fph_eff_txMC
Efficiency vs. MC slope along x-axis.
TH1F * fph_reco_yMC
MC rapidity of reconstructed tracks.
TProfile * fph_eff_nhitsMC
Efficiency vs. MC number of hits (total number of stations with a)
static constexpr double kUpPHI
Upper boundary, azimuthal angle [rad].
Color_t fLineColor
Line color.
TProfile2D * fph_clone_thetaMC_phiMC
Efficiency vs. MC theta and MC phi.
TProfile * fph_eff_phiMC
Efficiency vs. MC azimuthal angle.
TProfile2D * fph_eff_thetaMC_phiMC
Efficiency vs. MC theta and MC phi.
TH1F * fph_mc_etaMC
MC pseudo-rapidity of MC tracks.
TH1F * fph_reco_pt
Transverse momentum over charge of reconstructed tracks.
TH1F * fph_reco_p
Total momentum over charge of reconstructed tracks.
std::unique_ptr< TrackFitQa > fpFitQaVertex
static constexpr double kLoTHETA
Lower boundary, polar angle [rad].
static constexpr double kLoNHITS
Lower boundary, number of hits.
static constexpr double kUpTY
Upper boundary, slope along y.
TH1F * fph_reco_thetaMC
MC Polar angle of reconstructed tracks.
double fRecoLength
Total length of reconstructed tracks.
static constexpr double kLoPT
Lower boundary, transverse momentum [GeV/c].
TH2F * fph_reco_thetaMC_phiMC
MC Polar angle vs. azimuthal angle of reconstructed tracks.
ca::Vector< cbm::algo::ca::McHitInfo > * fpvHits
Pointer to vector of reconstructed hits.
TProfile * fph_eff_tyMC
Efficiency vs. MC slope along y-axis.
TProfile * fph_eff_int
Integrated efficiency.
std::unique_ptr< TrackFitQa > fpFitQaTrd
static constexpr int kBinsTY
Number of bins, slope along y.
static constexpr double kLoTX
Lower boundary, slope along x.
TProfile * fph_eff_etaMC
Efficiency vs. MC pseudorapidity.
virtual void SetTH1Properties(TH1 *pHist) const override
Overrided virtual function of the CbmQaIO class, defines properties of the histograms.
TH1F * fph_reco_theta
Polar angle of reconstructed tracks.
static constexpr int kBinsNSTA
Number of bins, number of stations.
TProfile * fph_clone_thetaMC
Efficiency vs. MC polar angle.
TProfile * fph_clone_yMC
Efficiency vs. MC rapidity.
void FillMCTrack(int iTrkMC, double weight=1)
Fills histograms with mc track information.
static constexpr int kBinsY
Number of bins, rapidity.
static constexpr double kLoFHITR
Lower boundary, transverse dist. of the 1st hit from z-axis [cm].
static constexpr int kBinsETA
Number of bins, pseudo-rapidity.
TH1F * fph_mc_tyMC
Slope along y-axis of MC tracks.
static constexpr double kUpETA
Upper boundary, pseudo-rapidity.
Style_t fMarkerStyle
Marker style.
static constexpr double kUpP
Upper boundary, total momentum [GeV/c].
TProfile * fph_stations_point
Average number of stations with MC point.
@ kTY
slope along y-axis
@ kTX
slope along x-axis
FitQaPoint firstHit
First hit point.
bool isTimeFitted
Flag: true - time is fitted, false - time is not fitted.
FitQaPoint lastHit
Last hit point.
cbm::algo::kf::TrackParamD trackParam