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 "CaToolsMCData.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->Init();
226
227 fpFitQaLastHit = std::make_unique<TrackFitQa>("lst_hit", fsPrefix, fpvObjList);
228 fpFitQaLastHit->SetRootFolderName(fsRootFolderName + "/lst_hit");
229 fpFitQaLastHit->SetTitle("Last hit");
230 fpFitQaLastHit->SetResidualHistoProperties(ETrackParType::kX, 200, -0.4, +0.4);
231 fpFitQaLastHit->SetResidualHistoProperties(ETrackParType::kY, 200, -0.8, +0.8);
232 fpFitQaLastHit->Init();
233
234 fpFitQaVertex = std::make_unique<TrackFitQa>("vertex", fsPrefix, fpvObjList);
235 fpFitQaVertex->SetRootFolderName(fsRootFolderName + "/vertex");
236 fpFitQaVertex->SetTitle("Vertex");
237 fpFitQaVertex->Init();
238 }
239
240 // Track fitter
241 fTrackFit.SetDoFitVelocity(true); // TODO: set flag to the configuration
242 fTrackFit.SetMask(true);
244}
245
246// ---------------------------------------------------------------------------------------------------------------------
247//
248void TrackTypeQa::FillRecoTrack(int iTrkReco, double weight)
249{
250 const auto& recoTrack = (*fpvRecoTracks)[iTrkReco];
251 const auto& fstHit = (*fpvHits)[recoTrack.GetFirstHitIndex()];
252 const auto& lstHit = (*fpvHits)[recoTrack.GetLastHitIndex()];
253
254 fph_reco_p->Fill(recoTrack.GetP(), weight);
255 fph_reco_pt->Fill(recoTrack.GetPt(), weight);
256 fph_reco_eta->Fill(recoTrack.GetEta(), weight);
257 fph_reco_phi->Fill(recoTrack.GetPhi(), weight);
258 fph_reco_theta->Fill(recoTrack.GetTheta(), weight);
259 fph_reco_theta_phi->Fill(recoTrack.GetPhi(), recoTrack.GetTheta(), weight);
260 fph_reco_tx->Fill(recoTrack.GetTx(), weight);
261 fph_reco_ty->Fill(recoTrack.GetTy(), weight);
262 fph_reco_ty_tx->Fill(recoTrack.GetTx(), recoTrack.GetTy(), weight);
263 fph_reco_nhits->Fill(recoTrack.GetNofHits(), weight);
264 fph_reco_fhitR->Fill(fstHit.GetR());
265 fph_reco_fsta->Fill(fstHit.GetStationId(), weight);
266 fph_reco_lsta->Fill(lstHit.GetStationId(), weight);
267 fph_reco_chi2_ndf->Fill(recoTrack.GetChiSq() / recoTrack.GetNdf());
268 fph_reco_chi2_ndf_time->Fill(recoTrack.GetChiSqTime() / recoTrack.GetNdfTime());
269
271 if (fbUseMC) {
272 int iTrkMC = recoTrack.GetMatchedMCTrackIndex();
273 if (iTrkMC > -1) {
275 const auto& mcTrack = fpMCData->GetTrack(iTrkMC);
276 fph_reco_pMC->Fill(mcTrack.GetP(), weight);
277 fph_reco_ptMC->Fill(mcTrack.GetPt(), weight);
278 fph_reco_yMC->Fill(mcTrack.GetRapidity(), weight);
279 fph_reco_etaMC->Fill(mcTrack.GetEta(), weight);
280 fph_reco_ptMC_yMC->Fill(mcTrack.GetRapidity(), mcTrack.GetPt(), weight);
281 fph_reco_phiMC->Fill(mcTrack.GetPhi(), weight);
282 fph_reco_thetaMC->Fill(mcTrack.GetTheta(), weight);
283 fph_reco_thetaMC_phiMC->Fill(mcTrack.GetPhi(), mcTrack.GetTheta(), weight);
284 fph_reco_txMC->Fill(mcTrack.GetTx(), weight);
285 fph_reco_tyMC->Fill(mcTrack.GetTy(), weight);
286
287 // *****************************
288 // ** Track fit parameters QA **
289 // *****************************
290
291 int nTimeMeasurements = 0;
292 for (int iH : recoTrack.GetHitIndexes()) {
293 int iSt = (*fpvHits)[iH].GetStationId();
294 if (fpParameters->GetStation(iSt).timeInfo) {
295 ++nTimeMeasurements;
296 }
297 }
298 bool isTimeFitted = (nTimeMeasurements > 1);
299
300 // ** First hit **
301 fTrackFit.SetParticleMass(mcTrack.GetMass());
302 {
303 int iHfst = recoTrack.GetFirstHitIndex();
304 int iPfst = (*fpvHits)[iHfst].GetBestMcPointId();
305 if (iPfst > -1) {
306 const auto& mcPoint = fpMCData->GetPoint(iPfst);
307 TrackParamV trPar(recoTrack);
308 fpFitQaFirstHit->Fill(trPar, mcPoint, isTimeFitted);
309 }
310 }
311
312 // ** Last hit **
313 {
314 int iHlst = recoTrack.GetLastHitIndex();
315 int iPlst = (*fpvHits)[iHlst].GetBestMcPointId();
316 if (iPlst > -1) {
317 const auto& mcPoint = fpMCData->GetPoint(iPlst);
318 TrackParamV trPar(recoTrack.TLast);
319 fpFitQaLastHit->Fill(trPar, mcPoint, isTimeFitted);
320 }
321 }
322
323 // ** Vertex **
324 {
325 // Create an MC point for track vertex
326 MCPoint mcTrkVertex = mcTrack.GetVertexPoint();
327 kf::TrackParamD trPar(recoTrack);
328 fTrackFit.SetTrack(trPar);
329
330 // Add material effects
331 int iStFst = (*fpvHits)[recoTrack.GetFirstHitIndex()].GetStationId();
332 double dZ = mcTrkVertex.GetZ() - fpParameters->GetStation(iStFst).GetZ();
333 int direction = (dZ > 0.) ? 1 : -1;
334 for (int iSt = iStFst; (iSt >= 0) && (iSt < fpParameters->GetNstationsActive())
335 && (direction * (mcTrkVertex.GetZ() - fpParameters->GetStation(iSt).GetZ()) > 0);
336 iSt += direction) {
337 fTrackFit.Extrapolate(fpParameters->GetStation(iSt).fZ, fFieldRegion);
338 auto radThick = fpParameters->GetActiveSetup().GetMaterial(iSt).GetThicknessX0(fTrackFit.Tr().GetX(),
339 fTrackFit.Tr().GetY());
342 (direction > 0) ? kf::FitDirection::kDownstream : kf::FitDirection::kUpstream);
343 }
344 fTrackFit.Extrapolate(mcTrkVertex.GetZ(), fFieldRegion);
345 const TrackParamV& trParExtr = fTrackFit.Tr();
346 if (mcTrkVertex.GetZ() == trParExtr.GetZ()[0]) {
347 fpFitQaVertex->Fill(trParExtr, mcTrkVertex, isTimeFitted);
348 }
349 else {
350 LOG(warn) << "iTrkReco = " << iTrkReco << ", mcTrkVertex = " << mcTrkVertex.GetZ()
351 << ", par = " << trParExtr.GetZ()[0];
352 }
353 }
354 }
355 }
356}
357
358// ---------------------------------------------------------------------------------------------------------------------
359//
360void TrackTypeQa::FillMCTrack(int iTrkMC, double weight)
361{
362 assert(fbUseMC);
363 const MCTrack& mcTrack = fpMCData->GetTrack(iTrkMC);
364
365 // ** Distributions **
366 fph_mc_pMC->Fill(mcTrack.GetP(), weight);
367 fph_mc_etaMC->Fill(mcTrack.GetEta(), weight);
368 fph_mc_yMC->Fill(mcTrack.GetRapidity(), weight);
369 fph_mc_ptMC_yMC->Fill(mcTrack.GetRapidity(), mcTrack.GetPt(), weight);
370 fph_mc_ptMC->Fill(mcTrack.GetPt(), weight);
371 fph_mc_phiMC->Fill(mcTrack.GetPhi(), weight);
372 fph_mc_thetaMC->Fill(mcTrack.GetTheta(), weight);
373 fph_mc_thetaMC_phiMC->Fill(mcTrack.GetPhi(), mcTrack.GetTheta(), weight);
374 fph_mc_txMC->Fill(mcTrack.GetTx(), weight);
375 fph_mc_tyMC->Fill(mcTrack.GetTy(), weight);
376 fph_mc_tyMC_txMC->Fill(mcTrack.GetTx(), mcTrack.GetTy(), weight);
377
378 // ** Efficiencies **
379 bool bReco = mcTrack.IsReconstructed();
380 bool bKilled = !bReco && mcTrack.IsDisturbed();
381 double nStaWithHit = mcTrack.GetTotNofStationsWithHit();
382 double nStaWithPoint = mcTrack.GetTotNofStationsWithPoint();
383 int nClones = mcTrack.GetNofClones();
384
385 // NOTE: Weight is ignored in efficiencies
386 fph_rate_reco->Fill(0., bReco);
387 fph_rate_killed->Fill(0., bKilled);
388 fph_rate_clones->Fill(0., nClones);
389 fph_stations_hit->Fill(0., nStaWithHit);
390 fph_stations_point->Fill(0., nStaWithPoint);
391 fCounterClones += nClones;
392 ++fCounterMC;
393 if (bReco) { // NOTE: ghost tracks are ignored (?)
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 }
401
402 fph_eff_pMC->Fill(mcTrack.GetP(), bReco);
403 fph_eff_etaMC->Fill(mcTrack.GetEta(), bReco);
404 fph_eff_yMC->Fill(mcTrack.GetRapidity(), bReco);
405 fph_eff_ptMC->Fill(mcTrack.GetPt(), bReco);
406 fph_eff_thetaMC->Fill(mcTrack.GetTheta(), bReco);
407 fph_eff_phiMC->Fill(mcTrack.GetPhi(), bReco);
408 fph_eff_nhitsMC->Fill(mcTrack.GetTotNofStationsWithHit(), bReco);
409 fph_eff_txMC->Fill(mcTrack.GetTx(), bReco);
410 fph_eff_tyMC->Fill(mcTrack.GetTy(), bReco);
411
412 fph_eff_ptMC_yMC->Fill(mcTrack.GetRapidity(), mcTrack.GetPt(), bReco);
413 fph_eff_thetaMC_phiMC->Fill(mcTrack.GetPhi(), mcTrack.GetTheta(), bReco);
414
415 if (bReco) { // clone rate is normalised to the number of reconstructed tracks
416 fph_clone_pMC->Fill(mcTrack.GetP(), nClones);
417 fph_clone_etaMC->Fill(mcTrack.GetEta(), nClones);
418 fph_clone_yMC->Fill(mcTrack.GetRapidity(), nClones);
419 fph_clone_ptMC->Fill(mcTrack.GetPt(), nClones);
420 fph_clone_thetaMC->Fill(mcTrack.GetTheta(), nClones);
421 fph_clone_phiMC->Fill(mcTrack.GetPhi(), nClones);
422 fph_clone_nhitsMC->Fill(mcTrack.GetTotNofStationsWithHit(), nClones);
423 fph_clone_txMC->Fill(mcTrack.GetTx(), nClones);
424 fph_clone_tyMC->Fill(mcTrack.GetTy(), nClones);
425 fph_clone_ptMC_yMC->Fill(mcTrack.GetRapidity(), mcTrack.GetPt(), nClones);
426 fph_clone_thetaMC_phiMC->Fill(mcTrack.GetPhi(), mcTrack.GetTheta(), nClones);
427 }
428}
429
430// ---------------------------------------------------------------------------------------------------------------------
431//
432void TrackTypeQa::SetDrawAtt(Color_t markerCol, Style_t markerSty, Color_t lineCol, Style_t lineSty)
433{
434 fMarkerColor = markerCol;
435 fMarkerStyle = markerSty;
436 fLineColor = (lineCol > -1) ? lineCol : markerCol;
437 fLineStyle = lineSty;
438}
439
440// ---------------------------------------------------------------------------------------------------------------------
441//
442void TrackTypeQa::SetTH1Properties(TH1* pHist) const
443{
444 pHist->SetStats(true);
445 pHist->Sumw2();
446 pHist->SetMarkerStyle(fMarkerStyle);
447 pHist->SetLineStyle(fLineStyle);
448 pHist->SetMarkerColor(fMarkerColor);
449 pHist->SetLineColor(fLineColor);
450}
Data structure for internal tracking MC-information (header)
QA submodule for track fit results (residuals and puls) at selected z-coordinate (header)
QA submodule for different track types (header)
ROOT object IO interface for QA.
Definition CbmQaIO.h:44
T * MakeQaObject(TString sName, TString sTitle, Args... args)
Definition CbmQaIO.h:261
TString fsPrefix
Unique prefix for all writeable root.
Definition CbmQaIO.h:159
std::shared_ptr< ObjList_t > fpvObjList
List of registered ROOT objects.
Definition CbmQaIO.h:162
TString fsRootFolderName
Name of root folder.
Definition CbmQaIO.h:157
@ kSAMEDIR
Objects of different type will be stored to root directory.
EStoringMode fStoringMode
Objects storing mode.
Definition CbmQaIO.h:161
Magnetic field region, corresponding to a hit triplet.
static EFieldType fgOriginalFieldType
Global field type.
static FieldFn_t fgOriginalField
Global variable to store the fielf funciton (x,y,z)->(Bx,By,Bz)
void Extrapolate(DataT z, const kf::FieldRegion< DataT > &F)
kf::TrackParam< DataT > & Tr()
void MultipleScattering(DataT radThick, DataT tx0, DataT ty0, DataT qp0)
apply multiple scattering correction to the track with the given Qp0
void EnergyLossCorrection(DataT radThick, FitDirection direction)
void SetParticleMass(DataT mass)
set particle mass for the fit
void SetTrack(const kf::TrackParam< T > &t)
T GetZ() const
Gets z position [cm].
T GetY() const
Gets y position [cm].
T GetX() const
Gets x position [cm].
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.
tools::MCData * fpMCData
Pointer to MC data object.
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
void FillRecoTrack(int iTrkReco, double weight=1)
Fills histograms with various track information.
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.
ca::Vector< CbmL1HitDebugInfo > * fpvHits
Pointer to vector of reconstructed hits.
double fMCLength
Total length of MC tracks.
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.
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.
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.
std::shared_ptr< ca::Parameters< float > > fpParameters
Pointer to parameters object.
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.
cbm::algo::kf::TrackKalmanFilter< double > fTrackFit
Track fitter.
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.
cbm::algo::kf::FieldRegion< double > fFieldRegion
Magnetic field.
TProfile * fph_eff_tyMC
Efficiency vs. MC slope along y-axis.
TProfile * fph_eff_int
Integrated efficiency.
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].
TrackTypeQa(const char *typeName, const char *prefixName, bool bUseMC, std::shared_ptr< ObjList_t > pObjList)
Constructor.
TProfile * fph_stations_point
Average number of stations with MC point.
const auto & GetTrack(int idx) const
Gets a reference to MC track by its internal index.
const auto & GetPoint(int idx) const
Gets a reference to MC point by its index.
Class describes a unified MC-point, used in CA tracking QA analysis.
double GetZ() const
Gets z coordinate at reference z of station [cm].
double GetPt() const
Gets transverse momentum [GeV/c].
double GetTy() const
Gets track slope along y-axis.
int GetTotNofStationsWithPoint() const
Gets total number of stations with MC points.
double GetEta() const
Gets pseudo-rapidity.
const auto & GetRecoTrackIndexes() const
Gets a reference to vector associated reconstructed track indexes.
double GetRapidity() const
Gets rapidity.
double GetPhi() const
Gets azimuthal angle [rad].
double GetTx() const
Gets track slope along x-axis.
double GetP() const
Gets absolute momentum [GeV/c].
int GetTotNofStationsWithHit() const
Gets total number of stations with hits.
double GetTheta() const
Gets track polar angle.
int GetNofClones() const
Gets number of clones.
bool IsDisturbed() const
Returns true, if this MC track.