Project
Loading...
Searching...
No Matches
TrackCheck.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
20
21#include "Framework/Task.h"
25
26#include <TH1D.h>
27#include <TH1I.h>
28#include <TH1.h>
29#include <TH2D.h>
30#include <TCanvas.h>
31#include <TEfficiency.h>
32#include <TStyle.h>
33#include <TLegend.h>
34#include <TGraphErrors.h>
35#include <TF1.h>
36#include <TObjArray.h>
37#include <THStack.h>
38#include <TString.h>
39
40namespace o2::its::study
41{
42using namespace o2::framework;
43using namespace o2::globaltracking;
44
47class TrackCheckStudy : public Task
48{
49 struct ParticleInfo {
50 int event;
51 int pdg;
52 float pt;
53 float eta;
54 float phi;
55 int mother;
56 int first;
57 float vx;
58 float vy;
59 float vz;
60 int unsigned short clusters = 0u;
61 unsigned char isReco = 0u;
62 unsigned char isFake = 0u;
63 bool isPrimary = false;
64 unsigned char storedStatus = 2;
65 const char* prodProcessName;
66 int prodProcess;
68 };
69
70 public:
71 TrackCheckStudy(std::shared_ptr<DataRequest> dr,
72 mask_t src,
73 bool useMC,
74 std::shared_ptr<o2::steer::MCKinematicsReader> kineReader,
75 std::shared_ptr<o2::base::GRPGeomRequest> gr) : mDataRequest(dr), mTracksSrc(src), mKineReader(kineReader), mGGCCDBRequest(gr)
76 {
77 if (useMC) {
78 LOGP(info, "Read MCKine reader with {} sources", mKineReader->getNSources());
79 }
80 }
81
82 ~TrackCheckStudy() final = default;
83 void init(InitContext&) final;
84 void run(ProcessingContext&) final;
86 void finaliseCCDB(ConcreteDataMatcher&, void*) final;
87 void initialiseRun(o2::globaltracking::RecoContainer&);
88 void process();
89 void setEfficiencyGraph(std::unique_ptr<TEfficiency>&, const char*, const char*, const int, const double, const double, const int, const double);
90
91 private:
92 void updateTimeDependentParams(ProcessingContext& pc);
93 std::string mOutFileName = "TrackCheckStudy.root";
94 std::shared_ptr<MCKinematicsReader> mKineReader;
95 GeometryTGeo* mGeometry;
96
97 // Spans
98 gsl::span<const o2::itsmft::ROFRecord> mTracksROFRecords;
99 gsl::span<const o2::its::TrackITS> mTracks;
100 gsl::span<const o2::MCCompLabel> mTracksMCLabels;
101 gsl::span<const o2::itsmft::CompClusterExt> mClusters;
102 gsl::span<const int> mInputITSidxs;
103 const o2::dataformats::MCLabelContainer* mClustersMCLCont;
104
105 // Data
106 GTrackID::mask_t mTracksSrc{};
107 std::shared_ptr<DataRequest> mDataRequest;
108 std::vector<std::vector<std::vector<ParticleInfo>>> mParticleInfo; // src/event/track
109 unsigned short mMask = 0x7f;
110
111 // Utils
112 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
113
114 // Histos
115 std::unique_ptr<TH1D> mGoodPt;
116 std::unique_ptr<TH1D> mGoodEta;
117 std::unique_ptr<TH1D> mGoodPtSec;
118 std::unique_ptr<TH1D> mGoodEtaSec;
119 std::unique_ptr<TH1D> mGoodChi2;
120 std::unique_ptr<TH1D> mFakePt;
121 std::unique_ptr<TH1D> mFakeEta;
122 std::unique_ptr<TH1D> mFakePtSec;
123 std::unique_ptr<TH1D> mFakeEtaSec;
124 std::unique_ptr<TH1D> mMultiFake;
125 std::unique_ptr<TH1D> mFakeChi2;
126 std::unique_ptr<TH1D> mClonePt;
127 std::unique_ptr<TH1D> mCloneEta;
128
129 std::unique_ptr<TH1D> mDenominatorPt;
130 std::unique_ptr<TH1D> mDenominatorEta;
131 std::unique_ptr<TH1D> mDenominatorPtSec;
132 std::unique_ptr<TH1D> mDenominatorEtaSec;
133
134 std::unique_ptr<TH2D> processvsZ; // TH2D with production process
135 std::unique_ptr<TH2D> processvsRad;
136 std::unique_ptr<TH2D> processvsRadOther;
137 std::unique_ptr<TH2D> processvsRadNotTracked;
138 std::unique_ptr<TH2D> processvsEtaNotTracked;
139
140 std::unique_ptr<TEfficiency> mEffPt; // Eff vs Pt primary
141 std::unique_ptr<TEfficiency> mEffFakePt;
142 std::unique_ptr<TEfficiency> mEffClonesPt;
143 std::unique_ptr<TEfficiency> mEffEta; // Eff vs Eta primary
144 std::unique_ptr<TEfficiency> mEffFakeEta;
145 std::unique_ptr<TEfficiency> mEffClonesEta;
146
147 std::unique_ptr<TEfficiency> mEffPtSec; // Eff vs Pt secondary
148 std::unique_ptr<TEfficiency> mEffFakePtSec;
149 std::unique_ptr<TEfficiency> mEffEtaSec; // Eff vs Eta secondary
150 std::unique_ptr<TEfficiency> mEffFakeEtaSec;
151
152 std::unique_ptr<TH1D> mPtResolution; // Pt resolution for both primary and secondary
153 std::unique_ptr<TH2D> mPtResolution2D;
154 std::unique_ptr<TH1D> mPtResolutionSec;
155 std::unique_ptr<TH1D> mPtResolutionPrim;
156 std::unique_ptr<TGraphErrors> g1;
157
158 const char* ParticleName[7] = {"e^{-/+}", "#pi^{-/+}", "p", "^{2}H", "^{3}He", "_{#Lambda}^{3}H", "k^{+/-}"};
159 const int PdgcodeClusterFake[7] = {11, 211, 2212, 1000010020, 100002030, 1010010030, 321};
160 const char* name[3] = {"_{#Lambda}^{3}H", "#Lambda", "k^{0}_{s}"};
161 const char* particleToanalize[4] = {"IperT", "Lambda", "k0s", "Tot"}; // [3]=Total of secondary particle
162 const int PDG[3] = {1010010030, 3122, 310};
163 const char* ProcessName[50];
164 int colorArr[4] = {kGreen, kRed, kBlue, kOrange};
165
166 std::vector<std::vector<TH1I*>> histLength, histLength1Fake, histLength2Fake, histLength3Fake, histLengthNoCl, histLength1FakeNoCl, histLength2FakeNoCl, histLength3FakeNoCl; // FakeCluster Study
167 std::vector<THStack*> stackLength, stackLength1Fake, stackLength2Fake, stackLength3Fake;
168 std::vector<TLegend*> legends, legends1Fake, legends2Fake, legends3Fake;
169 std::vector<std::unique_ptr<TH2D>> mClusterFake;
170 std::vector<std::vector<std::unique_ptr<TH1D>>> mGoodPts, mFakePts, mTotPts, mGoodEtas, mTotEtas, mFakeEtas;
171 std::vector<std::vector<std::unique_ptr<TEfficiency>>> mEffGoodPts, mEffFakePts, mEffGoodEtas, mEffFakeEtas;
172 std::vector<std::unique_ptr<TH1D>> mGoodRad, mFakeRad, mTotRad, mGoodZ, mFakeZ, mTotZ;
173 std::vector<std::unique_ptr<TEfficiency>> mEffGoodRad, mEffFakeRad, mEffGoodZ, mEffFakeZ;
174 // Canvas & decorations
175 std::unique_ptr<TCanvas> mCanvasPt;
176 std::unique_ptr<TCanvas> mCanvasPtSec;
177 std::unique_ptr<TCanvas> mCanvasPt2;
178 std::unique_ptr<TCanvas> mCanvasPt2fake;
179 std::unique_ptr<TCanvas> mCanvasEta;
180 std::unique_ptr<TCanvas> mCanvasEtaSec;
181 std::unique_ptr<TCanvas> mCanvasRad;
182 std::unique_ptr<TCanvas> mCanvasZ;
183 std::unique_ptr<TCanvas> mCanvasRadD;
184 std::unique_ptr<TCanvas> mCanvasZD;
185 std::unique_ptr<TCanvas> mCanvasPtRes;
186 std::unique_ptr<TCanvas> mCanvasPtRes2;
187 std::unique_ptr<TCanvas> mCanvasPtRes3;
188 std::unique_ptr<TCanvas> mCanvasPtRes4;
189 std::unique_ptr<TLegend> mLegendPt;
190 std::unique_ptr<TLegend> mLegendEta;
191 std::unique_ptr<TLegend> mLegendPtSec;
192 std::unique_ptr<TLegend> mLegendEtaSec;
193 std::unique_ptr<TLegend> mLegendPtRes;
194 std::unique_ptr<TLegend> mLegendPtRes2;
195 std::unique_ptr<TLegend> mLegendZ;
196 std::unique_ptr<TLegend> mLegendRad;
197 std::unique_ptr<TLegend> mLegendZD;
198 std::unique_ptr<TLegend> mLegendRadD;
199 std::vector<TH1D> Histo;
200
201 float rLayer0 = 2.34; // middle radius
202 float rLayer1 = 3.15;
203 float rLayer2 = 3.93;
204 float rLayer3 = 19.605;
205
206 double sigma[100];
207 double sigmaerr[100];
208 double meanPt[100];
209 double aa[100];
210
211 // Debug output tree
212 std::unique_ptr<o2::utils::TreeStreamRedirector> mDBGOut;
213};
214
216{
218
220 mOutFileName = pars.outFileName;
221 mMask = pars.trackLengthMask;
222
223 std::vector<double> xbins;
224 xbins.resize(pars.effHistBins + 1);
225 double a = std::log(pars.effPtCutHigh / pars.effPtCutLow) / pars.effHistBins;
226 for (int i{0}; i <= pars.effHistBins; i++) {
227 xbins[i] = pars.effPtCutLow * std::exp(i * a);
228 }
229 for (int yy = 0; yy < 50; yy++) {
230 ProcessName[yy] = " ";
231 }
232 mGoodPt = std::make_unique<TH1D>("goodPt", ";#it{p}_{T} (GeV/#it{c});Efficiency (fake-track rate)", pars.effHistBins, xbins.data());
233 mGoodEta = std::make_unique<TH1D>("goodEta", ";#eta;Number of tracks", 60, -3, 3);
234 mGoodPtSec = std::make_unique<TH1D>("goodPtSec", ";#it{p}_{T} (GeV/#it{c});Efficiency (fake-track rate)", pars.effHistBins, xbins.data());
235 mGoodEtaSec = std::make_unique<TH1D>("goodEtaSec", ";#eta;Number of tracks", 60, -3, 3);
236 mGoodChi2 = std::make_unique<TH1D>("goodChi2", ";#it{p}_{T} (GeV/#it{c});Efficiency (fake-track rate)", 200, 0, 100);
237
238 mFakePt = std::make_unique<TH1D>("fakePt", ";#it{p}_{T} (GeV/#it{c});Fak", pars.effHistBins, xbins.data());
239 mFakeEta = std::make_unique<TH1D>("fakeEta", ";#eta;Number of tracks", 60, -3, 3);
240 mFakePtSec = std::make_unique<TH1D>("fakePtSec", ";#it{p}_{T} (GeV/#it{c});Fak", pars.effHistBins, xbins.data());
241 mFakeEtaSec = std::make_unique<TH1D>("fakeEtaSec", ";#eta;Number of tracks", 60, -3, 3);
242 mFakeChi2 = std::make_unique<TH1D>("fakeChi2", ";#it{p}_{T} (GeV/#it{c});Fak", 200, 0, 100);
243
244 mMultiFake = std::make_unique<TH1D>("multiFake", ";#it{p}_{T} (GeV/#it{c});Fak", pars.effHistBins, xbins.data());
245
246 mClonePt = std::make_unique<TH1D>("clonePt", ";#it{p}_{T} (GeV/#it{c});Clone", pars.effHistBins, xbins.data());
247 mCloneEta = std::make_unique<TH1D>("cloneEta", ";#eta;Number of tracks", 60, -3, 3);
248
249 mDenominatorPt = std::make_unique<TH1D>("denominatorPt", ";#it{p}_{T} (GeV/#it{c});Den", pars.effHistBins, xbins.data());
250 mDenominatorEta = std::make_unique<TH1D>("denominatorEta", ";#eta;Number of tracks", 60, -3, 3);
251 mDenominatorPtSec = std::make_unique<TH1D>("denominatorPtSec", ";#it{p}_{T} (GeV/#it{c});Den", pars.effHistBins, xbins.data());
252 mDenominatorEtaSec = std::make_unique<TH1D>("denominatorEtaSec", ";#eta;Number of tracks", 60, -3, 3);
253
254 processvsZ = std::make_unique<TH2D>("Process", ";z_{SV} [cm]; production process", 100, -50, 50., 50, 0, 50);
255 processvsRad = std::make_unique<TH2D>("ProcessR", ";decay radius [cm]; production process", 100, 0, 25., 50, 0, 50);
256 processvsRadOther = std::make_unique<TH2D>("ProcessRO", ";decay radius [cm]; production process", 200, 0, 25., 50, 0, 50);
257 processvsRadNotTracked = std::make_unique<TH2D>("ProcessRNoT", ";decay radius [cm]; production process", 200, 0, 25., 50, 0, 50);
258 processvsEtaNotTracked = std::make_unique<TH2D>("ProcessENoT", ";#eta; production process", 60, -3, 3, 50, 0, 50);
259
260 mGoodPts.resize(4);
261 mFakePts.resize(4);
262 mTotPts.resize(4);
263 mGoodEtas.resize(4);
264 mFakeEtas.resize(4);
265 mTotEtas.resize(4);
266 mGoodRad.resize(4);
267 mFakeRad.resize(4);
268 mTotRad.resize(4);
269 mGoodZ.resize(4);
270 mFakeZ.resize(4);
271 mTotZ.resize(4);
272 mClusterFake.resize(4);
273 for (int i = 0; i < 4; i++) {
274 mGoodPts[i].resize(4);
275 mFakePts[i].resize(4);
276 mTotPts[i].resize(4);
277 mGoodEtas[i].resize(4);
278 mFakeEtas[i].resize(4);
279 mTotEtas[i].resize(4);
280 }
281 for (int ii = 0; ii < 4; ii++) {
282
283 mGoodRad[ii] = std::make_unique<TH1D>(Form("goodRad_%s", particleToanalize[ii]), ";z_{SV} [cm];Number of tracks", 100, 0., 20.);
284 mFakeRad[ii] = std::make_unique<TH1D>(Form("FakeRad_%s", particleToanalize[ii]), ";#eta;Number of tracks", 100, 0., 20.);
285 mTotRad[ii] = std::make_unique<TH1D>(Form("TotRad_%s", particleToanalize[ii]), ";#eta;Number of tracks", 100, 0., 20.);
286
287 mGoodZ[ii] = std::make_unique<TH1D>(Form("goodZ_%s", particleToanalize[ii]), ";z_{SV} [cm];Number of tracks", 100, -50., 50.);
288 mFakeZ[ii] = std::make_unique<TH1D>(Form("FakeZ_%s", particleToanalize[ii]), ";z_{SV} [cm];Number of tracks", 100, -50., 50.);
289 mTotZ[ii] = std::make_unique<TH1D>(Form("TotZ_%s", particleToanalize[ii]), ";z_{SV} [cm];Number of tracks", 100, -50., 50.);
290 mClusterFake[ii] = std::make_unique<TH2D>(Form("Clusters_fake_%s", ParticleName[ii]), ";particle generating fake cluster; production process", 7, 0., 7., 50, 0, 50);
291
292 mGoodRad[ii]->Sumw2();
293 mFakeRad[ii]->Sumw2();
294 mTotRad[ii]->Sumw2();
295 mGoodZ[ii]->Sumw2();
296 mFakeZ[ii]->Sumw2();
297 mTotZ[ii]->Sumw2();
298
299 for (int yy = 0; yy < 4; yy++) { // divided by layer
300 mGoodPts[ii][yy] = std::make_unique<TH1D>(Form("goodPts_%s_%d", particleToanalize[ii], yy), ";#it{p}_{T} (GeV/#it{c});Efficiency (fake-track rate)", pars.effHistBins, xbins.data());
301 mFakePts[ii][yy] = std::make_unique<TH1D>(Form("FakePts_%s_%d", particleToanalize[ii], yy), ";#it{p}_{T} (GeV/#it{c});Efficiency (fake-track rate)", pars.effHistBins, xbins.data());
302 mTotPts[ii][yy] = std::make_unique<TH1D>(Form("TotPts_%s_%d", particleToanalize[ii], yy), ";#it{p}_{T} (GeV/#it{c});Efficiency (fake-track rate)", pars.effHistBins, xbins.data());
303
304 mGoodEtas[ii][yy] = std::make_unique<TH1D>(Form("goodEtas_%s_%d", particleToanalize[ii], yy), ";#eta;Number of tracks", 60, -3, 3);
305 mFakeEtas[ii][yy] = std::make_unique<TH1D>(Form("FakeEtas_%s_%d", particleToanalize[ii], yy), ";#eta;Number of tracks", 60, -3, 3);
306 mTotEtas[ii][yy] = std::make_unique<TH1D>(Form("TotEtas_%s_%d", particleToanalize[ii], yy), ";#eta;Number of tracks", 60, -3, 3);
307
308 mGoodPts[ii][yy]->Sumw2();
309 mFakePts[ii][yy]->Sumw2();
310 mTotPts[ii][yy]->Sumw2();
311 mGoodEtas[ii][yy]->Sumw2();
312 mFakeEtas[ii][yy]->Sumw2();
313 mTotEtas[ii][yy]->Sumw2();
314 }
315 }
316
317 mPtResolution = std::make_unique<TH1D>("PtResolution", ";#it{p}_{T} ;Den", 100, -1, 1);
318 mPtResolutionSec = std::make_unique<TH1D>("PtResolutionSec", ";#it{p}_{T} ;Den", 100, -1, 1);
319 mPtResolutionPrim = std::make_unique<TH1D>("PtResolutionPrim", ";#it{p}_{T} ;Den", 100, -1, 1);
320 mPtResolution2D = std::make_unique<TH2D>("#it{p}_{T} Resolution vs #it{p}_{T}", ";#it{p}_{T} (GeV/#it{c});#Delta p_{T}/p_{T_{MC}", 100, 0, 10, 100, -1, 1);
321
322 mPtResolution->Sumw2();
323 mPtResolutionSec->Sumw2();
324 mPtResolutionPrim->Sumw2();
325
326 mGoodPt->Sumw2();
327 mGoodEta->Sumw2();
328 mGoodPtSec->Sumw2();
329 mGoodEtaSec->Sumw2();
330
331 mFakePt->Sumw2();
332 mFakePtSec->Sumw2();
333 mFakeEta->Sumw2();
334 mMultiFake->Sumw2();
335 mClonePt->Sumw2();
336 mDenominatorPt->Sumw2();
337
338 histLength.resize(4); // fake clusters study
339 histLength1Fake.resize(4);
340 histLength2Fake.resize(4);
341 histLength3Fake.resize(4);
342 histLengthNoCl.resize(4);
343 histLength1FakeNoCl.resize(4);
344 histLength2FakeNoCl.resize(4);
345 histLength3FakeNoCl.resize(4);
346 stackLength.resize(4);
347 stackLength1Fake.resize(4);
348 stackLength2Fake.resize(4);
349 stackLength3Fake.resize(4);
350 for (int yy = 0; yy < 4; yy++) {
351 histLength[yy].resize(3);
352 histLength1Fake[yy].resize(3);
353 histLength2Fake[yy].resize(3);
354 histLength3Fake[yy].resize(3);
355 histLengthNoCl[yy].resize(3);
356 histLength1FakeNoCl[yy].resize(3);
357 histLength2FakeNoCl[yy].resize(3);
358 histLength3FakeNoCl[yy].resize(3);
359 }
360 legends.resize(4);
361 legends1Fake.resize(4);
362 legends2Fake.resize(4);
363 legends3Fake.resize(4);
364
365 for (int iH{4}; iH < 8; ++iH) {
366 // check distributions on layers of fake clusters for tracks of different lengths.
367 // Different histograms if the correct cluster exist or not
368 for (int jj = 0; jj < 3; jj++) {
369 histLength[iH - 4][jj] = new TH1I(Form("trk_len_%d_%s", iH, name[jj]), Form("#exists cluster %s", name[jj]), 7, -.5, 6.5);
370 histLength[iH - 4][jj]->SetFillColor(colorArr[jj] - 9);
371 histLength[iH - 4][jj]->SetLineColor(colorArr[jj] - 9);
372 histLengthNoCl[iH - 4][jj] = new TH1I(Form("trk_len_%d_nocl_%s", iH, name[jj]), Form("#slash{#exists} cluster %s", name[jj]), 7, -.5, 6.5);
373 histLengthNoCl[iH - 4][jj]->SetFillColor(colorArr[jj] + 1);
374 histLengthNoCl[iH - 4][jj]->SetLineColor(colorArr[jj] + 1);
375 if (jj == 0) {
376 stackLength[iH - 4] = new THStack(Form("stack_trk_len_%d", iH), Form("trk_len=%d", iH));
377 }
378 stackLength[iH - 4]->Add(histLength[iH - 4][jj]);
379 stackLength[iH - 4]->Add(histLengthNoCl[iH - 4][jj]);
380
381 histLength1Fake[iH - 4][jj] = new TH1I(Form("trk_len_%d_1f_%s", iH, name[jj]), Form("#exists cluster %s", name[jj]), 7, -.5, 6.5);
382 histLength1Fake[iH - 4][jj]->SetFillColor(colorArr[jj] - 9);
383 histLength1Fake[iH - 4][jj]->SetLineColor(colorArr[jj] - 9);
384 histLength1FakeNoCl[iH - 4][jj] = new TH1I(Form("trk_len_%d_1f_nocl_%s", iH, name[jj]), Form("#slash{#exists} cluster %s", name[jj]), 7, -.5, 6.5);
385 histLength1FakeNoCl[iH - 4][jj]->SetFillColor(colorArr[jj] + 1);
386 histLength1FakeNoCl[iH - 4][jj]->SetLineColor(colorArr[jj] + 1);
387 if (jj == 0) {
388 stackLength1Fake[iH - 4] = new THStack(Form("stack_trk_len_%d_1f", iH), Form("trk_len=%d, 1 Fake", iH));
389 }
390 stackLength1Fake[iH - 4]->Add(histLength1Fake[iH - 4][jj]);
391 stackLength1Fake[iH - 4]->Add(histLength1FakeNoCl[iH - 4][jj]);
392
393 histLength2Fake[iH - 4][jj] = new TH1I(Form("trk_len_%d_2f_%s", iH, name[jj]), Form("#exists cluster %s", name[jj]), 7, -.5, 6.5);
394 histLength2Fake[iH - 4][jj]->SetFillColor(colorArr[jj] - 9);
395 histLength2Fake[iH - 4][jj]->SetLineColor(colorArr[jj] - 9);
396 histLength2FakeNoCl[iH - 4][jj] = new TH1I(Form("trk_len_%d_2f_nocl_%s", iH, name[jj]), Form("#slash{#exists} cluster %s", name[jj]), 7, -.5, 6.5);
397 histLength2FakeNoCl[iH - 4][jj]->SetFillColor(colorArr[jj] + 1);
398 histLength2FakeNoCl[iH - 4][jj]->SetLineColor(colorArr[jj] + 1);
399 if (jj == 0) {
400 stackLength2Fake[iH - 4] = new THStack(Form("stack_trk_len_%d_2f", iH), Form("trk_len=%d, 2 Fake", iH));
401 }
402 stackLength2Fake[iH - 4]->Add(histLength2Fake[iH - 4][jj]);
403 stackLength2Fake[iH - 4]->Add(histLength2FakeNoCl[iH - 4][jj]);
404
405 histLength3Fake[iH - 4][jj] = new TH1I(Form("trk_len_%d_3f_%s", iH, name[jj]), Form("#exists cluster %s", name[jj]), 7, -.5, 6.5);
406 histLength3Fake[iH - 4][jj]->SetFillColor(colorArr[jj] - 9);
407 histLength3Fake[iH - 4][jj]->SetLineColor(colorArr[jj] - 9);
408
409 histLength3FakeNoCl[iH - 4][jj] = new TH1I(Form("trk_len_%d_3f_nocl_%s", iH, name[jj]), Form("#slash{#exists} cluster %s", name[jj]), 7, -.5, 6.5);
410 histLength3FakeNoCl[iH - 4][jj]->SetFillColor(colorArr[jj] + 1);
411 histLength3FakeNoCl[iH - 4][jj]->SetLineColor(colorArr[jj] + 1);
412 if (jj == 0) {
413 stackLength3Fake[iH - 4] = new THStack(Form("stack_trk_len_%d_3f", iH), Form("trk_len=%d, 3 Fake", iH));
414 }
415 stackLength3Fake[iH - 4]->Add(histLength3Fake[iH - 4][jj]);
416 stackLength3Fake[iH - 4]->Add(histLength3FakeNoCl[iH - 4][jj]);
417 }
418 }
419}
420
422{
424 recoData.collectData(pc, *mDataRequest.get());
425
426 updateTimeDependentParams(pc); // Make sure this is called after recoData.collectData, which may load some conditions
427 initialiseRun(recoData);
428 process();
429}
430
432{
433 mTracksROFRecords = recoData.getITSTracksROFRecords();
434 mTracks = recoData.getITSTracks();
435 mTracksMCLabels = recoData.getITSTracksMCLabels();
436 mClusters = recoData.getITSClusters();
437 mClustersMCLCont = recoData.getITSClustersMCLabels();
438 mInputITSidxs = recoData.getITSTracksClusterRefs();
439
440 LOGP(info, "** Found in {} rofs:\n\t- {} clusters with {} labels\n\t- {} tracks with {} labels",
441 mTracksROFRecords.size(), mClusters.size(), mClustersMCLCont->getIndexedSize(), mTracks.size(), mTracksMCLabels.size());
442 LOGP(info, "** Found {} sources from kinematic files", mKineReader->getNSources());
443}
444
446{
447 LOGP(info, "** Filling particle table ... ");
448 mParticleInfo.resize(mKineReader->getNSources()); // sources
449 for (int iSource{0}; iSource < mKineReader->getNSources(); ++iSource) {
450 mParticleInfo[iSource].resize(mKineReader->getNEvents(iSource)); // events
451 for (int iEvent{0}; iEvent < mKineReader->getNEvents(iSource); ++iEvent) {
452 mParticleInfo[iSource][iEvent].resize(mKineReader->getTracks(iSource, iEvent).size()); // tracks
453 for (auto iPart{0}; iPart < mKineReader->getTracks(iEvent).size(); ++iPart) {
454 auto& part = mKineReader->getTracks(iSource, iEvent)[iPart];
455 mParticleInfo[iSource][iEvent][iPart].event = iEvent;
456 mParticleInfo[iSource][iEvent][iPart].pdg = part.GetPdgCode();
457 mParticleInfo[iSource][iEvent][iPart].pt = part.GetPt();
458 mParticleInfo[iSource][iEvent][iPart].phi = part.GetPhi();
459 mParticleInfo[iSource][iEvent][iPart].eta = part.GetEta();
460 mParticleInfo[iSource][iEvent][iPart].vx = part.Vx();
461 mParticleInfo[iSource][iEvent][iPart].vy = part.Vy();
462 mParticleInfo[iSource][iEvent][iPart].vz = part.Vz();
463 mParticleInfo[iSource][iEvent][iPart].isPrimary = part.isPrimary();
464 mParticleInfo[iSource][iEvent][iPart].mother = part.getMotherTrackId();
465 mParticleInfo[iSource][iEvent][iPart].prodProcessName = part.getProdProcessAsString();
466 mParticleInfo[iSource][iEvent][iPart].prodProcess = part.getProcess();
467 }
468 }
469 }
470 LOGP(info, "** Creating particle/clusters correspondance ... ");
471 for (auto iSource{0}; iSource < mParticleInfo.size(); ++iSource) {
472 for (auto iCluster{0}; iCluster < mClusters.size(); ++iCluster) {
473 auto labs = mClustersMCLCont->getLabels(iCluster); // ideally I can have more than one label per cluster
474 for (auto& lab : labs) {
475 if (!lab.isValid()) {
476 continue; // We want to skip channels related to noise, e.g. sID = 99: QED
477 }
478 int trackID, evID, srcID;
479 bool fake;
480 lab.get(trackID, evID, srcID, fake);
481 auto& cluster = mClusters[iCluster];
482 auto layer = mGeometry->getLayer(cluster.getSensorID());
483 mParticleInfo[srcID][evID][trackID].clusters |= (1 << layer);
484 }
485 }
486 }
487 LOGP(info, "** Analysing tracks ... ");
488 int unaccounted{0}, good{0}, fakes{0};
489 // ***secondary tracks***
490 int nPartForSpec[4][4]; // total number [particle 0=IperT, 1=Lambda, 2=k, 3=Other][n layer]
491 int nPartGoodorFake[4][4][2]; // number of good or fake [particle 0=IperT, 1=Lambda, 2=k, 3=Other][n layer][good=1 fake=0]
492 for (int n = 0; n < 4; n++) {
493 for (int m = 0; m < 4; m++) {
494 nPartForSpec[n][m] = 0;
495 for (int h = 0; h < 2; h++) {
496 nPartGoodorFake[n][m][h] = 0;
497 }
498 }
499 }
500 int nlayer = 999;
501 int ngoodfake = 0;
502 int totsec = 0;
503 int totsecCont = 0;
504
505 for (auto iTrack{0}; iTrack < mTracks.size(); ++iTrack) {
506 auto& lab = mTracksMCLabels[iTrack];
507 if (!lab.isSet() || lab.isNoise()) {
508 unaccounted++;
509 continue;
510 }
511 int trackID, evID, srcID;
512 bool fake;
513 lab.get(trackID, evID, srcID, fake);
514
515 if (srcID == 99) { // skip QED
516 unaccounted++;
517 continue;
518 }
519
520 mParticleInfo[srcID][evID][trackID].isReco += !fake;
521 mParticleInfo[srcID][evID][trackID].isFake += fake;
522 if (mTracks[iTrack].isBetter(mParticleInfo[srcID][evID][trackID].track, 1.e9)) {
523 mParticleInfo[srcID][evID][trackID].storedStatus = fake;
524 mParticleInfo[srcID][evID][trackID].track = mTracks[iTrack];
525 }
526 fakes += fake;
527 good += !fake;
528 }
529 LOGP(info, "** Some statistics:");
530 LOGP(info, "\t- Total number of tracks: {}", mTracks.size());
531 LOGP(info, "\t- Total number of tracks not corresponding to particles: {} ({:.2f} %)", unaccounted, unaccounted * 100. / mTracks.size());
532 LOGP(info, "\t- Total number of fakes: {} ({:.2f} %)", fakes, fakes * 100. / mTracks.size());
533 LOGP(info, "\t- Total number of good: {} ({:.2f} %)", good, good * 100. / mTracks.size());
534
535 LOGP(info, "** Filling histograms ... ");
536 int evID = 0;
537 int trackID = 0;
538 int totP{0}, goodP{0}, fakeP{0};
539 // Currently process only sourceID = 0, to be extended later if needed
540 for (auto& evInfo : mParticleInfo[0]) {
541 trackID = 0;
542 for (auto& part : evInfo) {
543
544 if (strcmp(ProcessName[part.prodProcess], " ")) {
545 ProcessName[part.prodProcess] = part.prodProcessName;
546 }
547 if ((part.clusters & 0x7f) == mMask) {
548 // part.clusters != 0x3f && part.clusters != 0x3f << 1 &&
549 // part.clusters != 0x1f && part.clusters != 0x1f << 1 && part.clusters != 0x1f << 2 &&
550 // part.clusters != 0x0f && part.clusters != 0x0f << 1 && part.clusters != 0x0f << 2 && part.clusters != 0x0f << 3) {
551 // continue;
552
553 if (part.isPrimary) { // **Primary particle**
554 totP++;
555 mDenominatorPt->Fill(part.pt);
556 mDenominatorEta->Fill(part.eta);
557 if (part.isReco) {
558 mGoodPt->Fill(part.pt);
559 mGoodEta->Fill(part.eta);
560 goodP++;
561 if (part.isReco > 1) {
562 for (int _i{0}; _i < part.isReco - 1; ++_i) {
563 mClonePt->Fill(part.pt);
564 mCloneEta->Fill(part.eta);
565 }
566 }
567 }
568 if (part.isFake) {
569 mFakePt->Fill(part.pt);
570 mFakeEta->Fill(part.eta);
571 fakeP++;
572 if (part.isFake > 1) {
573 for (int _i{0}; _i < part.isFake - 1; ++_i) {
574 mMultiFake->Fill(part.pt);
575 }
576 }
577 }
578 }
579 }
580
581 // **Secondary particle**
582 nlayer = 999;
583 ngoodfake = 2;
584 if (!part.isPrimary) {
585 int TrackID, EvID, SrcID;
586 int pdgcode = mParticleInfo[0][evID][part.mother].pdg;
587 int idxPart = 999;
588 float rad = sqrt(pow(part.vx, 2) + pow(part.vy, 2));
589 totsec++;
590
591 if ((rad < rLayer0) && (part.clusters == 0x7f || part.clusters == 0x3f || part.clusters == 0x1f || part.clusters == 0x0f)) { // layer 0
592 nlayer = 0;
593 }
594 if (rad < rLayer1 && rad > rLayer0 && (part.clusters == 0x1e || part.clusters == 0x3e || part.clusters == 0x7e)) { // layer 1
595 nlayer = 1;
596 }
597 if (rad < rLayer2 && rad > rLayer1 && (part.clusters == 0x7c || part.clusters == 0x3c)) { // layer 2
598 nlayer = 2;
599 }
600 if (rad < rLayer3 && rad > rLayer2 && part.clusters == 0x78) { // layer 3
601 nlayer = 3;
602 }
603 if (nlayer == 0 || nlayer == 1 || nlayer == 2 || nlayer == 3) { // check if track is trackeable
604
605 totsecCont++;
606 processvsZ->Fill(part.vz, part.prodProcess);
607 processvsRad->Fill(rad, part.prodProcess);
608 mDenominatorPtSec->Fill(part.pt);
609 mDenominatorEtaSec->Fill(part.eta);
610 mTotRad[3]->Fill(rad);
611 mTotZ[3]->Fill(part.vz);
612 mTotPts[nlayer][3]->Fill(part.pt);
613 mTotEtas[nlayer][3]->Fill(part.eta);
614 mTotPts[nlayer][3]->Fill(part.pt);
615 mTotEtas[nlayer][3]->Fill(part.eta);
616 if (pdgcode == PDG[0] || pdgcode == -1 * PDG[0]) {
617 idxPart = 0; // IperT
618 }
619 if (pdgcode == PDG[1] || pdgcode == -1 * PDG[1]) {
620 idxPart = 1; // Lambda
621 }
622 if (pdgcode == PDG[2] || pdgcode == -1 * PDG[2]) {
623 idxPart = 2; // K0s
624 }
625 if (part.isReco) {
626 ngoodfake = 1;
627 mGoodPts[3][nlayer]->Fill(part.pt);
628 mGoodEtas[3][nlayer]->Fill(part.eta);
629 mGoodPtSec->Fill(part.pt);
630 mGoodEtaSec->Fill(part.eta);
631 mGoodRad[3]->Fill(rad);
632 mGoodZ[3]->Fill(part.vz);
633 }
634 if (part.isFake) {
635 ngoodfake = 0;
636 mFakePts[3][nlayer]->Fill(part.pt);
637 mFakeEtas[3][nlayer]->Fill(part.eta);
638 mFakePtSec->Fill(part.pt);
639 mFakeEtaSec->Fill(part.eta);
640 mFakeRad[3]->Fill(rad);
641 mFakeZ[3]->Fill(part.vz);
642 }
643 if (idxPart < 3) // to change if the number of analysing particle changes
644 {
645 mTotRad[idxPart]->Fill(rad);
646 mTotZ[idxPart]->Fill(part.vz);
647 mTotPts[idxPart][nlayer]->Fill(part.pt);
648 mTotEtas[idxPart][nlayer]->Fill(part.eta);
649 if (part.isReco) {
650 mGoodRad[idxPart]->Fill(rad);
651 mGoodZ[idxPart]->Fill(part.vz);
652 mGoodPts[idxPart][nlayer]->Fill(part.pt);
653 mGoodEtas[idxPart][nlayer]->Fill(part.eta);
654 }
655 if (part.isFake) {
656 mFakeRad[idxPart]->Fill(rad);
657 mFakeZ[idxPart]->Fill(part.vz);
658 mFakePts[idxPart][nlayer]->Fill(part.pt);
659 mFakeEtas[idxPart][nlayer]->Fill(part.eta);
660 }
661 }
662
663 if (pdgcode != 1010010030 && pdgcode != 3122 && pdgcode != 310 && pdgcode != -1010010030 && pdgcode != -310 && pdgcode != -3122) {
664 idxPart = 3;
665 processvsRadOther->Fill(rad, part.prodProcess);
666 }
667
668 if (!part.isFake && !part.isReco) {
669 processvsEtaNotTracked->Fill(part.eta, part.prodProcess);
670 processvsRadNotTracked->Fill(rad, part.prodProcess);
671 }
672 if (ngoodfake == 1 || ngoodfake == 0) {
673 nPartGoodorFake[idxPart][nlayer][ngoodfake]++;
674 }
675 nPartForSpec[idxPart][nlayer]++;
676
677 // Analysing fake clusters
678 int nCl{0};
679 for (unsigned int bit{0}; bit < sizeof(part.clusters) * 8; ++bit) {
680 nCl += bool(part.clusters & (1 << bit));
681 }
682 if (nCl < 3) {
683 continue;
684 }
685 if (idxPart < 3) {
686 auto& track = part.track;
687 auto len = track.getNClusters();
688 int nclu = track.getNumberOfClusters();
689 int firstclu = track.getFirstClusterEntry();
690 for (int iLayer{0}; iLayer < 7; ++iLayer) {
691 if (track.hasHitOnLayer(iLayer)) {
692 if (track.isFakeOnLayer(iLayer)) {
693 // Reco track has fake cluster
694 if (part.clusters & (0x1 << iLayer)) { // Correct cluster exists
695 histLength[len - 4][idxPart]->Fill(iLayer);
696 if (track.getNFakeClusters() == 1) {
697 histLength1Fake[len - 4][idxPart]->Fill(iLayer);
698 }
699 if (track.getNFakeClusters() == 2) {
700 histLength2Fake[len - 4][idxPart]->Fill(iLayer);
701 }
702 if (track.getNFakeClusters() == 3) {
703 histLength3Fake[len - 4][idxPart]->Fill(iLayer);
704 }
705 } else {
706
707 histLengthNoCl[len - 4][idxPart]->Fill(iLayer);
708 if (track.getNFakeClusters() == 1) {
709 histLength1FakeNoCl[len - 4][idxPart]->Fill(iLayer);
710 }
711 if (track.getNFakeClusters() == 2) {
712 histLength2FakeNoCl[len - 4][idxPart]->Fill(iLayer);
713 }
714 if (track.getNFakeClusters() == 3) {
715 histLength3FakeNoCl[len - 4][idxPart]->Fill(iLayer);
716 }
717 }
718 auto labs = mClustersMCLCont->getLabels(mInputITSidxs[firstclu - 1 - iLayer + track.getFirstClusterLayer() + nclu]);
719
720 for (auto& lab : labs) {
721 if (!lab.isValid()) {
722 continue; // We want to skip channels related to noise, e.g. sID = 99: QED
723 }
724
725 bool fakec;
726 lab.get(TrackID, EvID, SrcID, fakec);
727 double intHisto = 0;
728 for (int hg = 0; hg < 7; hg++) {
729 if (mParticleInfo[SrcID][EvID][TrackID].pdg == PdgcodeClusterFake[hg] || mParticleInfo[SrcID][EvID][TrackID].pdg == -1 * (PdgcodeClusterFake[hg])) {
730 intHisto = hg + 0.5;
731 }
732 }
733 if (idxPart < 3) {
734 mClusterFake[idxPart]->Fill(intHisto, mParticleInfo[SrcID][EvID][TrackID].prodProcess);
735 }
736 }
737 }
738 }
739 }
740 }
741 }
742 nlayer = 999;
743 }
744 trackID++;
745 }
746 evID++;
747 }
748
749 int totgood{0}, totfake{0}, totI{0}, totL{0}, totK{0}, totO{0};
750 for (int xx = 0; xx < 4; xx++) {
751 for (int yy = 0; yy < 4; yy++) {
752 totgood = totgood + nPartGoodorFake[xx][yy][1];
753 totfake = totfake + nPartGoodorFake[xx][yy][0];
754 if (xx == 0) {
755 totI = totI + nPartForSpec[0][yy];
756 }
757 if (xx == 1) {
758 totL = totL + nPartForSpec[1][yy];
759 }
760 if (xx == 2) {
761 totK = totK + nPartForSpec[2][yy];
762 }
763 if (xx == 3) {
764 totO = totO + nPartForSpec[3][yy];
765 }
766 }
767 }
768 LOGP(info, "number of primary tracks: {}, good:{}, fake:{}", totP, goodP, fakeP);
769 int goodI = nPartGoodorFake[0][0][1] + nPartGoodorFake[0][1][1] + nPartGoodorFake[0][2][1] + nPartGoodorFake[0][3][1];
770 int goodL = nPartGoodorFake[1][0][1] + nPartGoodorFake[1][1][1] + nPartGoodorFake[1][2][1] + nPartGoodorFake[1][3][1];
771 int goodK = nPartGoodorFake[2][0][1] + nPartGoodorFake[2][1][1] + nPartGoodorFake[2][2][1] + nPartGoodorFake[2][3][1];
772 int fakeI = nPartGoodorFake[0][0][0] + nPartGoodorFake[0][1][0] + nPartGoodorFake[0][2][0] + nPartGoodorFake[0][3][0];
773 int fakeL = nPartGoodorFake[1][0][0] + nPartGoodorFake[1][1][0] + nPartGoodorFake[1][2][0] + nPartGoodorFake[1][3][0];
774 int fakeK = nPartGoodorFake[2][0][0] + nPartGoodorFake[2][1][0] + nPartGoodorFake[2][2][0] + nPartGoodorFake[2][3][0];
775 LOGP(info, "** Some statistics on secondary tracks:");
776
777 LOGP(info, "\t- Total number of secondary tracks: {}", totsec);
778 LOGP(info, "\t- Total number of secondary trackeable tracks : {}", totsecCont);
779 LOGP(info, "\t- Total number of secondary trackeable tracks good: {}, fake: {}", totgood, totfake);
780 LOGP(info, "\t- Total number of secondary trackeable tracks from IperT: {} = {} %, Good={} % , fake={} %", totI, 100 * totI / totsecCont, 100 * goodI / totI, 100 * fakeI / totI);
781 LOGP(info, "\t- Total number of secondary trackeable tracks from Lam: {} = {} %, Good={} % , fake={} %", totL, 100 * totL / totsecCont, 100 * goodL / totL, 100 * fakeL / totL);
782 LOGP(info, "\t- Total number of secondary trackeable tracks from k: {} = {} %, Good={} % , fake={} %", totK, 100 * totK / totsecCont, 100 * goodK / totK, 100 * fakeK / totK);
783 LOGP(info, "\t- Total number of secondary trackeable tracks from Other: {} = {} %", totO, 100 * totO / totsecCont);
784
785 LOGP(info, "** Computing efficiencies ...");
786
787 mEffPt = std::make_unique<TEfficiency>(*mGoodPt, *mDenominatorPt);
788 mEffFakePt = std::make_unique<TEfficiency>(*mFakePt, *mDenominatorPt);
789 mEffClonesPt = std::make_unique<TEfficiency>(*mClonePt, *mDenominatorPt);
790
791 mEffEta = std::make_unique<TEfficiency>(*mGoodEta, *mDenominatorEta);
792 mEffFakeEta = std::make_unique<TEfficiency>(*mFakeEta, *mDenominatorEta);
793 mEffClonesEta = std::make_unique<TEfficiency>(*mCloneEta, *mDenominatorEta);
794
795 mEffPtSec = std::make_unique<TEfficiency>(*mGoodPtSec, *mDenominatorPtSec);
796 mEffFakePtSec = std::make_unique<TEfficiency>(*mFakePtSec, *mDenominatorPtSec);
797
798 mEffEtaSec = std::make_unique<TEfficiency>(*mGoodEtaSec, *mDenominatorEtaSec);
799 mEffFakeEtaSec = std::make_unique<TEfficiency>(*mFakeEtaSec, *mDenominatorEtaSec);
800
801 for (int ii = 0; ii < 4; ii++) {
802 for (int yy = 0; yy < 4; yy++) {
803 mEffGoodPts[ii][yy] = std::make_unique<TEfficiency>(*mGoodPts[ii][yy], *mTotPts[ii][yy]);
804 mEffFakePts[ii][yy] = std::make_unique<TEfficiency>(*mFakePts[ii][yy], *mTotPts[ii][yy]);
805 mEffGoodEtas[ii][yy] = std::make_unique<TEfficiency>(*mGoodEtas[ii][yy], *mTotEtas[ii][yy]);
806 mEffFakeEtas[ii][yy] = std::make_unique<TEfficiency>(*mFakeEtas[ii][yy], *mTotEtas[ii][yy]);
807 }
808 mEffGoodRad[ii] = std::make_unique<TEfficiency>(*mGoodRad[ii], *mTotRad[ii]);
809 mEffFakeRad[ii] = std::make_unique<TEfficiency>(*mFakeRad[ii], *mTotRad[ii]);
810 mEffGoodZ[ii] = std::make_unique<TEfficiency>(*mGoodZ[ii], *mTotZ[ii]);
811 mEffFakeZ[ii] = std::make_unique<TEfficiency>(*mFakeZ[ii], *mTotZ[ii]);
812 }
813
814 LOGP(info, "** Analysing pT resolution...");
815 for (auto iTrack{0}; iTrack < mTracks.size(); ++iTrack) {
816 auto& lab = mTracksMCLabels[iTrack];
817 if (!lab.isSet() || lab.isNoise()) {
818 continue;
819 }
820 int trackID, evID, srcID;
821 bool fake;
822 lab.get(trackID, evID, srcID, fake);
823 if (srcID == 99) {
824 continue; // skip QED
825 }
826 mPtResolution->Fill((mParticleInfo[srcID][evID][trackID].pt - mTracks[iTrack].getPt()) / mParticleInfo[srcID][evID][trackID].pt);
827 mPtResolution2D->Fill(mParticleInfo[srcID][evID][trackID].pt, (mParticleInfo[srcID][evID][trackID].pt - mTracks[iTrack].getPt()) / mParticleInfo[srcID][evID][trackID].pt);
828 if (!mParticleInfo[srcID][evID][trackID].isPrimary) {
829 mPtResolutionSec->Fill((mParticleInfo[srcID][evID][trackID].pt - mTracks[iTrack].getPt()) / mParticleInfo[srcID][evID][trackID].pt);
830 }
831 mPtResolutionPrim->Fill((mParticleInfo[srcID][evID][trackID].pt - mTracks[iTrack].getPt()) / mParticleInfo[srcID][evID][trackID].pt);
832 }
833
834 for (int yy = 0; yy < 100; yy++) {
835 aa[yy] = 0.;
836 sigma[yy] = 0.;
837 sigmaerr[yy] = 0.;
838 meanPt[yy] = 0.;
839 }
840
841 for (int yy = 0; yy < 100; yy++) {
842 TH1D* projh2X = mPtResolution2D->ProjectionY("projh2X", yy, yy + 1, "");
843 TF1* f1 = new TF1("f1", "gaus", -0.2, 0.2);
844 projh2X->Fit("f1");
845 if (f1->GetParameter(2) > 0. && f1->GetParameter(2) < 1. && f1->GetParameter(1) < 1.) {
846 sigma[yy] = f1->GetParameter(2);
847 sigmaerr[yy] = f1->GetParError(2);
848 meanPt[yy] = ((8. / 100.) * yy + (8. / 100.) * (yy + 1)) / 2;
849 aa[yy] = 0.0125;
850 }
851 }
852}
853
854void TrackCheckStudy::setEfficiencyGraph(std::unique_ptr<TEfficiency>& eff, const char* name, const char* title, const int color, const double alpha = 1, const double linew = 2, const int markerStyle = kFullCircle, const double markersize = 1.7)
855{
856 eff->SetName(name);
857 eff->SetTitle(title);
858 eff->SetLineColor(color);
859 eff->SetLineColorAlpha(color, alpha);
860 eff->SetMarkerColor(color);
861 eff->SetMarkerColorAlpha(color, alpha);
862 eff->SetLineWidth(linew);
863 eff->SetMarkerStyle(markerStyle);
864 eff->SetMarkerSize(markersize);
865 eff->SetDirectory(gDirectory);
866}
867
868void TrackCheckStudy::updateTimeDependentParams(ProcessingContext& pc)
869{
870 static bool initOnceDone = false;
872 if (!initOnceDone) { // this params need to be queried only once
873 initOnceDone = true;
874 mGeometry = GeometryTGeo::Instance();
876 }
877}
878
880{
881 TFile fout(mOutFileName.c_str(), "recreate");
882
883 setEfficiencyGraph(mEffPt, "Good_pt", ";#it{p}_{T} (GeV/#it{c});efficiency primary particle", kAzure + 4, 0.65);
884 fout.WriteTObject(mEffPt.get());
885
886 setEfficiencyGraph(mEffFakePt, "Fake_pt", ";#it{p}_{T} (GeV/#it{c});efficiency primary particle", kRed, 0.65);
887 fout.WriteTObject(mEffFakePt.get());
888
889 setEfficiencyGraph(mEffPtSec, "Good_ptSec", ";#it{p}_{T} (GeV/#it{c});efficiency secondary particle", kOrange + 7);
890 fout.WriteTObject(mEffPtSec.get());
891
892 setEfficiencyGraph(mEffFakePtSec, "Fake_ptSec", ";#it{p}_{T} (GeV/#it{c});efficiency secondary particle", kGray + 2);
893 fout.WriteTObject(mEffFakePtSec.get());
894
895 setEfficiencyGraph(mEffClonesPt, "Clone_pt", ";#it{p}_{T} (GeV/#it{c});efficiency primary particle", kGreen + 2, 0.65);
896 fout.WriteTObject(mEffClonesPt.get());
897
898 setEfficiencyGraph(mEffEta, "Good_eta", ";#eta;efficiency primary particle", kAzure + 4, 0.65);
899 fout.WriteTObject(mEffEta.get());
900
901 setEfficiencyGraph(mEffFakeEta, "Fake_eta", ";#eta;efficiency primary particle", kRed + 1, 0.65);
902 fout.WriteTObject(mEffFakeEta.get());
903
904 setEfficiencyGraph(mEffEtaSec, "Good_etaSec", ";#eta;efficiency secondary particle", kOrange + 7);
905 fout.WriteTObject(mEffEtaSec.get());
906
907 setEfficiencyGraph(mEffFakeEtaSec, "Fake_etaSec", ";#eta;efficiency secondary particle", kGray + 2);
908 fout.WriteTObject(mEffFakeEtaSec.get());
909
910 setEfficiencyGraph(mEffClonesEta, "Clone_eta", ";#it{p}_{T} (GeV/#it{c});efficiency primary particle", kGreen + 2, 0.65);
911 fout.WriteTObject(mEffClonesEta.get());
912
913 for (int aa = 0; aa < 4; aa++) {
914 setEfficiencyGraph(mEffGoodRad[aa], Form("Good_Rad_%s", particleToanalize[aa]), ";Radius [cm];efficiency secondary particle", colorArr[aa]);
915 fout.WriteTObject(mEffGoodRad[aa].get());
916
917 setEfficiencyGraph(mEffGoodRad[aa], Form("Fake_Rad_%s", particleToanalize[aa]), ";Radius [cm];efficiency secondary particle", colorArr[aa] - 9);
918 fout.WriteTObject(mEffGoodRad[aa].get());
919
920 setEfficiencyGraph(mEffGoodZ[aa], Form("Good_Z_%s", particleToanalize[aa]), ";Z_{sv} [cm];efficiency secondary particle", colorArr[aa]);
921 fout.WriteTObject(mEffGoodZ[aa].get());
922
923 setEfficiencyGraph(mEffGoodZ[aa], Form("Fake_Z_%s", particleToanalize[aa]), ";Z_{sv} [cm];efficiency secondary particle", colorArr[aa] - 9);
924 fout.WriteTObject(mEffGoodZ[aa].get());
925
926 for (int bb = 0; bb < 4; bb++) {
927 setEfficiencyGraph(mEffGoodPts[aa][bb], Form("EffPtGood_%sl%d", particleToanalize[aa], bb), Form("Good Sec Tracks_%s, L%d"
928 ";#it{p}_{T} (GeV/#it{c});efficiency secondary particle ",
929 particleToanalize[aa], bb),
930 colorArr[aa]);
931 setEfficiencyGraph(mEffFakePts[aa][bb], Form("EffPtFake_%sl%d", particleToanalize[aa], bb), Form("Fake Sec Tracks_%s, L%d"
932 ";#it{p}_{T} (GeV/#it{c});efficiency secondary particle ",
933 particleToanalize[aa], bb),
934 colorArr[aa]);
935 setEfficiencyGraph(mEffGoodEtas[aa][bb], Form("EffEtaGood_%sl%d", particleToanalize[aa], bb), Form("Good Sec Tracks_%s, L%d"
936 ";#eta ;efficiency secondary particle ",
937 particleToanalize[aa], bb),
938 colorArr[aa]);
939 setEfficiencyGraph(mEffFakeEtas[aa][bb], Form("EffEtaFake_%sl%d", particleToanalize[aa], bb), Form("Fake Sec Tracks_%s, L%d"
940 ";#eta ;efficiency secondary particle ",
941 particleToanalize[aa], bb),
942 colorArr[aa]);
943
944 fout.WriteTObject(mEffGoodPts[aa][bb].get());
945 fout.WriteTObject(mEffFakePts[aa][bb].get());
946 fout.WriteTObject(mEffGoodEtas[aa][bb].get());
947 fout.WriteTObject(mEffFakeEtas[aa][bb].get());
948 }
949 for (int i = 0; i < 3; i++) {
950 fout.WriteTObject(histLength[aa][i], Form("trk_len_%d_%s", 4 + aa, name[i]));
951 fout.WriteTObject(histLength1Fake[aa][i], Form("trk_len_%d_1f_%s", 4 + aa, name[i]));
952 fout.WriteTObject(histLength2Fake[aa][i], Form("trk_len_%d_2f_%s", 4 + aa, name[i]));
953 fout.WriteTObject(histLength3Fake[aa][i], Form("trk_len_%d_3f_%s", 4 + aa, name[i]));
954 fout.WriteTObject(histLengthNoCl[aa][i], Form("trk_len_%d_nocl_%s", 4 + aa, name[i]));
955 fout.WriteTObject(histLength1FakeNoCl[aa][i], Form("trk_len_%d_1f_nocl_%s", 4 + aa, name[i]));
956 fout.WriteTObject(histLength2FakeNoCl[aa][i], Form("trk_len_%d_2f_nocl_%s", 4 + aa, name[i]));
957 fout.WriteTObject(histLength3FakeNoCl[aa][i], Form("trk_len_%d_3f_nocl_%s", 4 + aa, name[i]));
958 }
959 }
960
961 for (int j = 0; j < 4; j++) {
962 for (int i = 1; i <= 7; i++) {
963 mClusterFake[j]->GetXaxis()->SetBinLabel(i, ParticleName[i - 1]);
964
965 for (int i = 1; i <= 50; i++) {
966 mClusterFake[j]->GetYaxis()->SetBinLabel(i, ProcessName[i - 1]);
967 if (j == 0) {
968 processvsZ->GetYaxis()->SetBinLabel(i, ProcessName[i - 1]);
969 processvsRad->GetYaxis()->SetBinLabel(i, ProcessName[i - 1]);
970 processvsRadOther->GetYaxis()->SetBinLabel(i, ProcessName[i - 1]);
971 processvsRadNotTracked->GetYaxis()->SetBinLabel(i, ProcessName[i - 1]);
972 processvsEtaNotTracked->GetYaxis()->SetBinLabel(i, ProcessName[i - 1]);
973 }
974 }
975 fout.WriteTObject(mClusterFake[j].get());
976 }
977 }
978 fout.WriteTObject(processvsZ.get());
979 fout.WriteTObject(processvsRad.get());
980 fout.WriteTObject(processvsRadOther.get());
981 fout.WriteTObject(processvsRadNotTracked.get());
982 fout.WriteTObject(processvsEtaNotTracked.get());
983
984 // Paint the histograms
985 // todo: delegate to a dedicated helper
986 gStyle->SetTitleSize(0.035, "xy");
987 gStyle->SetLabelSize(0.035, "xy");
988 gStyle->SetPadRightMargin(0.035);
989 gStyle->SetPadTopMargin(0.035);
990 gStyle->SetPadLeftMargin(0.19);
991 gStyle->SetPadBottomMargin(0.17);
992 gStyle->SetTitleOffset(1.4, "x");
993 gStyle->SetTitleOffset(1.1, "y");
994 gStyle->SetPadTickX(1);
995 gStyle->SetPadTickY(1);
996 gStyle->SetGridStyle(3);
997 gStyle->SetGridWidth(1);
998
999 mCanvasPt = std::make_unique<TCanvas>("cPt", "cPt", 1600, 1200);
1000 mCanvasPt->cd();
1001 mCanvasPt->SetLogx();
1002 mCanvasPt->SetGrid();
1003 mEffPt->Draw("pz");
1004 mEffFakePt->Draw("pz same");
1005 mEffClonesPt->Draw("pz same");
1006 mLegendPt = std::make_unique<TLegend>(0.19, 0.8, 0.40, 0.96);
1007 mLegendPt->SetHeader(Form("%zu events PP min bias", mKineReader->getNEvents(0)), "C");
1008 mLegendPt->AddEntry("Good_pt", "good (100% cluster purity)", "lep");
1009 mLegendPt->AddEntry("Fake_pt", "fake", "lep");
1010 mLegendPt->AddEntry("Clone_pt", "clone", "lep");
1011 mLegendPt->Draw();
1012 mCanvasPt->SaveAs("eff_pt.png");
1013
1014 mCanvasPtSec = std::make_unique<TCanvas>("cPtSec", "cPtSec", 1600, 1200);
1015 mCanvasPtSec->cd();
1016 mCanvasPtSec->SetLogx();
1017 mCanvasPtSec->SetGrid();
1018 mEffPtSec->Draw("pz");
1019 mEffFakePtSec->Draw("pz same");
1020 mLegendPtSec = std::make_unique<TLegend>(0.19, 0.8, 0.40, 0.96);
1021 mLegendPtSec->SetHeader(Form("%zu events PP min bias", mKineReader->getNEvents(0)), "C");
1022 mLegendPtSec->AddEntry("Good_ptSec", "good (100% cluster purity)", "lep");
1023 mLegendPtSec->AddEntry("Fake_tSec", "fake", "lep");
1024 mLegendPtSec->Draw();
1025 mCanvasPtSec->SaveAs("eff_ptSec.png");
1026
1027 mCanvasEta = std::make_unique<TCanvas>("cEta", "cEta", 1600, 1200);
1028 mCanvasEta->cd();
1029 mCanvasEta->SetGrid();
1030 mEffEta->Draw("pz");
1031 mEffFakeEta->Draw("pz same");
1032 mEffClonesEta->Draw("pz same");
1033 mLegendEta = std::make_unique<TLegend>(0.19, 0.8, 0.40, 0.96);
1034 mLegendEta->SetHeader(Form("%zu events PP min bias", mKineReader->getNEvents(0)), "C");
1035 mLegendEta->AddEntry("Good_eta", "good (100% cluster purity)", "lep");
1036 mLegendEta->AddEntry("Fake_eta", "fake", "lep");
1037 mLegendEta->AddEntry("Clone_eta", "clone", "lep");
1038 mLegendEta->Draw();
1039 mCanvasEta->SaveAs("eff_eta.png");
1040
1041 mCanvasEtaSec = std::make_unique<TCanvas>("cEtaSec", "cEtaSec", 1600, 1200);
1042 mCanvasEtaSec->cd();
1043 mCanvasEtaSec->SetGrid();
1044 mEffEtaSec->Draw("pz");
1045 mEffFakeEtaSec->Draw("pz same");
1046 mLegendEtaSec = std::make_unique<TLegend>(0.19, 0.8, 0.40, 0.96);
1047 mLegendEtaSec->SetHeader(Form("%zu events PP min bias", mKineReader->getNEvents(0)), "C");
1048 mLegendEtaSec->AddEntry("Good_etaSec", "good (100% cluster purity)", "lep");
1049 mLegendEtaSec->AddEntry("Fake_etaSec", "fake", "lep");
1050 mLegendEtaSec->Draw();
1051 mCanvasEtaSec->SaveAs("eff_EtaSec.png");
1052
1053 mCanvasRad = std::make_unique<TCanvas>("cRad", "cRad", 1600, 1200);
1054 mCanvasRad->cd();
1055 mCanvasRad->SetGrid();
1056 mEffGoodRad[3]->Draw("pz");
1057 mEffFakeRad[3]->Draw("pz same");
1058 mCanvasRad->SetLogy();
1059 mLegendRad = std::make_unique<TLegend>(0.8, 0.4, 0.95, 0.6);
1060 mLegendRad->SetHeader(Form("%zu events PP ", mKineReader->getNEvents(0)), "C");
1061 mLegendRad->AddEntry(Form("Good_Rad_%s", particleToanalize[3]), "good", "lep");
1062 mLegendRad->AddEntry(Form("Fake_Rad_%s", particleToanalize[3]), "fake", "lep");
1063 mLegendRad->Draw();
1064 mCanvasRad->SaveAs("eff_rad_sec.png");
1065
1066 mCanvasZ = std::make_unique<TCanvas>("cZ", "cZ", 1600, 1200);
1067 mCanvasZ->cd();
1068 mCanvasZ->SetGrid();
1069 mCanvasZ->SetLogy();
1070 mEffGoodZ[3]->Draw("pz");
1071 mEffFakeZ[3]->Draw("pz same");
1072 mCanvasZ->SetLogy();
1073 mLegendZ = std::make_unique<TLegend>(0.8, 0.4, 0.95, 0.6);
1074 mLegendZ->SetHeader(Form("%zu events PP ", mKineReader->getNEvents(0)), "C");
1075 mLegendZ->AddEntry(Form("Good_Z_%s", particleToanalize[3]), "good", "lep");
1076 mLegendZ->AddEntry(Form("Fake_Z_%s", particleToanalize[3]), "fake", "lep");
1077 mLegendZ->Draw();
1078 mCanvasZ->SaveAs("eff_Z_sec.png");
1079 ;
1080
1081 mCanvasRadD = std::make_unique<TCanvas>("cRadD", "cRadD", 1600, 1200);
1082 mCanvasRadD->cd();
1083 mCanvasRadD->SetGrid();
1084 mCanvasRadD->SetLogy();
1085 mLegendRadD = std::make_unique<TLegend>(0.8, 0.64, 0.95, 0.8);
1086 mLegendRadD->SetHeader(Form("%zu events PP ", mKineReader->getNEvents(0)), "C");
1087 for (int i = 0; i < 3; i++) {
1088 if (i == 0) {
1089 mEffGoodRad[i]->Draw("pz");
1090 } else {
1091 mEffGoodRad[i]->Draw("pz same");
1092 mEffFakeRad[i]->Draw("pz same");
1093 mLegendRadD->AddEntry(Form("Good_Rad%s", particleToanalize[i]), Form("%s_good", name[i]), "lep");
1094 mLegendRadD->AddEntry(Form("Fake_Rad%s", particleToanalize[i]), Form("%s_fake", name[i]), "lep");
1095 }
1096 }
1097 mLegendRadD->Draw();
1098 mCanvasRadD->SaveAs("eff_RadD_sec.png");
1099
1100 mCanvasZD = std::make_unique<TCanvas>("cZD", "cZD", 1600, 1200);
1101 mCanvasZD->cd();
1102 mCanvasZD->SetGrid();
1103 mCanvasZD->SetLogy();
1104 mLegendZD = std::make_unique<TLegend>(0.8, 0.64, 0.95, 0.8);
1105 mLegendZD->SetHeader(Form("%zu events PP ", mKineReader->getNEvents(0)), "C");
1106 for (int i = 0; i < 3; i++) {
1107 if (i == 0) {
1108 mEffGoodZ[i]->Draw("pz");
1109 } else {
1110 mEffGoodZ[i]->Draw("pz same");
1111 mEffFakeZ[i]->Draw("pz same");
1112 mLegendZD->AddEntry(Form("Good_Z%s", particleToanalize[i]), Form("%s_good", name[i]), "lep");
1113 mLegendZD->AddEntry(Form("Fake_Z%s", particleToanalize[i]), Form("%s_fake", name[i]), "lep");
1114 }
1115 }
1116 mLegendZD->Draw();
1117 mCanvasZD->SaveAs("eff_ZD_sec.png");
1118
1119 mPtResolution->SetName("#it{p}_{T} resolution");
1120 mPtResolution->SetTitle(";#Delta p_{T}/p_{T_{MC}} ;Entries");
1121 mPtResolution->SetFillColor(kAzure + 4);
1122 mPtResolutionPrim->SetFillColor(kRed);
1123 mPtResolutionSec->SetFillColor(kOrange);
1124 mPtResolutionPrim->SetTitle(";#Delta p_{T}/p_{T_{MC}} ;Entries");
1125 mPtResolutionSec->SetTitle(";#Delta #it{p}_{T}/#it{p}_{T_{MC}} ;Entries");
1126 mPtResolution2D->SetTitle(";#it{p}_{T_{MC}} [GeV];#Delta #it{p}_{T}/#it{p}_{T_{MC}}");
1127
1128 fout.WriteTObject(mPtResolution.get());
1129 fout.WriteTObject(mPtResolutionPrim.get());
1130 fout.WriteTObject(mPtResolutionSec.get());
1131 fout.WriteTObject(mPtResolution2D.get());
1132
1133 mCanvasPtRes = std::make_unique<TCanvas>("cPtr", "cPtr", 1600, 1200);
1134 mCanvasPtRes->cd();
1135 mPtResolution->Draw("HIST");
1136 mLegendPtRes = std::make_unique<TLegend>(0.19, 0.8, 0.40, 0.96);
1137 mLegendPtRes->SetHeader(Form("%zu events PP min bias", mKineReader->getNEvents(0)), "C");
1138 mLegendPtRes->AddEntry("mPtResolution", "All events", "lep");
1139 mLegendPtRes->Draw();
1140 mCanvasPtRes->SaveAs("ptRes.png");
1141
1142 mCanvasPtRes2 = std::make_unique<TCanvas>("cPtr2", "cPtr2", 1600, 1200);
1143 mCanvasPtRes2->cd();
1144 mPtResolution2D->Draw();
1145 mCanvasPtRes2->SaveAs("ptRes2.png");
1146
1147 mCanvasPtRes3 = std::make_unique<TCanvas>("cPtr3", "cPtr3", 1600, 1200);
1148 mCanvasPtRes3->cd();
1149
1150 auto* g1 = new TGraphErrors(100, meanPt, sigma, aa, sigmaerr);
1151 g1->SetMarkerStyle(8);
1152 g1->SetMarkerColor(kGreen);
1153 g1->GetXaxis()->SetTitle(" #it{p}_{T} [GeV]");
1154 g1->GetYaxis()->SetTitle("#sigma #Delta #it{p}_{T}/#it{p}_{T_{MC}}");
1155 g1->GetYaxis()->SetLimits(0, 1);
1156 g1->GetXaxis()->SetLimits(0, 10.);
1157 g1->Draw("AP");
1158 g1->GetYaxis()->SetRangeUser(0, 1);
1159 g1->GetXaxis()->SetRangeUser(0, 10.);
1160 mCanvasPtRes3->SaveAs("ptRes3.png");
1161
1162 mCanvasPtRes4 = std::make_unique<TCanvas>("cPt4", "cPt4", 1600, 1200);
1163 mCanvasPtRes4->cd();
1164 mPtResolutionPrim->SetName("mPtResolutionPrim");
1165 mPtResolutionSec->SetName("mPtResolutionSec");
1166 mPtResolutionPrim->Draw("same hist");
1167 mPtResolutionSec->Draw("same hist");
1168 mLegendPtRes2 = std::make_unique<TLegend>(0.19, 0.8, 0.40, 0.96);
1169
1170 mLegendPtRes2->SetHeader(Form("%zu events PP", mKineReader->getNEvents(0)), "C");
1171 mLegendPtRes2->AddEntry("mPtResolutionPrim", "Primary events", "f");
1172 mLegendPtRes2->AddEntry("mPtResolutionSec", "Secondary events", "f");
1173 mLegendPtRes2->Draw("same");
1174 mLegendPtRes2->SaveAs("ptRes4.png");
1175
1176 auto canvas = new TCanvas("fc_canvas", "Fake clusters", 1600, 1000);
1177 canvas->Divide(4, 2);
1178 for (int iH{0}; iH < 4; ++iH) {
1179 canvas->cd(iH + 1);
1180 stackLength[iH]->Draw();
1181 stackLength[iH]->GetXaxis()->SetTitle("Layer");
1182 gPad->BuildLegend();
1183 }
1184 for (int iH{0}; iH < 4; ++iH) {
1185 canvas->cd(iH + 5);
1186 stackLength1Fake[iH]->Draw();
1187 stackLength1Fake[iH]->GetXaxis()->SetTitle("Layer");
1188 gPad->BuildLegend();
1189 }
1190
1191 canvas->SaveAs("fakeClusters2.png", "recreate");
1192
1193 auto canvas2 = new TCanvas("fc_canvas2", "Fake clusters", 1600, 1000);
1194 canvas2->Divide(4, 2);
1195
1196 for (int iH{0}; iH < 4; ++iH) {
1197 canvas2->cd(iH + 1);
1198 stackLength2Fake[iH]->Draw();
1199 stackLength2Fake[iH]->GetXaxis()->SetTitle("Layer");
1200 gPad->BuildLegend();
1201 }
1202 for (int iH{0}; iH < 4; ++iH) {
1203 canvas2->cd(iH + 5);
1204 stackLength3Fake[iH]->Draw();
1205 stackLength3Fake[iH]->GetXaxis()->SetTitle("Layer");
1206 gPad->BuildLegend();
1207 }
1208 canvas2->SaveAs("fakeClusters3.png", "recreate");
1209
1210 auto canvasPtfake = new TCanvas("canvasPtfake", "Fake pt", 1600, 1000);
1211 canvasPtfake->Divide(2, 2);
1212
1213 for (int iH{0}; iH < 4; ++iH) {
1214 canvasPtfake->cd(iH + 1);
1215 for (int v = 0; v < 4; v++) {
1216 if (v == 0) {
1217 canvasPtfake->cd(iH + 1);
1218 }
1219 if (v == 0) {
1220 mEffFakePts[v][iH]->Draw();
1221 } else {
1222 mEffFakePts[v][iH]->Draw("same");
1223 }
1224 }
1225 gPad->BuildLegend();
1226 gPad->SetGrid();
1227 gPad->SetTitle(Form("#it{p}_{T}, Fake Tracks, layer %d", iH));
1228 gPad->SetName(Form("#it{p}_{T}, Fake Tracks, layer %d", iH));
1229 }
1230 canvasPtfake->SaveAs("PtforPartFake.png", "recreate");
1231
1232 auto canvasPtGood = new TCanvas("canvasPtGood", "Good pt", 1600, 1000);
1233 canvasPtGood->Divide(2, 2);
1234
1235 for (int iH{0}; iH < 4; ++iH) {
1236 canvasPtGood->cd(iH + 1);
1237 for (int v = 0; v < 4; v++) {
1238 if (v == 0) {
1239 canvasPtGood->cd(iH + 1);
1240 }
1241 if (v == 0) {
1242 mEffGoodPts[v][iH]->Draw();
1243 } else {
1244 mEffGoodPts[v][iH]->Draw("same");
1245 }
1246 }
1247 gPad->BuildLegend();
1248 gPad->SetGrid();
1249 gPad->SetTitle(Form("#it{p}_{T}, Good Tracks, layer %d", iH));
1250 gPad->SetName(Form("#it{p}_{T}, Good Tracks, layer %d", iH));
1251 }
1252
1253 auto canvasEtafake = new TCanvas("canvasEtafake", "Fake Eta", 1600, 1000);
1254 canvasEtafake->Divide(2, 2);
1255
1256 for (int iH{0}; iH < 4; ++iH) {
1257 canvasEtafake->cd(iH + 1);
1258 for (int v = 0; v < 4; v++) {
1259 if (v == 0) {
1260 canvasEtafake->cd(iH + 1);
1261 }
1262 if (v == 0) {
1263 mEffFakeEtas[v][iH]->Draw();
1264 } else {
1265 mEffFakeEtas[v][iH]->Draw("same");
1266 }
1267 }
1268 gPad->BuildLegend();
1269 gPad->SetGrid();
1270 gPad->SetTitle(Form("#eta, Fake Tracks, layer %d", iH));
1271 gPad->SetName(Form("#eta, Fake Tracks, layer %d", iH));
1272 }
1273 auto canvasEtaGood = new TCanvas("canvasEtaGood", "Good Eta", 1600, 1000);
1274 canvasEtaGood->Divide(2, 2);
1275
1276 for (int iH{0}; iH < 4; ++iH) {
1277 canvasEtaGood->cd(iH + 1);
1278 for (int v = 0; v < 4; v++) {
1279 if (v == 0) {
1280 canvasEtaGood->cd(iH + 1);
1281 }
1282 if (v == 0) {
1283 mEffGoodEtas[v][iH]->Draw();
1284 } else {
1285 mEffGoodEtas[v][iH]->Draw("same");
1286 }
1287 }
1288 gPad->BuildLegend();
1289 gPad->SetGrid();
1290 gPad->SetTitle(Form("#eta, Good Tracks, layer %d", iH));
1291 gPad->SetName(Form("#eta, Good Tracks, layer %d", iH));
1292 }
1293
1294 auto canvasI = new TCanvas("canvasI", "canvasI", 1600, 1000);
1295 canvasI->cd();
1296 mClusterFake[0]->Draw("COLZ");
1297 canvasI->SaveAs("Iper2D.png", "recreate");
1298
1299 auto canvasL = new TCanvas("canvasL", "canvasL", 1600, 1000);
1300 canvasL->cd();
1301 mClusterFake[1]->Draw("COLZ");
1302 canvasL->SaveAs("Lam2D.png", "recreate");
1303
1304 auto canvasK = new TCanvas("canvasK", "canvasK", 1600, 1000);
1305 canvasK->cd();
1306 mClusterFake[2]->Draw("COLZ");
1307 canvasK->SaveAs("K2D.png", "recreate");
1308
1309 auto canvasZProd = new TCanvas("canvasZProd", "canvasZProd", 1600, 1000);
1310 canvasZProd->cd();
1311 processvsZ->Draw("COLZ");
1312 canvasZProd->SaveAs("prodvsZ.png", "recreate");
1313 auto canvasRadProd = new TCanvas("canvasRadProd", "canvasRadProd", 1600, 1000);
1314 canvasRadProd->cd();
1315 processvsRad->Draw("COLZ");
1316 canvasRadProd->SaveAs("prodvsRad.png", "recreate");
1317 auto canvasRadProdO = new TCanvas("canvasRadProdO", "canvasRadProdO", 1600, 1000);
1318 canvasRadProdO->cd();
1319 processvsRadOther->Draw("COLZ");
1320 canvasRadProdO->SaveAs("prodvsRadO.png", "recreate");
1321 auto canvasRadProNOTr = new TCanvas("canvasRadProNOTr", "canvasRadProNOTr", 1600, 1000);
1322 canvasRadProNOTr->cd();
1323 processvsRadNotTracked->Draw("COLZ");
1324 canvasRadProNOTr->SaveAs("prodvsRadNoTr.png", "recreate");
1325 auto canvasEtaProNOTr = new TCanvas("canvasEtaProNOTr", "canvasEtaProNOTr", 1600, 1000);
1326 canvasEtaProNOTr->cd();
1327 processvsEtaNotTracked->Draw("COLZ");
1328 canvasEtaProNOTr->SaveAs("prodvsEtaNoTr.png", "recreate");
1329
1330 fout.cd();
1331 mCanvasPt->Write();
1332 mCanvasEta->Write();
1333 mCanvasPtSec->Write();
1334 mCanvasEtaSec->Write();
1335 mCanvasPtRes->Write();
1336 mCanvasPtRes2->Write();
1337 mCanvasPtRes3->Write();
1338 mCanvasPtRes4->Write();
1339 mCanvasRad->Write();
1340 mCanvasZ->Write();
1341 mCanvasRadD->Write();
1342 mCanvasZD->Write();
1343 canvas->Write();
1344 canvas2->Write();
1345 canvasPtfake->Write();
1346 canvasI->Write();
1347 canvasL->Write();
1348 canvasK->Write();
1349 fout.Close();
1350}
1351
1353{
1354}
1355
1356DataProcessorSpec getTrackCheckStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC, std::shared_ptr<o2::steer::MCKinematicsReader> kineReader)
1357{
1358 std::vector<OutputSpec> outputs;
1359 auto dataRequest = std::make_shared<DataRequest>();
1360 dataRequest->requestTracks(srcTracksMask, useMC);
1361 dataRequest->requestClusters(srcClustersMask, useMC);
1362
1363 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
1364 true, // GRPECS=true
1365 false, // GRPLHCIF
1366 true, // GRPMagField
1367 true, // askMatLUT
1369 dataRequest->inputs,
1370 true);
1371
1372 return DataProcessorSpec{
1373 "its-study-check-tracks",
1374 dataRequest->inputs,
1375 outputs,
1376 AlgorithmSpec{adaptFromTask<TrackCheckStudy>(dataRequest, srcTracksMask, useMC, kineReader, ggRequest)},
1377 Options{}};
1378}
1379
1380} // namespace o2::its::study
Definition of the ITSMFT compact cluster.
Wrapper container for different reconstructed object types.
int32_t i
const int16_t bb
Helper for geometry and GRP related CCDB requests.
Definition of the GeometryTGeo class.
Definition of the MCTrack class.
uint32_t j
Definition RawData.h:0
Definition of the ITS track.
Class for time synchronization of RawReader instances.
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
gsl::span< TruthElement > getLabels(uint32_t dataindex)
int getLayer(int index) const
Get chip layer, from 0.
static GeometryTGeo * Instance()
void fillMatrixCache(int mask) override
void run(ProcessingContext &) final
TrackCheckStudy(std::shared_ptr< DataRequest > dr, mask_t src, bool useMC, std::shared_ptr< o2::steer::MCKinematicsReader > kineReader, std::shared_ptr< o2::base::GRPGeomRequest > gr)
void endOfStream(EndOfStreamContext &) final
This is invoked whenever we have an EndOfStream event.
void setEfficiencyGraph(std::unique_ptr< TEfficiency > &, const char *, const char *, const int, const double, const double, const int, const double)
void init(InitContext &) final
void finaliseCCDB(ConcreteDataMatcher &, void *) final
void initialiseRun(o2::globaltracking::RecoContainer &)
struct _cl_event * event
Definition glcorearb.h:2982
GLdouble n
Definition glcorearb.h:1982
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
const GLfloat * m
Definition glcorearb.h:4066
GLenum src
Definition glcorearb.h:1767
GLsizeiptr size
Definition glcorearb.h:659
GLuint color
Definition glcorearb.h:1272
const GLdouble * v
Definition glcorearb.h:832
GLuint const GLchar * name
Definition glcorearb.h:781
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLenum GLenum GLsizei len
Definition glcorearb.h:4232
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ConfigParamSpec > Options
auto get(const std::byte *buffer, size_t=0)
Definition DataHeader.h:454
o2::framework::DataProcessorSpec getTrackCheckStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC, std::shared_ptr< o2::steer::MCKinematicsReader > kineReader)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
void collectData(o2::framework::ProcessingContext &pc, const DataRequest &request)
static constexpr int T2L
Definition Cartesian.h:55
static constexpr int T2GRot
Definition Cartesian.h:57
static constexpr int T2G
Definition Cartesian.h:56
std::vector< Cluster > clusters