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