Project
Loading...
Searching...
No Matches
Efficiency.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#include "TGeoGlobalMagField.h"
22#include "Framework/Task.h"
24#include "ITStracking/IOUtils.h"
29
30#include <TEfficiency.h>
31#include <TH1.h>
32#include <TH1D.h>
33#include <TH1I.h>
34#include <TH2D.h>
35#include <TH3D.h>
36#include <TCanvas.h>
37#include <TEfficiency.h>
38#include <TStyle.h>
39#include <TLegend.h>
40#include <TGraphErrors.h>
41#include <TGraphAsymmErrors.h>
42#include <TF1.h>
43#include <TObjArray.h>
44#include <THStack.h>
45#include <TString.h>
46#include <TAttMarker.h>
47#include <TArrayD.h>
48#include <cmath>
49#include <numeric>
50
51#define NLAYERS 3
52
53namespace o2::its::study
54{
55using namespace o2::framework;
56using namespace o2::globaltracking;
57
59
60class EfficiencyStudy final : public Task
61{
62 public:
63 EfficiencyStudy(std::shared_ptr<DataRequest> dr,
64 mask_t src,
65 bool useMC,
66 std::shared_ptr<o2::steer::MCKinematicsReader> kineReader,
67 std::shared_ptr<o2::base::GRPGeomRequest> gr) : mDataRequest(dr), mTracksSrc(src), mUseMC(useMC), mKineReader(kineReader), mGGCCDBRequest(gr){};
68
69 ~EfficiencyStudy() final = default;
70 void init(InitContext&) final;
71 void run(ProcessingContext&) final;
73 void finaliseCCDB(ConcreteDataMatcher&, void*) final;
74 void initialiseRun(o2::globaltracking::RecoContainer&);
75 void stileEfficiencyGraph(std::unique_ptr<TEfficiency>& eff, const char* name, const char* title, bool bidimensional, const int markerStyle, const double markersize, const int markercolor, const int linercolor);
76 int getDCAClusterTrackMC(int countDuplicated);
77 void studyDCAcutsMC();
80 void getEfficiency(bool isMC);
81 void process(o2::globaltracking::RecoContainer&);
82 void setClusterDictionary(const o2::itsmft::TopologyDictionary* d) { mDict = d; }
83
84 private:
85 void updateTimeDependentParams(ProcessingContext& pc);
86 bool mVerboseOutput = false;
87 bool mUseMC;
88 std::string mOutFileName;
89 double b;
90 std::shared_ptr<o2::steer::MCKinematicsReader> mKineReader;
91 GeometryTGeo* mGeometry;
92 const o2::itsmft::TopologyDictionary* mDict = nullptr;
93 float mrangesPt[NLAYERS][2] = {{0., 0.5}, {0.5, 2.}, {2., 7.5}};
94
95 // Spans
96 gsl::span<const o2::itsmft::ROFRecord> mTracksROFRecords;
97 gsl::span<const o2::itsmft::ROFRecord> mClustersROFRecords;
98 gsl::span<const o2::its::TrackITS> mTracks;
99 gsl::span<const o2::MCCompLabel> mTracksMCLabels;
100 gsl::span<const o2::itsmft::CompClusterExt> mClusters;
101 gsl::span<const unsigned char> mClusPatterns;
102 gsl::span<const int> mInputITSidxs;
103 const o2::dataformats::MCLabelContainer* mClustersMCLCont;
104 std::vector<o2::BaseCluster<float>> mITSClustersArray;
105
106 // Data
107 GTrackID::mask_t mTracksSrc{};
108 std::shared_ptr<DataRequest> mDataRequest;
109
110 // Utils
111 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
112 std::unique_ptr<TFile> mOutFile;
113 int mDuplicated_layer[NLAYERS] = {0};
114
116
117 // DCA betweeen track and original cluster
118 std::unique_ptr<TH1D> mDCAxyOriginal[NLAYERS];
119 std::unique_ptr<TH1D> mDCAzOriginal[NLAYERS];
120 // DCA betweeen track and duplicated cluster
121 std::unique_ptr<TH1D> mDCAxyDuplicated;
122 std::unique_ptr<TH1D> mDCAzDuplicated;
123
124 // DCA betweeen track and duplicated cluster per layer
125 std::unique_ptr<TH1D> mDCAxyDuplicated_layer[NLAYERS];
126 std::unique_ptr<TH1D> mDCAzDuplicated_layer[NLAYERS];
127
128 // phi, eta, pt of the cluster
129 std::unique_ptr<TH1D> mPhiOriginal[NLAYERS];
130 std::unique_ptr<TH1D> mEtaOriginal[NLAYERS];
131 std::unique_ptr<TH1D> mPtOriginal[NLAYERS];
132 std::unique_ptr<TH1D> mPtDuplicated[NLAYERS];
133 std::unique_ptr<TH1D> mEtaDuplicated[NLAYERS];
134 std::unique_ptr<TH1D> mPhiDuplicated[NLAYERS];
135 std::unique_ptr<TH1D> mPhiOriginalIfDuplicated[NLAYERS];
136
137 std::unique_ptr<TH2D> mZvsPhiDUplicated[NLAYERS];
138
139 // position of the clusters
140 std::unique_ptr<TH3D> m3DClusterPositions;
141 std::unique_ptr<TH3D> m3DDuplicatedClusterPositions;
142 std::unique_ptr<TH2D> m2DClusterOriginalPositions;
143 std::unique_ptr<TH2D> m2DClusterDuplicatedPositions;
144
145 // Efficiency histos
146 std::unique_ptr<TH1D> mEfficiencyGoodMatch;
147 std::unique_ptr<TH1D> mEfficiencyFakeMatch;
148 std::unique_ptr<TH1D> mEfficiencyTotal;
149 std::unique_ptr<TH1D> mEfficiencyGoodMatch_layer[NLAYERS];
150 std::unique_ptr<TH1D> mEfficiencyFakeMatch_layer[NLAYERS];
151 std::unique_ptr<TH1D> mEfficiencyTotal_layer[NLAYERS];
152 std::unique_ptr<TH2D> mEfficiencyGoodMatchPt_layer[NLAYERS];
153 std::unique_ptr<TH2D> mEfficiencyFakeMatchPt_layer[NLAYERS];
154 std::unique_ptr<TH2D> mEfficiencyGoodMatchEta_layer[NLAYERS];
155 std::unique_ptr<TH2D> mEfficiencyFakeMatchEta_layer[NLAYERS];
156 std::unique_ptr<TH2D> mEfficiencyGoodMatchPhi_layer[NLAYERS];
157 std::unique_ptr<TH2D> mEfficiencyGoodMatchPhiOriginal_layer[NLAYERS];
158 std::unique_ptr<TH2D> mEfficiencyFakeMatchPhi_layer[NLAYERS];
159
160 // std::unique_ptr<TH2D> mEfficiencyColEta[NLAYERS];
161 std::unique_ptr<TH2D> mDenColEta[NLAYERS];
162 std::unique_ptr<TH2D> mNumColEta[NLAYERS];
163 std::unique_ptr<TH2D> mDenRowPhi[NLAYERS];
164 std::unique_ptr<TH2D> mNumRowPhi[NLAYERS];
165 std::unique_ptr<TH2D> mDenRowCol[NLAYERS];
166 std::unique_ptr<TH2D> mNumRowCol[NLAYERS];
167
168 // phi, eta, pt of the duplicated cluster per layer
169 std::unique_ptr<TH2D> mPt_EtaDupl[NLAYERS];
170
171 // duplicated per layer and per cut
172 std::unique_ptr<TH1D> mDuplicatedEtaAllPt[NLAYERS];
173 std::unique_ptr<TH1D> mDuplicatedEta[NLAYERS][3];
174 std::unique_ptr<TH1D> mDuplicatedPhiAllPt[NLAYERS];
175 std::unique_ptr<TH1D> mDuplicatedPhi[NLAYERS][3];
176 std::unique_ptr<TH1D> mDuplicatedPt[NLAYERS];
177 std::unique_ptr<TH1D> mDuplicatedRow[NLAYERS];
178 std::unique_ptr<TH1D> mDuplicatedCol[NLAYERS];
179 std::unique_ptr<TH1D> mDuplicatedZ[NLAYERS];
180 std::unique_ptr<TH2D> mDuplicatedPtEta[NLAYERS];
181 std::unique_ptr<TH2D> mDuplicatedPtPhi[NLAYERS];
182 std::unique_ptr<TH2D> mDuplicatedEtaPhi[NLAYERS];
183
184 // matches per layer and per cut
185 std::unique_ptr<TH1D> mNGoodMatchesEtaAllPt[NLAYERS];
186 std::unique_ptr<TH1D> mNGoodMatchesEta[NLAYERS][3];
187 std::unique_ptr<TH1D> mNGoodMatchesPhiAllPt[NLAYERS];
188 std::unique_ptr<TH1D> mNGoodMatchesPhi[NLAYERS][3];
189
190 std::unique_ptr<TH1D> mNFakeMatchesEtaAllPt[NLAYERS];
191 std::unique_ptr<TH1D> mNFakeMatchesEta[NLAYERS][3];
192 std::unique_ptr<TH1D> mNFakeMatchesPhiAllPt[NLAYERS];
193 std::unique_ptr<TH1D> mNFakeMatchesPhi[NLAYERS][3];
194
195 std::unique_ptr<TH1D> mNGoodMatchesPt[NLAYERS];
196 std::unique_ptr<TH1D> mNFakeMatchesPt[NLAYERS];
197
198 std::unique_ptr<TH1D> mNGoodMatchesRow[NLAYERS];
199 std::unique_ptr<TH1D> mNFakeMatchesRow[NLAYERS];
200
201 std::unique_ptr<TH1D> mNGoodMatchesCol[NLAYERS];
202 std::unique_ptr<TH1D> mNFakeMatchesCol[NLAYERS];
203
204 std::unique_ptr<TH1D> mNGoodMatchesZ[NLAYERS];
205 std::unique_ptr<TH1D> mNFakeMatchesZ[NLAYERS];
206
207 std::unique_ptr<TH2D> mNGoodMatchesPtEta[NLAYERS];
208 std::unique_ptr<TH2D> mNFakeMatchesPtEta[NLAYERS];
209
210 std::unique_ptr<TH2D> mNGoodMatchesPtPhi[NLAYERS];
211 std::unique_ptr<TH2D> mNFakeMatchesPtPhi[NLAYERS];
212
213 std::unique_ptr<TH2D> mNGoodMatchesEtaPhi[NLAYERS];
214 std::unique_ptr<TH2D> mNFakeMatchesEtaPhi[NLAYERS];
215
216 // calculating the efficiency with TEfficiency class
217 std::unique_ptr<TEfficiency> mEffPtGood[NLAYERS];
218 std::unique_ptr<TEfficiency> mEffPtFake[NLAYERS];
219 std::unique_ptr<TEfficiency> mEffRowGood[NLAYERS];
220 std::unique_ptr<TEfficiency> mEffRowFake[NLAYERS];
221 std::unique_ptr<TEfficiency> mEffColGood[NLAYERS];
222 std::unique_ptr<TEfficiency> mEffColFake[NLAYERS];
223 std::unique_ptr<TEfficiency> mEffZGood[NLAYERS];
224 std::unique_ptr<TEfficiency> mEffZFake[NLAYERS];
225 std::unique_ptr<TEfficiency> mEffPtEtaGood[NLAYERS];
226 std::unique_ptr<TEfficiency> mEffPtEtaFake[NLAYERS];
227 std::unique_ptr<TEfficiency> mEffPtPhiGood[NLAYERS];
228 std::unique_ptr<TEfficiency> mEffPtPhiFake[NLAYERS];
229 std::unique_ptr<TEfficiency> mEffEtaPhiGood[NLAYERS];
230 std::unique_ptr<TEfficiency> mEffEtaPhiFake[NLAYERS];
231
232 std::unique_ptr<TEfficiency> mEffEtaGoodAllPt[NLAYERS];
233 std::unique_ptr<TEfficiency> mEffEtaGood[NLAYERS][3];
234 std::unique_ptr<TEfficiency> mEffEtaFakeAllPt[NLAYERS];
235 std::unique_ptr<TEfficiency> mEffEtaFake[NLAYERS][3];
236
237 std::unique_ptr<TEfficiency> mEffPhiGoodAllPt[NLAYERS];
238 std::unique_ptr<TEfficiency> mEffPhiGood[NLAYERS][3];
239 std::unique_ptr<TEfficiency> mEffPhiFakeAllPt[NLAYERS];
240 std::unique_ptr<TEfficiency> mEffPhiFake[NLAYERS][3];
241
242 std::unique_ptr<TH2D> mnGoodMatchesPt_layer[NLAYERS];
243 std::unique_ptr<TH2D> mnFakeMatchesPt_layer[NLAYERS];
244
245 std::unique_ptr<TH2D> mnGoodMatchesEta_layer[NLAYERS];
246 std::unique_ptr<TH2D> mnFakeMatchesEta_layer[NLAYERS];
247
248 std::unique_ptr<TH2D> mnGoodMatchesPhi_layer[NLAYERS];
249 std::unique_ptr<TH2D> mnGoodMatchesPhiOriginal_layer[NLAYERS];
250 std::unique_ptr<TH2D> mnFakeMatchesPhi_layer[NLAYERS];
251
252 std::unique_ptr<TH1D> DCAxyData[NLAYERS];
253 std::unique_ptr<TH1D> DCAzData[NLAYERS];
254
255 std::unique_ptr<TH1D> DCAxyRejected[NLAYERS];
256 std::unique_ptr<TH1D> DCAzRejected[NLAYERS];
257
258 std::unique_ptr<TH1D> denPt[NLAYERS];
259 std::unique_ptr<TH1D> numPt[NLAYERS];
260 std::unique_ptr<TH1D> numPtGood[NLAYERS];
261 std::unique_ptr<TH1D> numPtFake[NLAYERS];
262
263 std::unique_ptr<TH1D> denPhi[NLAYERS];
264 std::unique_ptr<TH1D> numPhi[NLAYERS];
265 std::unique_ptr<TH1D> numPhiGood[NLAYERS];
266 std::unique_ptr<TH1D> numPhiFake[NLAYERS];
267
268 std::unique_ptr<TH1D> denEta[NLAYERS];
269 std::unique_ptr<TH1D> numEta[NLAYERS];
270 std::unique_ptr<TH1D> numEtaGood[NLAYERS];
271 std::unique_ptr<TH1D> numEtaFake[NLAYERS];
272
273 std::unique_ptr<TH1D> denRow[NLAYERS];
274 std::unique_ptr<TH1D> numRow[NLAYERS];
275 std::unique_ptr<TH1D> numRowGood[NLAYERS];
276 std::unique_ptr<TH1D> numRowFake[NLAYERS];
277
278 std::unique_ptr<TH1D> denCol[NLAYERS];
279 std::unique_ptr<TH1D> numCol[NLAYERS];
280 std::unique_ptr<TH1D> numColGood[NLAYERS];
281 std::unique_ptr<TH1D> numColFake[NLAYERS];
282 std::unique_ptr<TH1D> denZ[NLAYERS];
283 std::unique_ptr<TH1D> numZ[NLAYERS];
284 std::unique_ptr<TH1D> numZGood[NLAYERS];
285 std::unique_ptr<TH1D> numZFake[NLAYERS];
286
287 std::unique_ptr<TH1D> numLayers;
288 std::unique_ptr<TH1D> denLayers;
289 std::unique_ptr<TH1D> numGoodLayers;
290 std::unique_ptr<TH1D> numFakeLayers;
291
292 int nDuplicatedClusters[NLAYERS] = {0};
293 int nTracksSelected[NLAYERS] = {0}; // denominator fot the efficiency calculation
294
295 std::unique_ptr<TH1D> IPOriginalxy[NLAYERS];
296 std::unique_ptr<TH1D> IPOriginalz[NLAYERS];
297
298 std::unique_ptr<TH1D> chipRowDuplicated[NLAYERS];
299 std::unique_ptr<TH1D> chipRowOriginalIfDuplicated[NLAYERS];
300
301 std::unique_ptr<TH1D> chi2trackAccepted;
302
304 std::unique_ptr<TH1D> phiFound[NLAYERS];
305 std::unique_ptr<TH1D> rowFound[NLAYERS];
306 std::unique_ptr<TH1D> phiNotFound[NLAYERS];
307 std::unique_ptr<TH1D> rowNotFound[NLAYERS];
308 std::unique_ptr<TH1D> zFound[NLAYERS];
309 std::unique_ptr<TH1D> zNotFound[NLAYERS];
310 std::unique_ptr<TH2D> colFoundOriginalVsDuplicated[NLAYERS];
311 std::unique_ptr<TH1D> colFoundOriginal[NLAYERS];
312 std::unique_ptr<TH1D> colNotFound[NLAYERS];
313 std::unique_ptr<TH1D> radiusFound[NLAYERS];
314 std::unique_ptr<TH1D> radiusNotFound[NLAYERS];
315 std::unique_ptr<TH2D> m2DClusterFoundPositions;
316 std::unique_ptr<TH2D> m2DClusterNotFoundPositions;
317 std::unique_ptr<TH1D> mChipNotFound;
318 std::unique_ptr<TH1D> mChipFound;
319 std::unique_ptr<TH2D> l0_00;
320 std::unique_ptr<TH2D> l1_15;
321 std::unique_ptr<TH2D> l2_19;
322 std::unique_ptr<TH2D> chipOrigVsOverlap;
323 std::unique_ptr<TH2D> chipmap;
324};
325
327{
328 LOGP(info, "init");
329
331
333 mOutFileName = pars.outFileName;
334 b = pars.b;
335
336 int nbPt = 75;
337 double xbins[nbPt + 1], ptcutl = 0.05, ptcuth = 7.5;
338 double a = std::log(ptcuth / ptcutl) / nbPt;
339 for (int i = 0; i <= nbPt; i++) {
340 xbins[i] = ptcutl * std::exp(i * a);
341 }
342
343 mOutFile = std::make_unique<TFile>(mOutFileName.c_str(), "recreate");
344
345 mDCAxyDuplicated = std::make_unique<TH1D>("dcaXYDuplicated", "Distance between track and duplicated cluster ;DCA xy (cm); ", 200, -0.01, 0.01);
346 mDCAzDuplicated = std::make_unique<TH1D>("dcaZDuplicated", "Distance between track and duplicated cluster ;DCA z (cm); ", 200, -0.01, 0.01);
347
348 m3DClusterPositions = std::make_unique<TH3D>("3DClusterPositions", ";x (cm);y (cm);z (cm)", 200, -10, 10, 200, -10, 10, 400, -20, 20);
349 m3DDuplicatedClusterPositions = std::make_unique<TH3D>("3DDuplicatedClusterPositions", ";x (cm);y (cm);z (cm)", 200, -10, 10, 200, -10, 10, 500, -30, 30);
350 m2DClusterOriginalPositions = std::make_unique<TH2D>("m2DClusterOriginalPositions", ";x (cm);y (cm)", 400, -10, 10, 400, -6, 6);
351 m2DClusterDuplicatedPositions = std::make_unique<TH2D>("m2DClusterDuplicatedPositions", ";x (cm);y (cm)", 400, -10, 10, 400, -6, 6);
352
353 mEfficiencyGoodMatch = std::make_unique<TH1D>("mEfficiencyGoodMatch", ";#sigma(DCA) cut;Efficiency;", 20, 0.5, 20.5);
354 mEfficiencyFakeMatch = std::make_unique<TH1D>("mEfficiencyFakeMatch", ";#sigma(DCA) cut;Efficiency;", 20, 0.5, 20.5);
355 mEfficiencyTotal = std::make_unique<TH1D>("mEfficiencyTotal", ";#sigma(DCA) cut;Efficiency;", 20, 0.5, 20.5);
356
357 chi2trackAccepted = std::make_unique<TH1D>("chi2trackAccepted", "; $#chi^{2}", 500, 0, 100);
358
359 m2DClusterFoundPositions = std::make_unique<TH2D>("m2DClusterFoundPositions", ";x (cm);y (cm)", 250, -5, 5, 250, -5, 5);
360 m2DClusterNotFoundPositions = std::make_unique<TH2D>("m2DClusterNotFoundPositions", ";x (cm);y (cm)", 250, -5, 5, 250, -5, 5);
361 mChipNotFound = std::make_unique<TH1D>("mChipNotFound", ";chipID", 432, 0, 432);
362 mChipFound = std::make_unique<TH1D>("mChipFound", ";chipID", 432, 0, 432);
363 l0_00 = std::make_unique<TH2D>("l0_00", ";col; row", 2304, -0.5, 9215.5, 128, -0.5, 511.5);
364 l1_15 = std::make_unique<TH2D>("l1_15", ";col; row", 2304, -0.5, 9215.5, 512, -0.5, 511.5);
365 l2_19 = std::make_unique<TH2D>("l2_19", ";col; row", 2304, -0.5, 9215.5, 512, -0.5, 511.5);
366 chipOrigVsOverlap = std::make_unique<TH2D>("chipOrigVsOverlap", ";chipID Overlap;chipID Original", 9, 0, 9, 9, 0, 9);
367 chipmap = std::make_unique<TH2D>("chipmap", ";Column;Row", 1024, 0, 1023, 512, -0.5, 511.5);
368
369 numLayers = std::make_unique<TH1D>("numLayers", "numLayers; ; Efficiency", 3, -0.5, 2.5);
370 numGoodLayers = std::make_unique<TH1D>("numGoodLayers", "numGoodLayers; ; Efficiency", 3, -0.5, 2.5);
371 numFakeLayers = std::make_unique<TH1D>("numFakeLayers", "numFakeLayers; ; Efficiency", 3, -0.5, 2.5);
372 denLayers = std::make_unique<TH1D>("denLayers", "denLayers; ; Efficiency", 3, -0.5, 2.5);
373
374 for (int i = 0; i < NLAYERS; i++) {
375
376 chipRowDuplicated[i] = std::make_unique<TH1D>(Form("chipPosDuplicated_L%d", i), Form("L%d; row", i), 512, -0.5, 511.5);
377 chipRowOriginalIfDuplicated[i] = std::make_unique<TH1D>(Form("chipPosOriginalIfDuplicated%d", i), Form("L%d; row", i), 512, -0.5, 511.5);
378
379 DCAxyData[i] = std::make_unique<TH1D>(Form("dcaXYData_L%d", i), "Distance between track and original cluster ;DCA xy (cm); ", 4000, -0.2, 0.2);
380 DCAzData[i] = std::make_unique<TH1D>(Form("dcaZData_L%d", i), "Distance between track and original cluster ;DCA z (cm); ", 4000, -0.2, 0.2);
381 DCAxyRejected[i] = std::make_unique<TH1D>(Form("DCAxyRejected%d", i), "Distance between track and original cluster (rejected) ;DCA xy (cm); ", 30000, -30, 30);
382 DCAzRejected[i] = std::make_unique<TH1D>(Form("DCAzRejected%d", i), "Distance between track and original cluster (rejected) ;DCA z (cm); ", 30000, -30, 30);
383
384 mDCAxyOriginal[i] = std::make_unique<TH1D>(Form("dcaXYOriginal_L%d", i), "Distance between track and original cluster ;DCA xy (cm); ", 200, -0.01, 0.01);
385 mDCAzOriginal[i] = std::make_unique<TH1D>(Form("dcaZOriginal_L%d", i), "Distance between track and original cluster ;DCA z (cm); ", 200, -0.01, 0.01);
386
387 mPhiOriginal[i] = std::make_unique<TH1D>(Form("phiOriginal_L%d", i), ";phi (rad); ", 90, -3.2, 3.2);
388 mEtaOriginal[i] = std::make_unique<TH1D>(Form("etaOriginal_L%d", i), ";eta (rad); ", 100, -2, 2);
389 mPtOriginal[i] = std::make_unique<TH1D>(Form("ptOriginal_L%d", i), ";pt (GeV/c); ", 100, 0, 10);
390
391 mZvsPhiDUplicated[i] = std::make_unique<TH2D>(Form("zvsphiDuplicated_L%d", i), ";z (cm);phi (rad)", 400, -20, 20, 90, -3.2, 3.2);
392
393 mPtDuplicated[i] = std::make_unique<TH1D>(Form("ptDuplicated_L%d", i), ";pt (GeV/c); ", nbPt, 0, 7.5); // xbins);
394 mEtaDuplicated[i] = std::make_unique<TH1D>(Form("etaDuplicated_L%d", i), ";eta; ", 40, -2, 2);
395 mPhiDuplicated[i] = std::make_unique<TH1D>(Form("phiDuplicated_L%d", i), ";phi (rad); ", 90, -3.2, 3.2);
396 mPhiOriginalIfDuplicated[i] = std::make_unique<TH1D>(Form("phiOriginalIfDuplicated_L%d", i), ";phi (rad); ", 90, -3.2, 3.2);
397 mDCAxyDuplicated_layer[i] = std::make_unique<TH1D>(Form("dcaXYDuplicated_layer_L%d", i), "Distance between track and duplicated cluster ;DCA xy (cm); ", 100, -0.01, 0.01);
398 mDCAzDuplicated_layer[i] = std::make_unique<TH1D>(Form("dcaZDuplicated_layer_L%d", i), "Distance between track and duplicated cluster ;DCA z (cm); ", 100, -0.01, 0.01);
399
400 mEfficiencyGoodMatch_layer[i] = std::make_unique<TH1D>(Form("mEfficiencyGoodMatch_layer_L%d", i), ";#sigma(DCA) cut;Efficiency;", 20, 0.5, 20.5);
401 mEfficiencyFakeMatch_layer[i] = std::make_unique<TH1D>(Form("mEfficiencyFakeMatch_layer_L%d", i), ";#sigma(DCA) cut;Efficiency;", 20, 0.5, 20.5);
402 mEfficiencyTotal_layer[i] = std::make_unique<TH1D>(Form("mEfficiencyTotal_layer_L%d", i), ";#sigma(DCA) cut;Efficiency;", 20, 0.5, 20.5);
403
404 mEfficiencyGoodMatchPt_layer[i] = std::make_unique<TH2D>(Form("mEfficiencyGoodMatchPt_layer_L%d", i), ";#it{p}_{T} (GeV/c);#sigma(DCA) cut;Efficiency;", nbPt, 0, 7.5, /* xbins*/ 20, 0.5, 20.5);
405 mEfficiencyFakeMatchPt_layer[i] = std::make_unique<TH2D>(Form("mEfficiencyFakeMatchPt_layer_L%d", i), ";#it{p}_{T} (GeV/c);#sigma(DCA) cut;Efficiency;", nbPt, 0, 7.5, /* xbins*/ 20, 0.5, 20.5);
406
407 mEfficiencyGoodMatchEta_layer[i] = std::make_unique<TH2D>(Form("mEfficiencyGoodMatchEta_layer_L%d", i), ";#eta;#sigma(DCA) cut;Efficiency;", 40, -2, 2, 20, 0.5, 20.5);
408 mEfficiencyFakeMatchEta_layer[i] = std::make_unique<TH2D>(Form("mEfficiencyFakeMatchEta_layer_L%d", i), ";#eta;#sigma(DCA) cut;Efficiency;", 40, -2, 2, 20, 0.5, 20.5);
409
410 mEfficiencyGoodMatchPhi_layer[i] = std::make_unique<TH2D>(Form("mEfficiencyGoodMatchPhi_layer_L%d", i), ";#phi;#sigma(DCA) cut;Efficiency;", 90, -3.2, 3.2, 20, 0.5, 20.5);
411 mEfficiencyGoodMatchPhiOriginal_layer[i] = std::make_unique<TH2D>(Form("mEfficiencyGoodMatchPhiOriginal_layer_L%d", i), ";#phi Original;#sigma(DCA) cut;Efficiency;", 90, -3.2, 3.2, 20, 0.5, 20.5);
412 mEfficiencyFakeMatchPhi_layer[i] = std::make_unique<TH2D>(Form("mEfficiencyFakeMatchPhi_layer_L%d", i), ";#phi;#sigma(DCA) cut;Efficiency;", 90, -3.2, 3.2, 20, 0.5, 20.5);
413
414 mPt_EtaDupl[i] = std::make_unique<TH2D>(Form("mPt_EtaDupl_L%d", i), ";#it{p}_{T} (GeV/c);#eta; ", 100, 0, 10, 100, -2, 2);
415
416 mDuplicatedPt[i] = std::make_unique<TH1D>(Form("mDuplicatedPt_log_L%d", i), Form("; #it{p}_{T} (GeV/c); Number of duplciated clusters L%d", i), nbPt, 0, 7.5 /* xbins*/);
417 mDuplicatedPt[i]->Sumw2();
418 mNGoodMatchesPt[i] = std::make_unique<TH1D>(Form("mNGoodMatchesPt_L%d", i), Form("; #it{p}_{T} (GeV/c); Number of good matches L%d", i), nbPt, 0, 7.5 /* xbins*/);
419 mNGoodMatchesPt[i]->Sumw2();
420 mNFakeMatchesPt[i] = std::make_unique<TH1D>(Form("mNFakeMatchesPt_L%d", i), Form("; #it{p}_{T} (GeV/c); Number of fake matches L%d", i), nbPt, 0, 7.5 /* xbins*/);
421 mNFakeMatchesPt[i]->Sumw2();
422
423 mDuplicatedRow[i] = std::make_unique<TH1D>(Form("mDuplicatedRow_L%d", i), Form("; Row; Number of duplciated clusters L%d", i), 128, -0.5, 511.5);
424 mDuplicatedRow[i]->Sumw2();
425 mNGoodMatchesRow[i] = std::make_unique<TH1D>(Form("mNGoodMatchesRow_L%d", i), Form("; Row; Number of good matches L%d", i), 128, -0.5, 511.5);
426 mNGoodMatchesRow[i]->Sumw2();
427 mNFakeMatchesRow[i] = std::make_unique<TH1D>(Form("mNFakeMatchesRow_L%d", i), Form(";Row; Number of fake matches L%d", i), 128, -0.5, 511.5);
428 mNFakeMatchesRow[i]->Sumw2();
429
430 mDuplicatedCol[i] = std::make_unique<TH1D>(Form("mDuplicatedCol_L%d", i), Form("; Col; Number of duplciated clusters L%d", i), 128, -0.5, 1023.5);
431 mDuplicatedCol[i]->Sumw2();
432 mNGoodMatchesCol[i] = std::make_unique<TH1D>(Form("mNGoodMatchesCol_L%d", i), Form("; Col; Number of good matches L%d", i), 128, -0.5, 1023.5);
433 mNGoodMatchesCol[i]->Sumw2();
434 mNFakeMatchesCol[i] = std::make_unique<TH1D>(Form("mNFakeMatchesCol_L%d", i), Form(";Col; Number of fake matches L%d", i), 128, -0.5, 1023.5);
435 mNFakeMatchesCol[i]->Sumw2();
436
437 mDuplicatedZ[i] = std::make_unique<TH1D>(Form("mDuplicatedZ_L%d", i), Form("; Z (cm); Number of duplciated clusters L%d", i), 100, -15, 15);
438 mDuplicatedZ[i]->Sumw2();
439 mNGoodMatchesZ[i] = std::make_unique<TH1D>(Form("mNGoodMatchesZ_L%d", i), Form("; Z (cm); Number of good matches L%d", i), 100, -15, 15);
440 mNGoodMatchesZ[i]->Sumw2();
441 mNFakeMatchesZ[i] = std::make_unique<TH1D>(Form("mNFakeMatchesZ_L%d", i), Form(";Z (cm); Number of fake matches L%d", i), 100, -15, 15);
442 mNFakeMatchesZ[i]->Sumw2();
443
444 mDuplicatedPtEta[i] = std::make_unique<TH2D>(Form("mDuplicatedPtEta_log_L%d", i), Form("; #it{p}_{T} (GeV/c);#eta; Number of duplciated clusters L%d", i), nbPt, 0, 7.5 /* xbins*/, 40, -2, 2);
445 mDuplicatedPtEta[i]->Sumw2();
446 mNGoodMatchesPtEta[i] = std::make_unique<TH2D>(Form("mNGoodMatchesPtEta_L%d", i), Form("; #it{p}_{T} (GeV/c);#eta; Number of good matches L%d", i), nbPt, 0, 7.5 /* xbins*/, 40, -2, 2);
447 mNGoodMatchesPtEta[i]->Sumw2();
448 mNFakeMatchesPtEta[i] = std::make_unique<TH2D>(Form("mNFakeMatchesPtEta_L%d", i), Form("; #it{p}_{T} (GeV/c);#eta; Number of good matches L%d", i), nbPt, 0, 7.5 /* xbins*/, 40, -2, 2);
449 mNFakeMatchesPtEta[i]->Sumw2();
450
451 mDuplicatedPtPhi[i] = std::make_unique<TH2D>(Form("mDuplicatedPtPhi_log_L%d", i), Form("; #it{p}_{T} (GeV/c);#phi (rad); Number of duplciated clusters L%d", i), nbPt, 0, 7.5 /* xbins*/, 90, -3.2, 3.2);
452 mDuplicatedPtPhi[i]->Sumw2();
453 mNGoodMatchesPtPhi[i] = std::make_unique<TH2D>(Form("mNGoodMatchesPtPhi_L%d", i), Form("; #it{p}_{T} (GeV/c);#phi (rad); Number of good matches L%d", i), nbPt, 0, 7.5 /* xbins*/, 90, -3.2, 3.2);
454 mNGoodMatchesPtPhi[i]->Sumw2();
455 mNFakeMatchesPtPhi[i] = std::make_unique<TH2D>(Form("mNFakeMatchesPtPhi_L%d", i), Form("; #it{p}_{T} (GeV/c);#phi (rad); Number of good matches L%d", i), nbPt, 0, 7.5 /* xbins*/, 90, -3.2, 3.2);
456 mNFakeMatchesPtPhi[i]->Sumw2();
457
458 mDuplicatedEtaPhi[i] = std::make_unique<TH2D>(Form("mDuplicatedEtaPhi_L%d", i), Form("; #eta;#phi (rad); Number of duplciated clusters L%d", i), 40, -2, 2, 90, -3.2, 3.2);
459 mDuplicatedEtaPhi[i]->Sumw2();
460 mNGoodMatchesEtaPhi[i] = std::make_unique<TH2D>(Form("mNGoodMatchesEtaPhi_L%d", i), Form("; #eta;#phi (rad); Number of good matches L%d", i), 40, -2, 2, 90, -3.2, 3.2);
461 mNGoodMatchesEtaPhi[i]->Sumw2();
462 mNFakeMatchesEtaPhi[i] = std::make_unique<TH2D>(Form("mNFakeMatchesEtaPhi_L%d", i), Form("; #eta;#phi (rad); Number of good matches L%d", i), 40, -2, 2, 90, -3.2, 3.2);
463 mNFakeMatchesEtaPhi[i]->Sumw2();
464
465 mDuplicatedEtaAllPt[i] = std::make_unique<TH1D>(Form("mDuplicatedEtaAllPt_L%d", i), Form("; #eta; Number of duplicated clusters L%d", i), 40, -2, 2);
466 mNGoodMatchesEtaAllPt[i] = std::make_unique<TH1D>(Form("mNGoodMatchesEtaAllPt_L%d", i), Form("; #eta; Number of good matches L%d", i), 40, -2, 2);
467 mNFakeMatchesEtaAllPt[i] = std::make_unique<TH1D>(Form("mNFakeMatchesEtaAllPt_L%d", i), Form("; #eta; Number of fake matches L%d", i), 40, -2, 2);
468
469 mDuplicatedPhiAllPt[i] = std::make_unique<TH1D>(Form("mDuplicatedPhiAllPt_L%d", i), Form("; #phi (rad); Number of duplicated clusters L%d", i), 90, -3.2, 3.2);
470 mNGoodMatchesPhiAllPt[i] = std::make_unique<TH1D>(Form("mNGoodMatchesPhiAllPt_L%d", i), Form("; #phi (rad); Number of good matches L%d", i), 90, -3.2, 3.2);
471 mNFakeMatchesPhiAllPt[i] = std::make_unique<TH1D>(Form("mNFakeMatchesPhiAllPt_L%d", i), Form("; #phi (rad); Number of fake matches L%d", i), 90, -3.2, 3.2);
472
473 mnGoodMatchesPt_layer[i] = std::make_unique<TH2D>(Form("mnGoodMatchesPt_layer_L%d", i), ";pt; nGoodMatches", nbPt, 0, 7.5 /* xbins*/, 20, 0.5, 20.5);
474 mnFakeMatchesPt_layer[i] = std::make_unique<TH2D>(Form("mnFakeMatchesPt_layer_L%d", i), ";pt; nFakeMatches", nbPt, 0, 7.5 /* xbins*/, 20, 0.5, 20.5);
475 mnGoodMatchesEta_layer[i] = std::make_unique<TH2D>(Form("mnGoodMatchesEta_layer_L%d", i), ";#eta; nGoodMatches", 40, -2, 2, 20, 0.5, 20.5);
476 mnFakeMatchesEta_layer[i] = std::make_unique<TH2D>(Form("mnFakeMatchesEta_layer_L%d", i), ";#eta; nFakeMatches", 40, -2, 2, 20, 0.5, 20.5);
477 mnGoodMatchesPhi_layer[i] = std::make_unique<TH2D>(Form("mnGoodMatchesPhi_layer_L%d", i), ";#Phi; nGoodMatches", 90, -3.2, 3.2, 20, 0.5, 20.5);
478 mnGoodMatchesPhiOriginal_layer[i] = std::make_unique<TH2D>(Form("mnGoodMatchesPhiOriginal_layer_L%d", i), ";#Phi of the original Cluster; nGoodMatches", 90, -3.2, 3.2, 20, 0.5, 20.5);
479 mnFakeMatchesPhi_layer[i] = std::make_unique<TH2D>(Form("mnFakeMatchesPhi_layer_L%d", i), ";#Phi; nFakeMatches", 90, -3.2, 3.2, 20, 0.5, 20.5);
480
481 denPt[i] = std::make_unique<TH1D>(Form("denPt_L%d", i), Form("denPt_L%d", i), nbPt, 0, 7.5 /* xbins*/);
482 numPt[i] = std::make_unique<TH1D>(Form("numPt_L%d", i), Form("numPt_L%d", i), nbPt, 0, 7.5 /* xbins*/);
483 numPtGood[i] = std::make_unique<TH1D>(Form("numPtGood_L%d", i), Form("numPtGood_L%d", i), nbPt, 0, 7.5 /* xbins*/);
484 numPtFake[i] = std::make_unique<TH1D>(Form("numPtFake_L%d", i), Form("numPtFake_L%d", i), nbPt, 0, 7.5 /* xbins*/);
485
486 denPhi[i] = std::make_unique<TH1D>(Form("denPhi_L%d", i), Form("denPhi_L%d", i), 90, -3.2, 3.2);
487 numPhi[i] = std::make_unique<TH1D>(Form("numPhi_L%d", i), Form("numPhi_L%d", i), 90, -3.2, 3.2);
488 numPhiGood[i] = std::make_unique<TH1D>(Form("numPhiGood_L%d", i), Form("numPhiGood_L%d", i), 90, -3.2, 3.2);
489 numPhiFake[i] = std::make_unique<TH1D>(Form("numPhiFake_L%d", i), Form("numPhiFake_L%d", i), 90, -3.2, 3.2);
490
491 denEta[i] = std::make_unique<TH1D>(Form("denEta_L%d", i), Form("denEta_L%d", i), 200, -2, 2);
492 numEta[i] = std::make_unique<TH1D>(Form("numEta_L%d", i), Form("numEta_L%d", i), 200, -2, 2);
493 numEtaGood[i] = std::make_unique<TH1D>(Form("numEtaGood_L%d", i), Form("numEtaGood_L%d", i), 200, -2, 2);
494 numEtaFake[i] = std::make_unique<TH1D>(Form("numEtaFake_L%d", i), Form("numEtaFake_L%d", i), 200, -2, 2);
495
496 denRow[i] = std::make_unique<TH1D>(Form("denRow_L%d", i), Form("denRow_L%d", i), 128, -0.5, 511.5);
497 numRow[i] = std::make_unique<TH1D>(Form("numRow_L%d", i), Form("numRow_L%d", i), 128, -0.5, 511.5);
498 numRowGood[i] = std::make_unique<TH1D>(Form("numRowGood_L%d", i), Form("numRowGood_L%d", i), 128, -0.5, 511.5);
499 numRowFake[i] = std::make_unique<TH1D>(Form("numRowFake_L%d", i), Form("numRowFake_L%d", i), 128, -0.5, 511.5);
500
501 denCol[i] = std::make_unique<TH1D>(Form("denCol_L%d", i), Form("denCol_L%d", i), 128, -0.5, 1023.5);
502 numCol[i] = std::make_unique<TH1D>(Form("numCol_L%d", i), Form("numCol_L%d", i), 128, -0.5, 1023.5);
503 numColGood[i] = std::make_unique<TH1D>(Form("numColGood_L%d", i), Form("numColGood_L%d", i), 128, -0.5, 1023.5);
504 numColFake[i] = std::make_unique<TH1D>(Form("numColFake_L%d", i), Form("numColFake_L%d", i), 128, -0.5, 1023.5);
505
506 denZ[i] = std::make_unique<TH1D>(Form("denZ_L%d", i), Form("denZ_L%d", i), 100, -15, 15);
507 numZ[i] = std::make_unique<TH1D>(Form("numZ_L%d", i), Form("numZ_L%d", i), 100, -15, 15);
508 numZGood[i] = std::make_unique<TH1D>(Form("numZGood_L%d", i), Form("numZGood_L%d", i), 100, -15, 15);
509 numZFake[i] = std::make_unique<TH1D>(Form("numZFake_L%d", i), Form("numZFake_L%d", i), 100, -15, 15);
510
511 mDenColEta[i] = std::make_unique<TH2D>(Form("mDenColEta_L%d", i), Form("mDenColEta_L%d", i), 128, -0.5, 1023.5, 50, -1, 1);
512 mNumColEta[i] = std::make_unique<TH2D>(Form("mNumColEta_L%d", i), Form("mNumColEta_L%d", i), 128, -0.5, 1023.5, 50, -1, 1);
513
514 mDenRowPhi[i] = std::make_unique<TH2D>(Form("mDenRowPhi_L%d", i), Form("mDenRowPhi_L%d", i), 128, -0.5, 511.5, 90, -3.2, 3.2);
515 mNumRowPhi[i] = std::make_unique<TH2D>(Form("mNumRowPhi_L%d", i), Form("mNumRowPhi_L%d", i), 128, -0.5, 511.5, 90, -3.2, 3.2);
516
517 mDenRowCol[i] = std::make_unique<TH2D>(Form("mDenRowCol_L%d", i), Form("mDenRowCol_L%d", i), 128, -0.5, 511.5, 128, -0.5, 1023.5);
518 mNumRowCol[i] = std::make_unique<TH2D>(Form("mNumRowCol_L%d", i), Form("mNumRowCol_L%d", i), 128, -0.5, 511.5, 128, -0.5, 1023.5);
519
520 IPOriginalxy[i] = std::make_unique<TH1D>(Form("IPOriginalxy_L%d", i), Form("IPOriginalxy_L%d", i), 500, -0.002, 0.002);
521 IPOriginalz[i] = std::make_unique<TH1D>(Form("IPOriginalz_L%d", i), Form("IPOriginalz_L%d", i), 200, -10, 10);
522
523 phiFound[i] = std::make_unique<TH1D>(Form("phiFound_L%d", i), Form("phiFound_L%d", i), 190, -3.2, 3.2);
524 rowFound[i] = std::make_unique<TH1D>(Form("rowFound_L%d", i), Form("rowFound_L%d", i), 128, -0.5, 511.5);
525 phiNotFound[i] = std::make_unique<TH1D>(Form("phiNotFound_L%d", i), Form("phiNotFound_L%d", i), 90, -3.2, 3.2);
526 rowNotFound[i] = std::make_unique<TH1D>(Form("rowNotFound_L%d", i), Form("rowNotFound_L%d", i), 128, -0.5, 511.5);
527 zFound[i] = std::make_unique<TH1D>(Form("zFound_L%d", i), Form("zFound_L%d", i), 100, -15, 15);
528 zNotFound[i] = std::make_unique<TH1D>(Form("zNotFound%d", i), Form("zNotFound%d", i), 100, -15, 15);
529 colFoundOriginalVsDuplicated[i] = std::make_unique<TH2D>(Form("colFoundOriginalVsDuplicated_L%d", i), Form("colFoundOriginalVsDuplicated_L%d; Col Original cluster; Col Overlap cluster", i), 9216, -0.5, 9215.5, 9216, -0.5, 9215.5);
530 colFoundOriginal[i] = std::make_unique<TH1D>(Form("colFoundOriginal_L%d", i), Form("colFoundOriginal_L%d; Col Original cluster;", i), 9216, -0.5, 9215.5);
531 colNotFound[i] = std::make_unique<TH1D>(Form("colNotFound_L%d", i), Form("colNotFound_L%d", i), 9216, -0.5, 9215.5);
532 radiusFound[i] = std::make_unique<TH1D>(Form("radiusFound_L%d", i), Form("radiusFound_L%d", i), 80, 0, 6);
533 radiusNotFound[i] = std::make_unique<TH1D>(Form("radiusNotFound_L%d", i), Form("radiusNotFound_L%d", i), 80, 0, 4);
534
535 for (int j = 0; j < 3; j++) {
536 mDuplicatedEta[i][j] = std::make_unique<TH1D>(Form("mDuplicatedEta_L%d_pt%d", i, j), Form("%f < #it{p}_{T} < %f GeV/c; #eta; Number of duplicated clusters L%d", mrangesPt[j][0], mrangesPt[j][1], i), 40, -2, 2);
537 mNGoodMatchesEta[i][j] = std::make_unique<TH1D>(Form("mNGoodMatchesEta_L%d_pt%d", i, j), Form("%f < #it{p}_{T} < %f GeV/c; #eta; Number of good matches L%d", mrangesPt[j][0], mrangesPt[j][1], i), 40, -2, 2);
538 mNFakeMatchesEta[i][j] = std::make_unique<TH1D>(Form("mNFakeMatchesEta_L%d_pt%d", i, j), Form("%f < #it{p}_{T} < %f GeV/c; #eta; Number of fake matches L%d", mrangesPt[j][0], mrangesPt[j][1], i), 40, -2, 2);
539
540 mDuplicatedPhi[i][j] = std::make_unique<TH1D>(Form("mDuplicatedPhi_L%d_pt%d", i, j), Form("%f < #it{p}_{T} < %f GeV/c; #phi; Number of duplicated clusters L%d", mrangesPt[j][0], mrangesPt[j][1], i), 90, -3.2, 3.2);
541 mNGoodMatchesPhi[i][j] = std::make_unique<TH1D>(Form("mNGoodMatchesPhi_L%d_pt%d", i, j), Form("%f < #it{p}_{T} < %f GeV/c; #phi; Number of good matches L%d", mrangesPt[j][0], mrangesPt[j][1], i), 90, -3.2, 3.2);
542 mNFakeMatchesPhi[i][j] = std::make_unique<TH1D>(Form("mNFakeMatchesPhi_L%d_pt%d", i, j), Form("%f < #it{p}_{T} < %f GeV/c; #phi; Number of fake matches L%d", mrangesPt[j][0], mrangesPt[j][1], i), 90, -3.2, 3.2);
543 }
544 }
545 gStyle->SetPalette(55);
546}
547
549{
550 LOGP(info, "--------------- run");
552 recoData.collectData(pc, *mDataRequest.get());
553
554 updateTimeDependentParams(pc); // Make sure this is called after recoData.collectData, which may load some conditions
555 initialiseRun(recoData);
556 process(recoData);
557}
558
560{
561 LOGP(info, "--------------- initialiseRun");
562 if (recoData.getITSPerLayer()) {
563 // The duplicated-cluster search scans the cluster ROF whose index equals that of the track ROF and
564 // relies on the two ROF series being the same. With the staggered readout every layer has its own
565 // ROF length and numbering, while the track ROFs follow the clock layer only, so the ROF of the
566 // layer to scan has to be found from the track time instead. This requires deciding whether a
567 // duplicate is searched in a single ROF or in all the ROFs compatible with the track time bracket.
568 LOGP(fatal, "EfficiencyStudy does not support the per-layer (staggered) ITS clusters input yet");
569 }
570 if (mUseMC) {
571 mTracksMCLabels = recoData.getITSTracksMCLabels();
572 mClustersMCLCont = recoData.getITSClustersMCLabels();
573 }
574 mITSClustersArray.clear();
575 mTracksROFRecords = recoData.getITSTracksROFRecords();
576 mTracks = recoData.getITSTracks();
577 mClusters = recoData.getITSClusters();
578 mClustersROFRecords = recoData.getITSClustersROFRecords();
579 mClusPatterns = recoData.getITSClustersPatterns();
580 mInputITSidxs = recoData.getITSTracksClusterRefs();
581 mITSClustersArray.reserve(mClusters.size());
582 auto pattIt = mClusPatterns.begin();
583 o2::its::ioutils::convertCompactClusters(mClusters, pattIt, mITSClustersArray, mDict); // clusters converted to 3D spacepoints
584}
585
586void EfficiencyStudy::stileEfficiencyGraph(std::unique_ptr<TEfficiency>& eff, const char* name, const char* title, bool bidimensional = false, const int markerStyle = kFullCircle, const double markersize = 1, const int markercolor = kBlack, const int linecolor = kBlack)
587{
588 eff->SetName(name);
589 eff->SetTitle(title);
590 if (!bidimensional) {
591 eff->SetMarkerStyle(markerStyle);
592 eff->SetMarkerSize(markersize);
593 eff->SetMarkerColor(markercolor);
594 eff->SetLineColor(linecolor);
595 }
596}
597
598int EfficiencyStudy::getDCAClusterTrackMC(int countDuplicated = 0)
599{
600 // get the DCA between the clusters and the track from MC and fill histograms: distance between original and duplicated cluster, DCA, phi, clusters
601 // used to study the DCA cut to be applied
602 LOGP(info, "--------------- getDCAClusterTrackMC");
603
604 o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
605 std::array<float, 2> clusOriginalDCA, clusDuplicatedDCA;
606 auto propagator = o2::base::Propagator::Instance();
607
608 auto bz = o2::base::Propagator::Instance()->getNominalBz();
609 LOG(info) << ">>>>>>>>>>>> Magnetic field: " << bz;
610
611 unsigned int rofIndexTrack = 0;
612 unsigned int rofNEntriesTrack = 0;
613 unsigned int rofIndexClus = 0;
614 unsigned int rofNEntriesClus = 0;
615 int nLabels = 0;
616 unsigned int totClus = 0;
617
618 int duplicated = 0;
619
620 std::unordered_map<o2::MCCompLabel, std::vector<int>> label_vecClus[mClustersROFRecords.size()][NLAYERS]; // array of maps nRofs x Nlayers -> {label, vec(iClus)} where vec(iClus) are the clusters that share the same label
621
622 for (unsigned int iROF = 0; iROF < mTracksROFRecords.size(); iROF++) { // loop on ROFRecords array
623 rofIndexTrack = mTracksROFRecords[iROF].getFirstEntry();
624 rofNEntriesTrack = mTracksROFRecords[iROF].getNEntries();
625
626 rofIndexClus = mClustersROFRecords[iROF].getFirstEntry();
627 rofNEntriesClus = mClustersROFRecords[iROF].getNEntries();
628
629 for (unsigned int iTrack = rofIndexTrack; iTrack < rofIndexTrack + rofNEntriesTrack; iTrack++) { // loop on tracks per ROF
630 auto track = mTracks[iTrack];
631 o2::track::TrackParCov trackParCov = mTracks[iTrack];
632 int firstClus = track.getFirstClusterEntry(); // get the first cluster of the track
633 int ncl = track.getNumberOfClusters(); // get the number of clusters of the track
634
635 if (ncl < 7) {
636 continue;
637 }
638
639 float ip[2]; // IP from 0,0,0 and the track should be the deplacement of the primary vertex
640 track.getImpactParams(0, 0, 0, 0, ip);
641
642 // if (abs(ip[0])>0.001 ) continue; ///pv not in (0,0,0)
643
644 auto& tracklab = mTracksMCLabels[iTrack];
645 if (tracklab.isFake()) {
646 continue;
647 }
648
649 auto pt = trackParCov.getPt();
650 auto eta = trackParCov.getEta();
651
652 // if (pt < mPtCuts[0] || pt > mPtCuts[1]) {
653 // continue;
654 // }
655 // if (eta < mEtaCuts[0] || eta > mEtaCuts[1]) {
656 // continue;
657 // }
658
659 float phioriginal = 0;
660 float phiduplicated = 0;
661
662 for (int iclTrack = firstClus; iclTrack < firstClus + ncl; iclTrack++) { // loop on clusters associated to the track
663 auto& clusOriginal = mClusters[mInputITSidxs[iclTrack]];
664 auto clusOriginalPoint = mITSClustersArray[mInputITSidxs[iclTrack]]; // cluster spacepoint in the tracking system
665 auto staveOriginal = mGeometry->getStave(clusOriginal.getSensorID());
666 auto chipOriginal = mGeometry->getChipIdInStave(clusOriginal.getSensorID());
667
668 UShort_t rowOriginal = clusOriginal.getRow();
669 UShort_t colOriginal = clusOriginal.getCol();
670
671 auto layer = mGeometry->getLayer(clusOriginal.getSensorID());
672 if (layer >= NLAYERS) {
673 continue; // checking only selected layers
674 }
675 auto labsTrack = mClustersMCLCont->getLabels(mInputITSidxs[iclTrack]); // get labels of the cluster associated to the track
676
677 o2::math_utils::Point3D<float> clusOriginalPointTrack = {clusOriginalPoint.getX(), clusOriginalPoint.getY(), clusOriginalPoint.getZ()};
678 o2::math_utils::Point3D<float> clusOriginalPointGlob = mGeometry->getMatrixT2G(clusOriginal.getSensorID()) * clusOriginalPointTrack;
679
680 phioriginal = clusOriginalPointGlob.phi(); // * 180 / M_PI;
681
682 mPhiOriginal[layer]->Fill(phioriginal);
683 mPtOriginal[layer]->Fill(pt);
684 mEtaOriginal[layer]->Fill(eta);
685 m3DClusterPositions->Fill(clusOriginalPointGlob.x(), clusOriginalPointGlob.y(), clusOriginalPointGlob.z());
686 m2DClusterOriginalPositions->Fill(clusOriginalPointGlob.x(), clusOriginalPointGlob.y());
687
688 for (auto& labT : labsTrack) { // for each valid label iterate over ALL the clusters in the ROF to see if there are duplicates
689 if (labT != tracklab) {
690 continue;
691 }
692 nLabels++;
693 if (labT.isValid()) {
694 for (unsigned int iClus = rofIndexClus; iClus < rofIndexClus + rofNEntriesClus; iClus++) { // iteration over ALL the clusters in the ROF
695
696 auto clusDuplicated = mClusters[iClus];
697 auto clusDuplicatedPoint = mITSClustersArray[iClus];
698
699 auto layerClus = mGeometry->getLayer(clusDuplicated.getSensorID());
700 if (layerClus != layer) {
701 continue;
702 }
703
704 o2::math_utils::Point3D<float> clusDuplicatedPointTrack = {clusDuplicatedPoint.getX(), clusDuplicatedPoint.getY(), clusDuplicatedPoint.getZ()};
705 o2::math_utils::Point3D<float> clusDuplicatedPointGlob = mGeometry->getMatrixT2G(clusDuplicated.getSensorID()) * clusDuplicatedPointTrack;
706 // phiduplicated = std::atan2(clusDuplicatedPointGlob.y(), clusDuplicatedPointGlob.x()) * 180 / M_PI + 180;
707 phiduplicated = clusDuplicatedPointGlob.phi(); // * 180 / M_PI;
708
709 auto labsClus = mClustersMCLCont->getLabels(iClus); // ideally I can have more than one label per cluster
710 for (auto labC : labsClus) {
711 if (labC == labT) {
712 label_vecClus[iROF][layerClus][labT].push_back(iClus); // same cluster: label from the track = label from the cluster
713 // if a duplicate cluster is found, propagate the track to the duplicate cluster and compute the distance from the original cluster
714 // if (clusOriginalPointGlob != clusDuplicatedPointGlob) { /// check that the duplicated cluster is not the original one just counted twice
715 // if (clusDuplicated.getSensorID() != clusOriginal.getSensorID()) { /// check that the duplicated cluster is not the original one just counted twice
716
717 // applying constraints: the cluster should be on the same layer, should be on an adjacent stave and on the same or adjacent chip position
718 if (clusDuplicated.getSensorID() == clusOriginal.getSensorID()) {
719 continue;
720 }
721 auto layerDuplicated = mGeometry->getLayer(clusDuplicated.getSensorID());
722 if (layerDuplicated != layerClus) {
723 continue;
724 }
725 auto staveDuplicated = mGeometry->getStave(clusDuplicated.getSensorID());
726 if (abs(staveDuplicated - staveOriginal) != 1) {
727 continue;
728 }
729 auto chipDuplicated = mGeometry->getChipIdInStave(clusDuplicated.getSensorID());
730 if (abs(chipDuplicated - chipOriginal) > 1) {
731 continue;
732 }
733
734 duplicated++;
735
736 if (countDuplicated == 0) {
737 UShort_t rowDuplicated = clusDuplicated.getRow();
738 UShort_t colDuplicated = clusDuplicated.getCol();
739
740 chipRowDuplicated[layerDuplicated]->Fill(rowDuplicated);
741 chipRowOriginalIfDuplicated[layerDuplicated]->Fill(rowOriginal);
742
743 mDuplicated_layer[layerDuplicated]++; // This has to be incremented at the first call
744 mPtDuplicated[layerClus]->Fill(pt);
745 mEtaDuplicated[layerClus]->Fill(eta);
746 mPhiDuplicated[layerClus]->Fill(phiduplicated);
747 mZvsPhiDUplicated[layerClus]->Fill(clusDuplicatedPointGlob.Z(), phiduplicated);
748 mPhiOriginalIfDuplicated[layerClus]->Fill(phioriginal);
749 }
750
751 if (countDuplicated == 1) {
752 for (int ipt = 0; ipt < 3; ipt++) {
753 if (pt >= mrangesPt[ipt][0] && pt < mrangesPt[ipt][1]) {
754 mDuplicatedEta[layerDuplicated][ipt]->Fill(eta);
755 mDuplicatedPhi[layerDuplicated][ipt]->Fill(phiduplicated);
756 }
757 }
758 UShort_t rowDuplicated = clusDuplicated.getRow();
759 mDuplicatedRow[layerDuplicated]->Fill(rowOriginal);
760 mDuplicatedCol[layerDuplicated]->Fill(clusOriginal.getCol());
761 mDuplicatedZ[layerDuplicated]->Fill(clusOriginalPointGlob.Z());
762 mDuplicatedPt[layerDuplicated]->Fill(pt);
763 mDuplicatedPtEta[layerDuplicated]->Fill(pt, eta);
764 mDuplicatedPtPhi[layerDuplicated]->Fill(pt, phiduplicated);
765 mDuplicatedEtaPhi[layerDuplicated]->Fill(eta, phiduplicated);
766
767 mDuplicatedEtaAllPt[layerDuplicated]->Fill(eta);
768 mDuplicatedPhiAllPt[layerDuplicated]->Fill(phiduplicated);
769 mPt_EtaDupl[layerClus]->Fill(pt, eta);
770 }
771
772 m3DClusterPositions->Fill(clusDuplicatedPointGlob.x(), clusDuplicatedPointGlob.y(), clusDuplicatedPointGlob.z());
773 m2DClusterDuplicatedPositions->Fill(clusDuplicatedPointGlob.x(), clusDuplicatedPointGlob.y());
774
776
778 trackParCov.rotate(mGeometry->getSensorRefAlpha(clusOriginal.getSensorID()));
779 trackParCov.rotate(mGeometry->getSensorRefAlpha(clusOriginal.getSensorID()));
780 if (propagator->propagateToDCA(clusOriginalPointGlob, trackParCov, b, 2.f, matCorr, &clusOriginalDCA)) {
781 mDCAxyOriginal[layerClus]->Fill(clusOriginalDCA[0]);
782 mDCAzOriginal[layerClus]->Fill(clusOriginalDCA[1]);
783 }
785 trackParCov.rotate(mGeometry->getSensorRefAlpha(clusDuplicated.getSensorID()));
786 if (propagator->propagateToDCA(clusDuplicatedPointGlob, trackParCov, b, 2.f, matCorr, &clusDuplicatedDCA)) {
787 mDCAxyDuplicated->Fill(clusDuplicatedDCA[0]);
788 mDCAzDuplicated->Fill(clusDuplicatedDCA[1]);
789 mDCAxyDuplicated_layer[layerDuplicated]->Fill(clusDuplicatedDCA[0]);
790 mDCAzDuplicated_layer[layerDuplicated]->Fill(clusDuplicatedDCA[1]);
791 }
793 }
794 }
795 }
796 }
797 }
798 } // end loop on clusters
799 totClus += NLAYERS; // summing only the number of clusters in the considered layers. Since the imposition of 7-clusters tracks, if the track is valid should release as clusters as the number of considered layers
800 } // end loop on tracks per ROF
801 } // end loop on ROFRecords array
802 LOGP(info, "Total number of clusters: {} ", totClus);
803 LOGP(info, "total nLabels: {}", nLabels);
804 LOGP(info, "Number of duplicated clusters: {}", duplicated);
805
806 if (mVerboseOutput && mUseMC) {
807 // printing the duplicates
808 for (unsigned int iROF = 0; iROF < mClustersROFRecords.size(); iROF++) {
809 LOGP(info, "°°°°°°°°°°°°°°°°°°°°°°°° ROF {} °°°°°°°°°°°°°°°°°°°°°°°°", iROF);
810 for (unsigned int lay = 0; lay < NLAYERS; lay++) {
811 LOGP(info, "°°°°°°°°°°°°°°°°°°°°°°°° LAYER {} °°°°°°°°°°°°°°°°°°°°°°°°", lay);
812 for (auto& it : label_vecClus[iROF][lay]) {
813 if (it.second.size() <= 1) {
814 continue; // printing only duplicates
815 }
816 std::cout << " \n++++++++++++ Label: ";
817 auto label = it.first;
818 it.first.print();
819 for (auto iClus : it.second) {
820 auto name = mGeometry->getSymbolicName(mClusters[iClus].getSensorID());
821 auto chipid = mClusters[iClus].getChipID();
822 auto clus = mClusters[iClus];
823 auto clusPoint = mITSClustersArray[iClus];
824
825 o2::math_utils::Point3D<float> clusPointTrack = {clusPoint.getX(), clusPoint.getY(), clusPoint.getZ()};
826 o2::math_utils::Point3D<float> clusPointGlob = mGeometry->getMatrixT2G(clus.getSensorID()) * clusPointTrack;
827 std::cout << "ROF: " << iROF << ", iClus: " << iClus << " -> chip: " << chipid << " = " << name << std::endl;
828 LOGP(info, "LOCtrack: {} {} {}", clusPointTrack.x(), clusPointTrack.y(), clusPointTrack.z());
829 LOGP(info, "LOCglob {} {} {}", clusPointGlob.x(), clusPointGlob.y(), clusPointGlob.z());
830 }
831 }
832 }
833 }
834 }
835 return duplicated;
836}
837
839{
840 // count the effective number of duplicated cluster good matches after applying the pt eta and phi cuts on the track
841 // to check the applied cuts
842 LOGP(info, "--------------- countDuplicatedAfterCuts");
843
844 o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
845 std::array<float, 2> clusOriginalDCA, clusDuplicatedDCA;
846 auto propagator = o2::base::Propagator::Instance();
847
848 unsigned int rofIndexTrack = 0;
849 unsigned int rofNEntriesTrack = 0;
850 unsigned int rofIndexClus = 0;
851 unsigned int rofNEntriesClus = 0;
852 int nLabels = 0;
853 unsigned int totClus = 0;
854
855 int duplicated[3] = {0};
856 int possibleduplicated[3] = {0};
857
858 std::cout << "Track candidates: " << std::endl;
859
860 std::unordered_map<o2::MCCompLabel, std::vector<int>> label_vecClus[mClustersROFRecords.size()][NLAYERS]; // array of maps nRofs x Nlayers -> {label, vec(iClus)} where vec(iClus) are the clusters that share the same label
861
862 for (unsigned int iROF = 0; iROF < mTracksROFRecords.size(); iROF++) { // loop on ROFRecords array
863 std::cout << "ROF number: " << iROF << std::endl;
864 rofIndexTrack = mTracksROFRecords[iROF].getFirstEntry();
865 rofNEntriesTrack = mTracksROFRecords[iROF].getNEntries();
866
867 rofIndexClus = mClustersROFRecords[iROF].getFirstEntry();
868 rofNEntriesClus = mClustersROFRecords[iROF].getNEntries();
869
870 for (unsigned int iTrack = rofIndexTrack; iTrack < rofIndexTrack + rofNEntriesTrack; iTrack++) { // loop on tracks per ROF
871
872 auto track = mTracks[iTrack];
873 o2::track::TrackParCov trackParCov = mTracks[iTrack];
874 int firstClus = track.getFirstClusterEntry(); // get the first cluster of the track
875 int ncl = track.getNumberOfClusters(); // get the number of clusters of the track
876
877 if (ncl < 7) {
878 continue;
879 }
880
881 auto& tracklab = mTracksMCLabels[iTrack];
882 if (tracklab.isFake()) {
883 continue;
884 }
885
886 auto eta = trackParCov.getEta();
887
888 // applying the cuts on the track - only eta
889
890 if (eta < mEtaCuts[0] || eta >= mEtaCuts[1]) {
891 continue;
892 }
893
894 float phi = -999.;
895 float phiOriginal = -999.;
896
897 for (int iclTrack = firstClus; iclTrack < firstClus + ncl; iclTrack++) { // loop on clusters associated to the track
898 auto& clusOriginal = mClusters[mInputITSidxs[iclTrack]];
899 auto clusOriginalPoint = mITSClustersArray[mInputITSidxs[iclTrack]]; // cluster spacepoint in the tracking system
900 auto layerOriginal = mGeometry->getLayer(clusOriginal.getSensorID());
901 auto staveOriginal = mGeometry->getStave(clusOriginal.getSensorID());
902 auto chipOriginal = mGeometry->getChipIdInStave(clusOriginal.getSensorID());
903
904 auto layer = mGeometry->getLayer(clusOriginal.getSensorID());
905 if (layer >= NLAYERS) {
906 continue; // checking only selected layers
907 }
908 auto labsTrack = mClustersMCLCont->getLabels(mInputITSidxs[iclTrack]); // get labels of the cluster associated to the track
909
910 o2::math_utils::Point3D<float> clusOriginalPointTrack = {clusOriginalPoint.getX(), clusOriginalPoint.getY(), clusOriginalPoint.getZ()};
911 o2::math_utils::Point3D<float> clusOriginalPointGlob = mGeometry->getMatrixT2G(clusOriginal.getSensorID()) * clusOriginalPointTrack;
912 phiOriginal = clusOriginalPointGlob.phi(); // * 180 / M_PI;
913
914 if (std::abs(clusOriginalPointGlob.y()) < 0.5) {
915 continue;
916 }
917
918 if (std::abs(clusOriginalPointGlob.z()) >= 10) {
919 continue;
920 }
921
922 if (clusOriginal.getRow() < 2 || (clusOriginal.getRow() > 15 && clusOriginal.getRow() < 496) || clusOriginal.getRow() > 509) {
923 continue;
924 }
925
926 if (clusOriginal.getCol() < 160 || clusOriginal.getCol() > 870) {
927 continue;
928 }
929
930 for (auto& labT : labsTrack) { // for each valid label iterate over ALL the clusters in the ROF to see if there are duplicates
931 if (labT != tracklab) {
932 continue;
933 }
934
935 if (labT.isValid()) {
936 for (unsigned int iClus = rofIndexClus; iClus < rofIndexClus + rofNEntriesClus; iClus++) { // iteration over ALL the clusters in the ROF
937
938 auto clusDuplicated = mClusters[iClus];
939 auto clusDuplicatedPoint = mITSClustersArray[iClus];
940
941 auto layerClus = mGeometry->getLayer(clusDuplicated.getSensorID());
942 if (layerClus != layer) {
943 continue;
944 }
945
946 o2::math_utils::Point3D<float> clusDuplicatedPointTrack = {clusDuplicatedPoint.getX(), clusDuplicatedPoint.getY(), clusDuplicatedPoint.getZ()};
947 o2::math_utils::Point3D<float> clusDuplicatedPointGlob = mGeometry->getMatrixT2G(clusDuplicated.getSensorID()) * clusDuplicatedPointTrack;
948 phi = clusDuplicatedPointGlob.phi(); // * 180 / M_PI;
949
950 auto labsClus = mClustersMCLCont->getLabels(iClus); // ideally I can have more than one label per cluster
951 for (auto labC : labsClus) {
952 if (labC == labT) {
953 label_vecClus[iROF][layerClus][labT].push_back(iClus); // same cluster: label from the track = label from the cluster
954 // if a duplicate cluster is found, propagate the track to the duplicate cluster and compute the distance from the original cluster
955 // if (clusOriginalPointGlob != clusDuplicatedPointGlob) { /// check that the duplicated cluster is not the original one just counted twice
956 // if (clusDuplicated.getSensorID() != clusOriginal.getSensorID()) { /// check that the duplicated cluster is not the original one just counted twice
957
958 // applying constraints: the cluster should be on the same layer, should be on an adjacent stave and on the same or adjacent chip position
959 if (clusDuplicated.getSensorID() == clusOriginal.getSensorID()) {
960 continue;
961 }
962 auto layerDuplicated = mGeometry->getLayer(clusDuplicated.getSensorID());
963 if (layerDuplicated != layerClus) {
964 continue;
965 }
966 auto staveDuplicated = mGeometry->getStave(clusDuplicated.getSensorID());
967 if (abs(staveDuplicated - staveOriginal) != 1) {
968 continue;
969 }
970 auto chipDuplicated = mGeometry->getChipIdInStave(clusDuplicated.getSensorID());
971 if (abs(chipDuplicated - chipOriginal) > 1) {
972 continue;
973 }
974
975 duplicated[layer]++;
976 std::cout << "Taken L" << layer << " # " << duplicated[layer] << " : eta, phi = " << eta << " , " << phiOriginal << " Label: " << std::endl;
977 labC.print();
978 }
979 }
980 }
981 }
982 }
983 } // end loop on clusters
984 totClus += ncl;
985 } // end loop on tracks per ROF
986 } // end loop on ROFRecords array
987
988 LOGP(info, "Total number of possible cluster duplicated in L0: {} ", possibleduplicated[0]);
989 LOGP(info, "Total number of possible cluster duplicated in L1: {} ", possibleduplicated[1]);
990 LOGP(info, "Total number of possible cluster duplicated in L2: {} ", possibleduplicated[2]);
991
992 LOGP(info, "Total number of cluster duplicated in L0: {} ", duplicated[0]);
993 LOGP(info, "Total number of cluster duplicated in L1: {} ", duplicated[1]);
994 LOGP(info, "Total number of cluster duplicated in L2: {} ", duplicated[2]);
995}
996
998{
1000
1001 LOGP(info, "--------------- studyDCAcutsMC");
1002
1003 int duplicated = getDCAClusterTrackMC(0);
1004
1005 double meanDCAxyDuplicated[NLAYERS] = {0};
1006 double meanDCAzDuplicated[NLAYERS] = {0};
1007 double sigmaDCAxyDuplicated[NLAYERS] = {0};
1008 double sigmaDCAzDuplicated[NLAYERS] = {0};
1009
1010 std::ofstream ofs("dcaValues.csv", std::ofstream::out);
1011 ofs << "layer,dcaXY,dcaZ,sigmaDcaXY,sigmaDcaZ" << std::endl;
1012
1013 for (int l = 0; l < NLAYERS; l++) {
1014 meanDCAxyDuplicated[l] = mDCAxyDuplicated_layer[l]->GetMean();
1015 meanDCAzDuplicated[l] = mDCAzDuplicated_layer[l]->GetMean();
1016 sigmaDCAxyDuplicated[l] = mDCAxyDuplicated_layer[l]->GetRMS();
1017 sigmaDCAzDuplicated[l] = mDCAzDuplicated_layer[l]->GetRMS();
1018 ofs << l << "," << meanDCAxyDuplicated[l] << "," << meanDCAzDuplicated[l] << "," << sigmaDCAxyDuplicated[l] << "," << sigmaDCAzDuplicated[l] << std::endl;
1019 }
1020
1021 for (int l = 0; l < NLAYERS; l++) {
1022 LOGP(info, "meanDCAxyDuplicated L{}: {}, meanDCAzDuplicated: {}, sigmaDCAxyDuplicated: {}, sigmaDCAzDuplicated: {}", l, meanDCAxyDuplicated[l], meanDCAzDuplicated[l], sigmaDCAxyDuplicated[l], sigmaDCAzDuplicated[l]);
1023 }
1024 // now we have the DCA distribution:
1025 // ->iterate again over tracks and over duplicated clusters and find the matching ones basing on DCA cuts (1 sigma, 2 sigma,...)
1026 // then control if the matching ones according to the DCA matches have the same label
1027 // if yes, then we have a good match -> increase the good match counter
1028 // if not, keep it as a fake match -> increase the fake match counter
1029 // the efficiency of each one will be match counter / total of the duplicated clusters
1030 o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
1031 std::array<float, 2> clusOriginalDCA, clusDuplicatedDCA;
1032 auto propagator = o2::base::Propagator::Instance();
1033
1034 unsigned int rofIndexTrack = 0;
1035 unsigned int rofNEntriesTrack = 0;
1036 unsigned int rofIndexClus = 0;
1037 unsigned int rofNEntriesClus = 0;
1038 int nLabels = 0;
1039 unsigned int totClus = 0;
1040
1041 unsigned int nDCAMatches[20] = {0};
1042 unsigned int nGoodMatches[20] = {0};
1043 unsigned int nFakeMatches[20] = {0};
1044
1045 unsigned int nGoodMatches_layer[NLAYERS][20] = {0};
1046 unsigned int nFakeMatches_layer[NLAYERS][20] = {0};
1047
1048 int nbPt = 75;
1049 double xbins[nbPt + 1], ptcutl = 0.05, ptcuth = 7.5;
1050 double a = std::log(ptcuth / ptcutl) / nbPt;
1051 for (int i = 0; i <= nbPt; i++) {
1052 xbins[i] = ptcutl * std::exp(i * a);
1053 }
1054
1055 for (unsigned int iROF = 0; iROF < mTracksROFRecords.size(); iROF++) { // loop on ROFRecords array
1056 rofIndexTrack = mTracksROFRecords[iROF].getFirstEntry();
1057 rofNEntriesTrack = mTracksROFRecords[iROF].getNEntries();
1058
1059 rofIndexClus = mClustersROFRecords[iROF].getFirstEntry();
1060 rofNEntriesClus = mClustersROFRecords[iROF].getNEntries();
1061
1062 for (unsigned int iTrack = rofIndexTrack; iTrack < rofIndexTrack + rofNEntriesTrack; iTrack++) { // loop on tracks per ROF
1063 auto track = mTracks[iTrack];
1064 o2::track::TrackParCov trackParCov = mTracks[iTrack];
1065 auto pt = trackParCov.getPt();
1066 auto eta = trackParCov.getEta();
1067
1068 float ip[2];
1069 track.getImpactParams(0, 0, 0, 0, ip);
1070
1071 float phi = -999.;
1072 float phiOriginal = -999.;
1073 int firstClus = track.getFirstClusterEntry(); // get the first cluster of the track
1074 int ncl = track.getNumberOfClusters(); // get the number of clusters of the track
1075
1076 if (ncl < 7) {
1077 continue;
1078 }
1079
1080 auto& tracklab = mTracksMCLabels[iTrack];
1081 if (tracklab.isFake()) {
1082 continue;
1083 }
1084
1085 if (mVerboseOutput) {
1086 LOGP(info, "--------- track Label: ");
1087 tracklab.print();
1088 }
1089
1090 for (int iclTrack = firstClus; iclTrack < firstClus + ncl; iclTrack++) { // loop on clusters associated to the track to extract layer, stave and chip to restrict the possible matches to be searched with the DCA cut
1091 auto& clusOriginal = mClusters[mInputITSidxs[iclTrack]];
1092 auto clusOriginalPoint = mITSClustersArray[mInputITSidxs[iclTrack]]; // cluster spacepoint in the tracking system
1093 auto layerOriginal = mGeometry->getLayer(clusOriginal.getSensorID());
1094 if (layerOriginal >= NLAYERS) {
1095 continue;
1096 }
1097 auto labsOriginal = mClustersMCLCont->getLabels(mInputITSidxs[iclTrack]); // get labels of the cluster associated to the track (original)
1098 auto staveOriginal = mGeometry->getStave(clusOriginal.getSensorID());
1099 auto chipOriginal = mGeometry->getChipIdInStave(clusOriginal.getSensorID());
1100
1101 o2::math_utils::Point3D<float> clusOriginalPointTrack = {clusOriginalPoint.getX(), clusOriginalPoint.getY(), clusOriginalPoint.getZ()};
1102 o2::math_utils::Point3D<float> clusOriginalPointGlob = mGeometry->getMatrixT2G(clusOriginal.getSensorID()) * clusOriginalPointTrack;
1103
1104 phiOriginal = clusOriginalPointGlob.phi(); // * 180 / M_PI;
1105
1106 for (auto& labT : labsOriginal) { // for each valid label iterate over ALL the clusters in the ROF to see if there are duplicates
1107 if (labT != tracklab) {
1108 continue;
1109 }
1110 if (!labT.isValid()) {
1111 continue;
1112 }
1113
1115 for (unsigned int iClus = rofIndexClus; iClus < rofIndexClus + rofNEntriesClus; iClus++) { // iteration over ALL the clusters in the ROF
1116 auto clusDuplicated = mClusters[iClus];
1118 if (clusDuplicated.getSensorID() == clusOriginal.getSensorID()) {
1119 continue;
1120 }
1121 auto layerDuplicated = mGeometry->getLayer(clusDuplicated.getSensorID());
1122 if (layerDuplicated != layerOriginal) {
1123 continue;
1124 }
1125 auto staveDuplicated = mGeometry->getStave(clusDuplicated.getSensorID());
1126 if (abs(staveDuplicated - staveOriginal) != 1) {
1127 continue;
1128 }
1129 auto chipDuplicated = mGeometry->getChipIdInStave(clusDuplicated.getSensorID());
1130 if (abs(chipDuplicated - chipOriginal) > 1) {
1131 continue;
1132 }
1133
1134 auto labsDuplicated = mClustersMCLCont->getLabels(iClus);
1135
1137 auto clusDuplicatedPoint = mITSClustersArray[iClus];
1138
1139 o2::math_utils::Point3D<float> clusDuplicatedPointTrack = {clusDuplicatedPoint.getX(), clusDuplicatedPoint.getY(), clusDuplicatedPoint.getZ()};
1140 o2::math_utils::Point3D<float> clusDuplicatedPointGlob = mGeometry->getMatrixT2G(clusDuplicated.getSensorID()) * clusDuplicatedPointTrack;
1141 phi = clusDuplicatedPointGlob.phi(); // * 180 / M_PI;
1142
1144 trackParCov.rotate(mGeometry->getSensorRefAlpha(clusDuplicated.getSensorID()));
1145 if (propagator->propagateToDCA(clusDuplicatedPointGlob, trackParCov, b, 2.f, matCorr, &clusDuplicatedDCA)) { // check if the propagation fails
1146 if (mVerboseOutput) {
1147 LOGP(info, "Propagation ok");
1148 }
1150 for (int i = 0; i < 20; i++) {
1151 if (std::abs(dcaXY[layerDuplicated] - clusDuplicatedDCA[0]) < (i + 1) * sigmaDcaXY[layerDuplicated] && std::abs(dcaZ[layerDuplicated] - clusDuplicatedDCA[1]) < (i + 1) * sigmaDcaZ[layerDuplicated]) { // check if the DCA is within the cut i*sigma
1152
1153 if (mVerboseOutput) {
1154 LOGP(info, "Check DCA ok: {} < {}; {} < {}", std::abs(meanDCAxyDuplicated[layerDuplicated] - clusDuplicatedDCA[0]), (i + 1) * sigmaDCAxyDuplicated[layerDuplicated], std::abs(meanDCAzDuplicated[layerDuplicated] - clusDuplicatedDCA[1]), (i + 1) * sigmaDCAzDuplicated[layerDuplicated]);
1155 }
1156 nDCAMatches[i]++;
1157 bool isGoodMatch = false;
1158
1159 for (auto labD : labsDuplicated) { // at this point the track has been matched with a duplicated cluster based on the DCA cut. Now we check if the matching is good ore not based on the label
1160 if (mVerboseOutput) {
1161 LOGP(info, "tracklab, labD:");
1162 tracklab.print();
1163 labD.print();
1164 }
1165 if (labD == tracklab) {
1166 isGoodMatch = true;
1167 continue;
1168 }
1169 }
1170
1171 if (isGoodMatch) {
1172 nGoodMatches[i]++;
1173 nGoodMatches_layer[layerDuplicated][i]++;
1174 mnGoodMatchesPt_layer[layerDuplicated]->Fill(pt, i);
1175 mnGoodMatchesEta_layer[layerDuplicated]->Fill(eta, i);
1176 mnGoodMatchesPhi_layer[layerDuplicated]->Fill(phi, i);
1177 mnGoodMatchesPhiOriginal_layer[layerDuplicated]->Fill(phiOriginal, i);
1178 } else {
1179
1180 nFakeMatches[i]++;
1181 nFakeMatches_layer[layerDuplicated][i]++;
1182 mnFakeMatchesPt_layer[layerDuplicated]->Fill(pt, i);
1183 mnFakeMatchesEta_layer[layerDuplicated]->Fill(eta, i);
1184 mnFakeMatchesPhi_layer[layerDuplicated]->Fill(phi, i);
1185 }
1186 } else if (mVerboseOutput) {
1187 LOGP(info, "Check DCA failed");
1188 }
1189 }
1190 } else if (mVerboseOutput) {
1191 LOGP(info, "Propagation failed");
1192 }
1193 } // end loop on all the clusters in the rof
1194 }
1195 } // end loop on clusters associated to the track
1196 } // end loop on tracks per ROF
1197 } // end loop on ROFRecords array
1198
1199 for (int i = 0; i < 20; i++) {
1200 LOGP(info, "Cut: {} sigma -> number of duplicated clusters: {} nDCAMatches: {} nGoodMatches: {} nFakeMatches: {}", i + 1, duplicated, nDCAMatches[i], nGoodMatches[i], nFakeMatches[i]);
1201 mEfficiencyGoodMatch->SetBinContent(i + 1, nGoodMatches[i]);
1202 mEfficiencyFakeMatch->SetBinContent(i + 1, nFakeMatches[i]);
1203 mEfficiencyTotal->SetBinContent(i + 1, double(nGoodMatches[i] + nFakeMatches[i]));
1204
1205 for (int l = 0; l < NLAYERS; l++) {
1206 mEfficiencyGoodMatch_layer[l]->SetBinContent(i + 1, nGoodMatches_layer[l][i]);
1207 mEfficiencyFakeMatch_layer[l]->SetBinContent(i + 1, nFakeMatches_layer[l][i]);
1208 mEfficiencyTotal_layer[l]->SetBinContent(i + 1, double(nGoodMatches_layer[l][i] + nFakeMatches_layer[l][i]));
1209
1210 for (int ipt = 0; ipt < mPtDuplicated[l]->GetNbinsX(); ipt++) {
1211 if (mPtDuplicated[l]->GetBinContent(ipt + 1) != 0) {
1212 mEfficiencyGoodMatchPt_layer[l]->SetBinContent(ipt + 1, i + 1, mnGoodMatchesPt_layer[l]->GetBinContent(ipt + 1, i + 1) / mPtDuplicated[l]->GetBinContent(ipt + 1));
1213 }
1214 mEfficiencyFakeMatchPt_layer[l]->SetBinContent(ipt + 1, i + 1, mnFakeMatchesPt_layer[l]->GetBinContent(ipt + 1, i + 1) / mPtDuplicated[l]->GetBinContent(ipt + 1));
1215 }
1216
1217 for (int ieta = 0; ieta < mEtaDuplicated[l]->GetNbinsX(); ieta++) {
1218 if (mEtaDuplicated[l]->GetBinContent(ieta + 1) != 0) {
1219 mEfficiencyGoodMatchEta_layer[l]->SetBinContent(ieta + 1, i + 1, mnGoodMatchesEta_layer[l]->GetBinContent(ieta + 1, i + 1) / mEtaDuplicated[l]->GetBinContent(ieta + 1));
1220 }
1221 mEfficiencyFakeMatchEta_layer[l]->SetBinContent(ieta + 1, i + 1, mnFakeMatchesEta_layer[l]->GetBinContent(ieta + 1, i + 1) / mEtaDuplicated[l]->GetBinContent(ieta + 1));
1222 }
1223
1224 for (int iphi = 0; iphi < mPhiDuplicated[l]->GetNbinsX(); iphi++) {
1225 if (mPhiDuplicated[l]->GetBinContent(iphi + 1) != 0) {
1226 mEfficiencyGoodMatchPhi_layer[l]->SetBinContent(iphi + 1, i + 1, mnGoodMatchesPhi_layer[l]->GetBinContent(iphi + 1, i + 1) / mPhiDuplicated[l]->GetBinContent(iphi + 1));
1227 }
1228 mEfficiencyFakeMatchPhi_layer[l]->SetBinContent(iphi + 1, i + 1, mnFakeMatchesPhi_layer[l]->GetBinContent(iphi + 1, i + 1) / mPhiDuplicated[l]->GetBinContent(iphi + 1));
1229 }
1230
1231 for (int iphi = 0; iphi < mPhiOriginalIfDuplicated[l]->GetNbinsX(); iphi++) {
1232 if (mPhiOriginalIfDuplicated[l]->GetBinContent(iphi + 1) != 0) {
1233 mEfficiencyGoodMatchPhiOriginal_layer[l]->SetBinContent(iphi + 1, i + 1, mnGoodMatchesPhiOriginal_layer[l]->GetBinContent(iphi + 1, i + 1) / mPhiOriginalIfDuplicated[l]->GetBinContent(iphi + 1));
1234 }
1235 }
1236 }
1237 }
1238 for (int i = 0; i < NLAYERS; i++) {
1239 std::cout << "+++++++++ Duplicated in layer L" << i << ": " << mDuplicated_layer[i] << std::endl;
1240 }
1241
1242 for (int l = 0; l < NLAYERS; l++) {
1243 mEfficiencyGoodMatch_layer[l]->Scale(1. / double(mDuplicated_layer[l]), "b");
1244 mEfficiencyFakeMatch_layer[l]->Scale(1. / double(mDuplicated_layer[l]), "b");
1245 mEfficiencyTotal_layer[l]->Scale(1. / double(mDuplicated_layer[l]), "b");
1246 }
1247
1248 mEfficiencyGoodMatch->Scale(1. / double(duplicated), "b");
1249 mEfficiencyFakeMatch->Scale(1. / double(duplicated), "b");
1250 mEfficiencyTotal->Scale(1. / double(duplicated), "b");
1251
1252 mOutFile->mkdir("EffVsDCA2D/");
1253 mOutFile->cd("EffVsDCA2D/");
1254 for (int l = 0; l < NLAYERS; l++) {
1255 mEfficiencyGoodMatchPt_layer[l]->GetZaxis()->SetRangeUser(0, 1);
1256 mEfficiencyGoodMatchPt_layer[l]->Write();
1257 mEfficiencyGoodMatchEta_layer[l]->GetZaxis()->SetRangeUser(0, 1);
1258 mEfficiencyGoodMatchEta_layer[l]->Write();
1259 mEfficiencyGoodMatchPhi_layer[l]->GetZaxis()->SetRangeUser(0, 1);
1260 mEfficiencyGoodMatchPhi_layer[l]->Write();
1261 mEfficiencyGoodMatchPhiOriginal_layer[l]->GetZaxis()->SetRangeUser(0, 1);
1262 mEfficiencyGoodMatchPhiOriginal_layer[l]->Write();
1263 mEfficiencyFakeMatchPt_layer[l]->GetZaxis()->SetRangeUser(0, 1);
1264 mEfficiencyFakeMatchPt_layer[l]->Write();
1265 mEfficiencyFakeMatchEta_layer[l]->GetZaxis()->SetRangeUser(0, 1);
1266 mEfficiencyFakeMatchEta_layer[l]->Write();
1267 mEfficiencyFakeMatchPhi_layer[l]->GetZaxis()->SetRangeUser(0, 1);
1268 mEfficiencyFakeMatchPhi_layer[l]->Write();
1269 }
1270
1271 mOutFile->mkdir("Efficiency/");
1272 mOutFile->cd("Efficiency/");
1273 mEfficiencyGoodMatch->Write();
1274 mEfficiencyFakeMatch->Write();
1275 mEfficiencyTotal->Write();
1276 for (int l = 0; l < NLAYERS; l++) {
1277
1278 mEfficiencyGoodMatch_layer[l]->Write();
1279 mEfficiencyFakeMatch_layer[l]->Write();
1280 mEfficiencyTotal_layer[l]->Write();
1281
1282 mEfficiencyGoodMatch_layer[l]->GetYaxis()->SetRangeUser(-0.1, 1.1);
1283 mEfficiencyFakeMatch_layer[l]->GetYaxis()->SetRangeUser(-0.1, 1.1);
1284 mEfficiencyTotal_layer[l]->GetYaxis()->SetRangeUser(-0.1, 1.1);
1285 }
1286
1287 mEfficiencyGoodMatch->GetYaxis()->SetRangeUser(-0.1, 1.1);
1288 mEfficiencyFakeMatch->GetYaxis()->SetRangeUser(-0.1, 1.1);
1289 mEfficiencyTotal->GetYaxis()->SetRangeUser(-0.1, 1.1);
1290
1291 TCanvas c;
1292 c.SetName("EffVsDCA_allLayers");
1293 auto leg = std::make_unique<TLegend>(0.75, 0.45, 0.89, 0.65);
1294 leg->AddEntry(mEfficiencyGoodMatch.get(), "#frac{# good matches}{# tot duplicated clusters}", "p");
1295 leg->AddEntry(mEfficiencyFakeMatch.get(), "#frac{# fake matches}{# tot duplicated clusters}", "p");
1296 leg->AddEntry(mEfficiencyTotal.get(), "#frac{# tot matches}{# tot duplicated clusters}", "p");
1297
1298 mEfficiencyGoodMatch->Draw("P l E1_NOSTAT PLC PMC ");
1299 mEfficiencyFakeMatch->Draw("same P l E1_NOSTAT PLC PMC");
1300 mEfficiencyTotal->Draw("same P l E1_NOSTAT PLC PMC");
1301 leg->Draw("same");
1302 c.Write();
1303
1304 TCanvas cc[NLAYERS];
1305 for (int l = 0; l < NLAYERS; l++) {
1306 cc[l].cd();
1307 cc[l].SetName(Form("EffVsDCA_layer_L%d", l));
1308
1309 auto leg = std::make_unique<TLegend>(0.75, 0.45, 0.89, 0.65);
1310 leg->AddEntry(mEfficiencyGoodMatch_layer[l].get(), "#frac{# good matches}{# tot duplicated clusters}", "p");
1311 leg->AddEntry(mEfficiencyFakeMatch_layer[l].get(), "#frac{# fake matches}{# tot duplicated clusters}", "p");
1312 leg->AddEntry(mEfficiencyTotal_layer[l].get(), "#frac{# tot matches}{# tot duplicated clusters}", "p");
1313
1314 mEfficiencyGoodMatch_layer[l]->SetLineColor(kBlue + 3);
1315 mEfficiencyGoodMatch_layer[l]->SetMarkerColor(kBlue + 3);
1316 mEfficiencyGoodMatch_layer[l]->Draw("P l E1_NOSTAT");
1317 mEfficiencyFakeMatch_layer[l]->SetLineColor(kAzure + 7);
1318 mEfficiencyFakeMatch_layer[l]->SetMarkerColor(kAzure + 7);
1319 mEfficiencyFakeMatch_layer[l]->Draw("same P l E1_NOSTAT");
1320 mEfficiencyTotal_layer[l]->SetLineColor(kGreen + 1);
1321 mEfficiencyTotal_layer[l]->SetMarkerColor(kGreen + 1);
1322 mEfficiencyTotal_layer[l]->Draw("same P l E1_NOSTAT");
1323 leg->Draw("same");
1324 cc[l].Write();
1325 }
1326}
1327
1329{
1331 // study to find a good selection method for the duplicated cluster, to be used for non-MC data
1332 // iterate over tracks an associated clusters, and find the closer cluster that is not the original one applying cuts on staveID and chipID
1333 // fix the DCA < 10 sigma, then compute the efficiency for each bin of pt, eta and phi and also in the rows
1334
1335 LOGP(info, "--------------- studyClusterSelection");
1336
1337 int duplicated = getDCAClusterTrackMC(1);
1338
1339 std::cout << "duplicated: " << duplicated << std::endl;
1340
1341 double meanDCAxyDuplicated[NLAYERS] = {0};
1342 double meanDCAzDuplicated[NLAYERS] = {0};
1343 double sigmaDCAxyDuplicated[NLAYERS] = {0};
1344 double sigmaDCAzDuplicated[NLAYERS] = {0};
1345
1346 for (int l = 0; l < NLAYERS; l++) {
1347 meanDCAxyDuplicated[l] = mDCAxyDuplicated_layer[l]->GetMean();
1348 meanDCAzDuplicated[l] = mDCAzDuplicated_layer[l]->GetMean();
1349 sigmaDCAxyDuplicated[l] = mDCAxyDuplicated_layer[l]->GetRMS();
1350 sigmaDCAzDuplicated[l] = mDCAzDuplicated_layer[l]->GetRMS();
1351 }
1352
1353 for (int l = 0; l < NLAYERS; l++) {
1354 LOGP(info, "meanDCAxyDuplicated L{}: {}, meanDCAzDuplicated: {}, sigmaDCAxyDuplicated: {}, sigmaDCAzDuplicated: {}", l, meanDCAxyDuplicated[l], meanDCAzDuplicated[l], sigmaDCAxyDuplicated[l], sigmaDCAzDuplicated[l]);
1355 }
1356
1357 o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
1358 std::array<float, 2> clusOriginalDCA, clusDuplicatedDCA;
1359 auto propagator = o2::base::Propagator::Instance();
1360
1361 unsigned int rofIndexTrack = 0;
1362 unsigned int rofNEntriesTrack = 0;
1363 unsigned int rofIndexClus = 0;
1364 unsigned int rofNEntriesClus = 0;
1365 int nLabels = 0;
1366 unsigned int totClus = 0;
1367
1368 unsigned int nDCAMatches[15] = {0};
1369 unsigned int nGoodMatches[15] = {0};
1370 unsigned int nFakeMatches[15] = {0};
1371
1372 std::map<std::tuple<int, double, o2::MCCompLabel>, bool> clusterMatchesPtEta[100][100] = {};
1373
1374 for (unsigned int iROF = 0; iROF < mTracksROFRecords.size(); iROF++) { // loop on ROFRecords array
1375 rofIndexTrack = mTracksROFRecords[iROF].getFirstEntry();
1376 rofNEntriesTrack = mTracksROFRecords[iROF].getNEntries();
1377
1378 rofIndexClus = mClustersROFRecords[iROF].getFirstEntry();
1379 rofNEntriesClus = mClustersROFRecords[iROF].getNEntries();
1380
1382 for (unsigned int iTrack = rofIndexTrack; iTrack < rofIndexTrack + rofNEntriesTrack; iTrack++) { // loop on tracks per ROF
1383 auto track = mTracks[iTrack];
1384 o2::track::TrackParCov trackParCov = mTracks[iTrack];
1385
1387 float ip[2];
1388 track.getImpactParams(0, 0, 0, 0, ip);
1389
1390 int firstClus = track.getFirstClusterEntry(); // get the first cluster of the track
1391 int ncl = track.getNumberOfClusters(); // get the number of clusters of the track
1392
1393 if (ncl < 7) {
1394 continue;
1395 }
1396
1397 auto& tracklab = mTracksMCLabels[iTrack];
1398 if (tracklab.isFake()) {
1399 continue;
1400 }
1401
1402 auto pt = trackParCov.getPt();
1403 auto eta = trackParCov.getEta();
1404
1405 float phi = -999.;
1406 float phiOriginal = -999.;
1407 float phiDuplicated = -999.;
1408 UShort_t row = -999;
1409
1410 if (mVerboseOutput) {
1411 LOGP(info, "--------- track Label: ");
1412 tracklab.print();
1413 }
1414 for (int iclTrack = firstClus; iclTrack < firstClus + ncl; iclTrack++) { // loop on clusters associated to the track to extract layer, stave and chip to restrict the possible matches to be searched with the DCA cut
1415 auto& clusOriginal = mClusters[mInputITSidxs[iclTrack]];
1416 auto layerOriginal = mGeometry->getLayer(clusOriginal.getSensorID());
1417 if (layerOriginal >= NLAYERS) {
1418 continue;
1419 }
1420
1421 IPOriginalxy[layerOriginal]->Fill(ip[0]);
1422 IPOriginalz[layerOriginal]->Fill(ip[1]);
1423
1424 UShort_t rowOriginal = clusOriginal.getRow();
1425
1426 auto clusOriginalPoint = mITSClustersArray[mInputITSidxs[iclTrack]];
1427 o2::math_utils::Point3D<float> clusOriginalPointTrack = {clusOriginalPoint.getX(), clusOriginalPoint.getY(), clusOriginalPoint.getZ()};
1428 o2::math_utils::Point3D<float> clusOriginalPointGlob = mGeometry->getMatrixT2G(clusOriginal.getSensorID()) * clusOriginalPointTrack;
1429
1430 auto phiOriginal = clusOriginalPointGlob.phi(); // * 180 / M_PI;
1431
1432 auto labsOriginal = mClustersMCLCont->getLabels(mInputITSidxs[iclTrack]); // get labels of the cluster associated to the track (original)
1433 auto staveOriginal = mGeometry->getStave(clusOriginal.getSensorID());
1434 auto chipOriginal = mGeometry->getChipIdInStave(clusOriginal.getSensorID());
1435
1436 std::tuple<int, double, gsl::span<const o2::MCCompLabel>> clusID_rDCA_label = {0, 999., gsl::span<const o2::MCCompLabel>()}; // inizializing tuple with dummy values
1437
1438 bool adjacentFound = 0;
1440 for (unsigned int iClus = rofIndexClus; iClus < rofIndexClus + rofNEntriesClus; iClus++) { // iteration over ALL the clusters in the ROF
1441 auto clusDuplicated = mClusters[iClus];
1442
1444 if (clusDuplicated.getSensorID() == clusOriginal.getSensorID()) {
1445 continue;
1446 }
1447 auto layerDuplicated = mGeometry->getLayer(clusDuplicated.getSensorID());
1448 if (layerDuplicated != layerOriginal) {
1449 continue;
1450 }
1451 auto staveDuplicated = mGeometry->getStave(clusDuplicated.getSensorID());
1452 if (abs(staveDuplicated - staveOriginal) != 1) {
1453 continue;
1454 }
1455 auto chipDuplicated = mGeometry->getChipIdInStave(clusDuplicated.getSensorID());
1456 if (abs(chipDuplicated - chipOriginal) > 1) {
1457 continue;
1458 }
1459
1460 auto labsDuplicated = mClustersMCLCont->getLabels(iClus);
1461
1463 auto clusDuplicatedPoint = mITSClustersArray[iClus];
1464
1465 o2::math_utils::Point3D<float> clusDuplicatedPointTrack = {clusDuplicatedPoint.getX(), clusDuplicatedPoint.getY(), clusDuplicatedPoint.getZ()};
1466 o2::math_utils::Point3D<float> clusDuplicatedPointGlob = mGeometry->getMatrixT2G(clusDuplicated.getSensorID()) * clusDuplicatedPointTrack;
1467
1468 auto phiDuplicated = clusDuplicatedPointGlob.phi(); // * 180 / M_PI;
1469
1471 trackParCov.rotate(mGeometry->getSensorRefAlpha(clusDuplicated.getSensorID()));
1472 if (!propagator->propagateToDCA(clusDuplicatedPointGlob, trackParCov, b, 2.f, matCorr, &clusDuplicatedDCA)) { // check if the propagation fails
1473 continue;
1474 }
1475
1476 // Imposing that the distance between the original cluster and the duplicated one is less than x sigma
1477 if (!(clusDuplicatedDCA[0] > mDCACutsXY[layerDuplicated][0] && clusDuplicatedDCA[0] < mDCACutsXY[layerDuplicated][1] && clusDuplicatedDCA[1] > mDCACutsZ[layerDuplicated][0] && clusDuplicatedDCA[1] < mDCACutsZ[layerDuplicated][1])) {
1478 continue;
1479 }
1480
1481 if (mVerboseOutput) {
1482 LOGP(info, "Propagation ok");
1483 }
1484 double rDCA = std::hypot(clusDuplicatedDCA[0], clusDuplicatedDCA[1]);
1485
1486 // taking the closest cluster within x sigma
1487 if (rDCA < std::get<1>(clusID_rDCA_label)) { // updating the closest cluster
1488 clusID_rDCA_label = {iClus, rDCA, labsDuplicated};
1489 phi = phiDuplicated;
1490 row = rowOriginal;
1491 }
1492 adjacentFound = 1;
1493
1494 } // end loop on all the clusters in the rof
1495
1496 // here clusID_rDCA_label is updated with the closest cluster to the track other than the original one
1497 // checking if it is a good or fake match looking at the labels
1498
1499 if (!adjacentFound) {
1500 continue;
1501 }
1502
1503 bool isGood = false;
1504 for (auto lab : std::get<2>(clusID_rDCA_label)) {
1505 if (lab == tracklab) {
1506 isGood = true;
1507
1508 mNGoodMatchesPt[layerOriginal]->Fill(pt);
1509 mNGoodMatchesRow[layerOriginal]->Fill(row);
1510 mNGoodMatchesCol[layerOriginal]->Fill(clusOriginal.getCol());
1511 mNGoodMatchesZ[layerOriginal]->Fill(clusOriginalPointGlob.Z());
1512 mNGoodMatchesPtEta[layerOriginal]->Fill(pt, eta);
1513 mNGoodMatchesPtPhi[layerOriginal]->Fill(pt, phi);
1514 mNGoodMatchesEtaPhi[layerOriginal]->Fill(eta, phi);
1515
1516 mNGoodMatchesEtaAllPt[layerOriginal]->Fill(eta);
1517 mNGoodMatchesPhiAllPt[layerOriginal]->Fill(phi);
1518 for (int ipt = 0; ipt < 3; ipt++) {
1519 if (pt >= mrangesPt[ipt][0] && pt < mrangesPt[ipt][1]) {
1520 mNGoodMatchesEta[layerOriginal][ipt]->Fill(eta);
1521 mNGoodMatchesPhi[layerOriginal][ipt]->Fill(phi);
1522 }
1523 }
1524
1525 break;
1526 }
1527 }
1528 if (!isGood) {
1529
1530 mNFakeMatchesPt[layerOriginal]->Fill(pt);
1531 mNFakeMatchesRow[layerOriginal]->Fill(row);
1532 mNFakeMatchesCol[layerOriginal]->Fill(clusOriginal.getCol());
1533 mNFakeMatchesZ[layerOriginal]->Fill(clusOriginalPointGlob.Z());
1534 mNFakeMatchesPtEta[layerOriginal]->Fill(pt, eta);
1535 mNFakeMatchesPtPhi[layerOriginal]->Fill(pt, phi);
1536 mNFakeMatchesEtaPhi[layerOriginal]->Fill(eta, phi);
1537 mNFakeMatchesEtaAllPt[layerOriginal]->Fill(eta);
1538 mNFakeMatchesPhiAllPt[layerOriginal]->Fill(phi);
1539
1540 for (int ipt = 0; ipt < 3; ipt++) {
1541 if (pt >= mrangesPt[ipt][0] && pt < mrangesPt[ipt][1]) {
1542 mNFakeMatchesEta[layerOriginal][ipt]->Fill(eta);
1543 mNFakeMatchesPhi[layerOriginal][ipt]->Fill(phi);
1544 }
1545 }
1546 }
1547 } // end loop on clusters associated to the track
1548 } // end loop on tracks per ROF
1549 } // end loop on ROFRecords array
1550
1551 mOutFile->mkdir("EfficiencyCuts/");
1552 mOutFile->cd("EfficiencyCuts/");
1553
1554 std::cout << "Calculating efficiency..." << std::endl;
1555 std::unique_ptr<TH1D> axpt = std::make_unique<TH1D>("axpt", "", 1, 0.05, 7.5);
1556 std::unique_ptr<TH1D> axRow = std::make_unique<TH1D>("axRow", "", 1, -0.5, 511.5);
1557 std::unique_ptr<TH1D> axCol = std::make_unique<TH1D>("axRow", "", 1, -0.5, 1023.5);
1558 std::unique_ptr<TH1D> axZ = std::make_unique<TH1D>("axZ", "", 1, -15, 15);
1559 std::unique_ptr<TH2D> axptetaGood = std::make_unique<TH2D>("axptetaGood", "", 1, 0.05, 7.5, 1, -2, 2);
1560 std::unique_ptr<TH2D> axptetaFake = std::make_unique<TH2D>("axptetaFake", "", 1, 0.05, 7.5, 1, -2, 2);
1561 std::unique_ptr<TH2D> axptphiGood = std::make_unique<TH2D>("axptphiGood", "", 1, 0.05, 7.5, 1, -3.2, 3.2);
1562 std::unique_ptr<TH2D> axptphiFake = std::make_unique<TH2D>("axptphiFake", "", 1, 0.05, 7.5, 1, -3.2, 3.2);
1563 std::unique_ptr<TH2D> axetaphiGood = std::make_unique<TH2D>("axetaphiGood", "", 1, -2, 2, 1, -3.2, 3.2);
1564 std::unique_ptr<TH2D> axetaphiFake = std::make_unique<TH2D>("axetaphiFake", "", 1, -2, 2, 1, -3.2, 3.2);
1565 std::unique_ptr<TH1D> axetaAllPt = std::make_unique<TH1D>("axetaAllPt", "", 1, -2, 2);
1566 std::unique_ptr<TH1D> axeta[NLAYERS];
1567 std::unique_ptr<TH1D> axphi[NLAYERS];
1568 for (int ipt = 0; ipt < 3; ipt++) {
1569 axeta[ipt] = std::make_unique<TH1D>(Form("axeta%d", ipt), Form("axeta%d", ipt), 1, -2, 2);
1570 axphi[ipt] = std::make_unique<TH1D>(Form("axphi%d", ipt), Form("axphi%d", ipt), 1, -3.2, 3.2);
1571 }
1572 std::unique_ptr<TH1D> axphiAllPt = std::make_unique<TH1D>("axphi", "", 1, -3.2, 3.2);
1573
1574 std::unique_ptr<TCanvas> effPt[NLAYERS];
1575 std::unique_ptr<TCanvas> effRow[NLAYERS];
1576 std::unique_ptr<TCanvas> effCol[NLAYERS];
1577 std::unique_ptr<TCanvas> effZ[NLAYERS];
1578 std::unique_ptr<TCanvas> effPtEta[NLAYERS][2];
1579 std::unique_ptr<TCanvas> effPtPhi[NLAYERS][2];
1580 std::unique_ptr<TCanvas> effEtaPhi[NLAYERS][2];
1581 std::unique_ptr<TCanvas> effEtaAllPt[NLAYERS];
1582 std::unique_ptr<TCanvas> effEta[NLAYERS][3];
1583 std::unique_ptr<TCanvas> effPhiAllPt[NLAYERS];
1584 std::unique_ptr<TCanvas> effPhi[NLAYERS][3];
1585
1587 for (int l = 0; l < 3; l++) {
1588 if (mVerboseOutput) {
1589 std::cout << "Pt L" << l << "\n\n";
1590 }
1591
1592 // Pt
1593 effPt[l] = std::make_unique<TCanvas>(Form("effPt_L%d", l));
1594
1595 mEffPtGood[l] = std::make_unique<TEfficiency>(*mNGoodMatchesPt[l], *mDuplicatedPt[l]);
1596 stileEfficiencyGraph(mEffPtGood[l], Form("mEffPtGood_L%d", l), Form("L%d;#it{p}_{T} (GeV/#it{c});Efficiency", l), false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
1597
1598 for (int ibin = 1; ibin <= mNFakeMatchesPt[l]->GetNbinsX(); ibin++) {
1599 if (mNFakeMatchesPt[l]->GetBinContent(ibin) > mDuplicatedPt[l]->GetBinContent(ibin)) {
1600 std::cout << "--- Pt: Npass = " << mNFakeMatchesPt[l]->GetBinContent(ibin) << ", Nall = " << mDuplicatedPt[l]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1601 mNFakeMatchesPt[l]->SetBinContent(ibin, mDuplicatedPt[l]->GetBinContent(ibin));
1602 }
1603 }
1604 mEffPtFake[l] = std::make_unique<TEfficiency>(*mNFakeMatchesPt[l], *mDuplicatedPt[l]);
1605 stileEfficiencyGraph(mEffPtFake[l], Form("mEffPtFake_L%d", l), Form("L%d;#it{p}_{T} (GeV/#it{c});Efficiency", l), false, kFullDiamond, 1, kRed + 1, kRed + 1);
1606
1607 axpt->SetTitle(Form("L%d;#it{p}_{T} (GeV/#it{c});Efficiency", l));
1608 axpt->GetYaxis()->SetRangeUser(-0.1, 1.1);
1609 axpt->GetXaxis()->SetRangeUser(0.05, 7.5);
1610 axpt->Draw();
1611 mEffPtGood[l]->Draw("same p");
1612 mEffPtFake[l]->Draw("same p");
1613
1614 auto legpt = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
1615 legpt->AddEntry(mEffPtGood[l].get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
1616 legpt->AddEntry(mEffPtFake[l].get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
1617 legpt->Draw("same");
1618 effPt[l]->Write();
1619
1620 // PtEtaGood
1621 effPtEta[l][0] = std::make_unique<TCanvas>(Form("effPtEtaGood_L%d", l));
1622
1623 mEffPtEtaGood[l] = std::make_unique<TEfficiency>(*mNGoodMatchesPtEta[l], *mDuplicatedPtEta[l]);
1624 stileEfficiencyGraph(mEffPtEtaGood[l], Form("mEffPtEtaGood_L%d", l), Form("L%d;#it{p}_{T} (GeV/#it{c});#eta;Efficiency", l), true);
1625
1626 axptetaGood->SetTitle(Form("L%d;#it{p}_{T} (GeV/#it{c});#eta;Efficiency", l));
1627 axptetaGood->GetZaxis()->SetRangeUser(-0.1, 1.1);
1628 axptetaGood->GetYaxis()->SetRangeUser(-2., 2.);
1629 axptetaGood->GetXaxis()->SetRangeUser(0.05, 7.5);
1630 axptetaGood->Draw();
1631 mEffPtEtaGood[l]->Draw("same colz");
1632 effPtEta[l][0]->Update();
1633 effPtEta[l][0]->Write();
1634
1635 if (mVerboseOutput) {
1636 std::cout << "Underflow (bin 0,0): " << mNFakeMatchesPtEta[l]->GetBinContent(0, 0) << " " << mDuplicatedPtEta[l]->GetBinContent(0, 0) << std::endl;
1637 std::cout << "Overflow (bin nbinsx,nbinsy): " << mNFakeMatchesPtEta[l]->GetNbinsX() << " " << mNFakeMatchesPtEta[l]->GetNbinsY() << " -> " << mNFakeMatchesPtEta[l]->GetBinContent(mNFakeMatchesPtEta[l]->GetNbinsX(), mNFakeMatchesPtEta[l]->GetNbinsY()) << " " << mDuplicatedPtEta[l]->GetBinContent(mNFakeMatchesPtEta[l]->GetNbinsX(), mNFakeMatchesPtEta[l]->GetNbinsY()) << std::endl;
1638 }
1639
1640 for (int ibin = 1; ibin <= mNFakeMatchesPtEta[l]->GetNbinsX(); ibin++) {
1641 for (int jbin = 1; jbin <= mNFakeMatchesPtEta[l]->GetNbinsY(); jbin++) {
1642 if (mNFakeMatchesPtEta[l]->GetBinContent(ibin, jbin) > mDuplicatedPtEta[l]->GetBinContent(ibin, jbin)) {
1643 if (mVerboseOutput) {
1644 std::cout << "--- PtEta fakematches : Npass = " << mNFakeMatchesPtEta[l]->GetBinContent(ibin, jbin) << ", Nall = " << mDuplicatedPtEta[l]->GetBinContent(ibin, jbin) << " for ibin = " << ibin << ", jbin = " << jbin << std::endl;
1645 }
1646 mNFakeMatchesPtEta[l]->SetBinContent(ibin, jbin, mDuplicatedPtEta[l]->GetBinContent(ibin, jbin));
1647 }
1648 }
1649 }
1650
1651 // Row
1652 effRow[l] = std::make_unique<TCanvas>(Form("effRow_L%d", l));
1653
1654 for (int ibin = 1; ibin <= mNGoodMatchesRow[l]->GetNbinsX(); ibin++) {
1655 std::cout << "--- Good Row: Npass = " << mNGoodMatchesRow[l]->GetBinContent(ibin) << ", Nall = " << mDuplicatedRow[l]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1656 }
1657
1658 mEffRowGood[l] = std::make_unique<TEfficiency>(*mNGoodMatchesRow[l], *mDuplicatedRow[l]);
1659 stileEfficiencyGraph(mEffRowGood[l], Form("mEffRowGood_L%d", l), Form("L%d;Row;Efficiency", l), false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
1660
1661 for (int ibin = 1; ibin <= mNFakeMatchesRow[l]->GetNbinsX(); ibin++) {
1662 if (mNFakeMatchesRow[l]->GetBinContent(ibin) > mDuplicatedRow[l]->GetBinContent(ibin)) {
1663 std::cout << "--- Row: Npass = " << mNFakeMatchesRow[l]->GetBinContent(ibin) << ", Nall = " << mDuplicatedRow[l]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1664 mNFakeMatchesRow[l]->SetBinContent(ibin, mDuplicatedRow[l]->GetBinContent(ibin));
1665 }
1666 }
1667 mEffRowFake[l] = std::make_unique<TEfficiency>(*mNFakeMatchesRow[l], *mDuplicatedRow[l]);
1668 stileEfficiencyGraph(mEffRowFake[l], Form("mEffRowFake_L%d", l), Form("L%d;Row;Efficiency", l), false, kFullDiamond, 1, kRed + 1, kRed + 1);
1669
1670 axRow->SetTitle(Form("L%d;Row;Efficiency", l));
1671 axRow->GetYaxis()->SetRangeUser(-0.1, 1.1);
1672 axRow->GetXaxis()->SetRangeUser(0, 512);
1673 axRow->Draw();
1674 mEffRowGood[l]->Draw("same p");
1675 mEffRowFake[l]->Draw("same p");
1676
1677 auto legRow = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
1678 legRow->AddEntry(mEffRowGood[l].get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
1679 legRow->AddEntry(mEffRowFake[l].get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
1680 legRow->Draw("same");
1681 effRow[l]->Write();
1682
1683 // Col
1684 effCol[l] = std::make_unique<TCanvas>(Form("effCol_L%d", l));
1685
1686 for (int ibin = 1; ibin <= mNGoodMatchesCol[l]->GetNbinsX(); ibin++) {
1687 std::cout << "--- Good Col: Npass = " << mNGoodMatchesCol[l]->GetBinContent(ibin) << ", Nall = " << mDuplicatedCol[l]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1688 }
1689
1690 mEffColGood[l] = std::make_unique<TEfficiency>(*mNGoodMatchesCol[l], *mDuplicatedCol[l]);
1691 stileEfficiencyGraph(mEffColGood[l], Form("mEffColGood_L%d", l), Form("L%d;Col;Efficiency", l), false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
1692
1693 for (int ibin = 1; ibin <= mNFakeMatchesCol[l]->GetNbinsX(); ibin++) {
1694 if (mNFakeMatchesCol[l]->GetBinContent(ibin) > mDuplicatedCol[l]->GetBinContent(ibin)) {
1695 std::cout << "--- Col: Npass = " << mNFakeMatchesCol[l]->GetBinContent(ibin) << ", Nall = " << mDuplicatedCol[l]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1696 mNFakeMatchesCol[l]->SetBinContent(ibin, mDuplicatedCol[l]->GetBinContent(ibin));
1697 }
1698 }
1699 mEffColFake[l] = std::make_unique<TEfficiency>(*mNFakeMatchesCol[l], *mDuplicatedCol[l]);
1700 stileEfficiencyGraph(mEffColFake[l], Form("mEffColFake_L%d", l), Form("L%d;Col;Efficiency", l), false, kFullDiamond, 1, kRed + 1, kRed + 1);
1701
1702 axCol->SetTitle(Form("L%d;Col;Efficiency", l));
1703 axCol->GetYaxis()->SetRangeUser(-0.1, 1.1);
1704 axCol->GetXaxis()->SetRangeUser(0, 1024);
1705 axCol->Draw();
1706 mEffColGood[l]->Draw("same p");
1707 mEffColFake[l]->Draw("same p");
1708
1709 auto legCol = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
1710 legCol->AddEntry(mEffColGood[l].get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
1711 legCol->AddEntry(mEffColFake[l].get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
1712 legCol->Draw("same");
1713 effCol[l]->Write();
1714
1715 // Z
1716 effZ[l] = std::make_unique<TCanvas>(Form("effZ_L%d", l));
1717
1718 for (int ibin = 1; ibin <= mNGoodMatchesZ[l]->GetNbinsX(); ibin++) {
1719 std::cout << "--- Good Z: Npass = " << mNGoodMatchesZ[l]->GetBinContent(ibin) << ", Nall = " << mDuplicatedZ[l]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1720 }
1721
1722 mEffZGood[l] = std::make_unique<TEfficiency>(*mNGoodMatchesZ[l], *mDuplicatedZ[l]);
1723 stileEfficiencyGraph(mEffZGood[l], Form("mEffZGood_L%d", l), Form("L%d;Z;Efficiency", l), false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
1724
1725 for (int ibin = 1; ibin <= mNFakeMatchesZ[l]->GetNbinsX(); ibin++) {
1726 if (mNFakeMatchesZ[l]->GetBinContent(ibin) > mDuplicatedZ[l]->GetBinContent(ibin)) {
1727 std::cout << "--- Z: Npass = " << mNFakeMatchesZ[l]->GetBinContent(ibin) << ", Nall = " << mDuplicatedZ[l]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1728 mNFakeMatchesZ[l]->SetBinContent(ibin, mDuplicatedZ[l]->GetBinContent(ibin));
1729 }
1730 }
1731 mEffZFake[l] = std::make_unique<TEfficiency>(*mNFakeMatchesZ[l], *mDuplicatedZ[l]);
1732 stileEfficiencyGraph(mEffZFake[l], Form("mEffZFake_L%d", l), Form("L%d;Z;Efficiency", l), false, kFullDiamond, 1, kRed + 1, kRed + 1);
1733
1734 axZ->SetTitle(Form("L%d;Z;Efficiency", l));
1735 axZ->GetYaxis()->SetRangeUser(-0.1, 1.1);
1736 axZ->GetXaxis()->SetRangeUser(0, 512);
1737 axZ->Draw();
1738 mEffZGood[l]->Draw("same p");
1739 mEffZFake[l]->Draw("same p");
1740
1741 auto legZ = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
1742 legZ->AddEntry(mEffZGood[l].get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
1743 legZ->AddEntry(mEffZFake[l].get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
1744 legZ->Draw("same");
1745 effZ[l]->Write();
1746
1747 // PtEtaGood
1748 effPtEta[l][0] = std::make_unique<TCanvas>(Form("effPtEtaGood_L%d", l));
1749
1750 mEffPtEtaGood[l] = std::make_unique<TEfficiency>(*mNGoodMatchesPtEta[l], *mDuplicatedPtEta[l]);
1751 stileEfficiencyGraph(mEffPtEtaGood[l], Form("mEffPtEtaGood_L%d", l), Form("L%d;#it{p}_{T} (GeV/#it{c});#eta;Efficiency", l), true);
1752
1753 axptetaGood->SetTitle(Form("L%d;#it{p}_{T} (GeV/#it{c});#eta;Efficiency", l));
1754 axptetaGood->GetZaxis()->SetRangeUser(-0.1, 1.1);
1755 axptetaGood->GetYaxis()->SetRangeUser(-2., 2.);
1756 axptetaGood->GetXaxis()->SetRangeUser(0.05, 7.5);
1757 axptetaGood->Draw();
1758 mEffPtEtaGood[l]->Draw("same colz");
1759 effPtEta[l][0]->Update();
1760 effPtEta[l][0]->Write();
1761
1762 if (mVerboseOutput) {
1763 std::cout << "Underflow (bin 0,0): " << mNFakeMatchesPtEta[l]->GetBinContent(0, 0) << " " << mDuplicatedPtEta[l]->GetBinContent(0, 0) << std::endl;
1764 std::cout << "Overflow (bin nbinsx,nbinsy): " << mNFakeMatchesPtEta[l]->GetNbinsX() << " " << mNFakeMatchesPtEta[l]->GetNbinsY() << " -> " << mNFakeMatchesPtEta[l]->GetBinContent(mNFakeMatchesPtEta[l]->GetNbinsX(), mNFakeMatchesPtEta[l]->GetNbinsY()) << " " << mDuplicatedPtEta[l]->GetBinContent(mNFakeMatchesPtEta[l]->GetNbinsX(), mNFakeMatchesPtEta[l]->GetNbinsY()) << std::endl;
1765 }
1766
1767 for (int ibin = 1; ibin <= mNFakeMatchesPtEta[l]->GetNbinsX(); ibin++) {
1768 for (int jbin = 1; jbin <= mNFakeMatchesPtEta[l]->GetNbinsY(); jbin++) {
1769 if (mNFakeMatchesPtEta[l]->GetBinContent(ibin, jbin) > mDuplicatedPtEta[l]->GetBinContent(ibin, jbin)) {
1770 if (mVerboseOutput) {
1771 std::cout << "--- PtEta fakematches : Npass = " << mNFakeMatchesPtEta[l]->GetBinContent(ibin, jbin) << ", Nall = " << mDuplicatedPtEta[l]->GetBinContent(ibin, jbin) << " for ibin = " << ibin << ", jbin = " << jbin << std::endl;
1772 }
1773 mNFakeMatchesPtEta[l]->SetBinContent(ibin, jbin, mDuplicatedPtEta[l]->GetBinContent(ibin, jbin));
1774 }
1775 }
1776 }
1777
1778 // PtEtaFake
1779 effPtEta[l][1] = std::make_unique<TCanvas>(Form("effPtEtaFake_L%d", l));
1780
1781 mEffPtEtaFake[l] = std::make_unique<TEfficiency>(*mNFakeMatchesPtEta[l], *mDuplicatedPtEta[l]);
1782 stileEfficiencyGraph(mEffPtEtaFake[l], Form("mEffPtEtaFake_L%d", l), Form("L%d;#it{p}_{T} (GeV/#it{c});#eta;Efficiency", l), true);
1783 axptetaFake->SetTitle(Form("L%d;#it{p}_{T} (GeV/#it{c});#eta;Efficiency", l));
1784 axptetaFake->GetZaxis()->SetRangeUser(-0.1, 1.1);
1785 axptetaFake->GetYaxis()->SetRangeUser(-2., 2.);
1786 axptetaFake->GetXaxis()->SetRangeUser(0.05, 7.5);
1787 axptetaFake->Draw();
1788 mEffPtEtaFake[l]->Draw("same colz");
1789 effPtEta[l][1]->Update();
1790 effPtEta[l][1]->Write();
1791
1792 // PtPhiGood
1793 effPtPhi[l][0] = std::make_unique<TCanvas>(Form("effPtPhiGood_L%d", l));
1794
1795 mEffPtPhiGood[l] = std::make_unique<TEfficiency>(*mNGoodMatchesPtPhi[l], *mDuplicatedPtPhi[l]);
1796 stileEfficiencyGraph(mEffPtPhiGood[l], Form("mEffPtPhiGood_L%d", l), Form("L%d;#it{p}_{T} (GeV/#it{c});#phi (rad);Efficiency", l), true);
1797
1798 axptphiGood->SetTitle(Form("L%d;#it{p}_{T} (GeV/#it{c});#phi (rad);Efficiency", l));
1799 axptphiGood->GetZaxis()->SetRangeUser(-0.1, 1.1);
1800 axptphiGood->GetYaxis()->SetRangeUser(-3.2, 3.2);
1801 axptphiGood->GetXaxis()->SetRangeUser(0.05, 7.5);
1802 axptphiGood->Draw();
1803 mEffPtPhiGood[l]->Draw("same colz");
1804 effPtPhi[l][0]->Update();
1805 effPtPhi[l][0]->Write();
1806
1807 for (int ibin = 1; ibin <= mNFakeMatchesPtPhi[l]->GetNbinsX(); ibin++) {
1808 for (int jbin = 1; jbin <= mNFakeMatchesPtPhi[l]->GetNbinsY(); jbin++) {
1809 if (mNFakeMatchesPtPhi[l]->GetBinContent(ibin, jbin) > mDuplicatedPtPhi[l]->GetBinContent(ibin, jbin)) {
1810 if (mVerboseOutput) {
1811 std::cout << "--- Pt: Npass = " << mNFakeMatchesPtPhi[l]->GetBinContent(ibin, jbin) << ", Nall = " << mDuplicatedPtPhi[l]->GetBinContent(ibin, jbin) << " for ibin = " << ibin << ", jbin = " << jbin << std::endl;
1812 }
1813 mNFakeMatchesPtPhi[l]->SetBinContent(ibin, jbin, mDuplicatedPtPhi[l]->GetBinContent(ibin, jbin));
1814 }
1815 }
1816 }
1817
1818 // PtPhiFake
1819 effPtPhi[l][1] = std::make_unique<TCanvas>(Form("effPtPhiFake_L%d", l));
1820
1821 mEffPtPhiFake[l] = std::make_unique<TEfficiency>(*mNFakeMatchesPtPhi[l], *mDuplicatedPtPhi[l]);
1822 stileEfficiencyGraph(mEffPtPhiFake[l], Form("mEffPtPhiFake_L%d", l), Form("L%d;#it{p}_{T} (GeV/#it{c});#phi (rad);Efficiency", l), true);
1823 axptphiFake->SetTitle(Form("L%d;#it{p}_{T} (GeV/#it{c});#phi (rad);Efficiency", l));
1824 axptphiFake->GetZaxis()->SetRangeUser(-0.1, 1.1);
1825 axptphiFake->GetYaxis()->SetRangeUser(-3.2, 3.2);
1826 axptphiFake->GetXaxis()->SetRangeUser(0.05, 7.5);
1827 axptphiFake->Draw();
1828 mEffPtPhiFake[l]->Draw("same colz");
1829 effPtPhi[l][1]->Update();
1830 effPtPhi[l][1]->Write();
1831
1832 // EtaPhiGood
1833 effEtaPhi[l][0] = std::make_unique<TCanvas>(Form("effEtaPhiGood_L%d", l));
1834
1835 mEffEtaPhiGood[l] = std::make_unique<TEfficiency>(*mNGoodMatchesEtaPhi[l], *mDuplicatedEtaPhi[l]);
1836 stileEfficiencyGraph(mEffEtaPhiGood[l], Form("mEffEtaPhiGood_L%d", l), Form("L%d;#eta;#phi (rad);Efficiency", l), true);
1837
1838 axetaphiGood->SetTitle(Form("L%d;#eta;#phi (rad);Efficiency", l));
1839 axetaphiGood->GetZaxis()->SetRangeUser(-0.1, 1.1);
1840 axetaphiGood->GetYaxis()->SetRangeUser(-3.2, 3.2);
1841 axetaphiGood->GetXaxis()->SetRangeUser(-2, 2);
1842 axetaphiGood->Draw();
1843 mEffEtaPhiGood[l]->Draw("same colz");
1844 effEtaPhi[l][0]->Update();
1845 effEtaPhi[l][0]->Write();
1846
1847 for (int ibin = 1; ibin <= mNFakeMatchesEtaPhi[l]->GetNbinsX(); ibin++) {
1848 for (int jbin = 1; jbin <= mNFakeMatchesEtaPhi[l]->GetNbinsY(); jbin++) {
1849 if (mNFakeMatchesEtaPhi[l]->GetBinContent(ibin, jbin) > mDuplicatedEtaPhi[l]->GetBinContent(ibin, jbin)) {
1850 if (mVerboseOutput) {
1851 std::cout << "--- Eta: Npass = " << mNFakeMatchesEtaPhi[l]->GetBinContent(ibin, jbin) << ", Nall = " << mDuplicatedEtaPhi[l]->GetBinContent(ibin, jbin) << " for ibin = " << ibin << ", jbin = " << jbin << std::endl;
1852 }
1853 mNFakeMatchesEtaPhi[l]->SetBinContent(ibin, jbin, mDuplicatedEtaPhi[l]->GetBinContent(ibin, jbin));
1854 }
1855 }
1856 }
1857
1858 // EtaPhiFake
1859 effEtaPhi[l][1] = std::make_unique<TCanvas>(Form("effEtaPhiFake_L%d", l));
1860
1861 mEffEtaPhiFake[l] = std::make_unique<TEfficiency>(*mNFakeMatchesEtaPhi[l], *mDuplicatedEtaPhi[l]);
1862 stileEfficiencyGraph(mEffEtaPhiFake[l], Form("mEffEtaPhiFake_L%d", l), Form("L%d;#eta;#phi (rad);Efficiency", l), true);
1863 axetaphiFake->SetTitle(Form("L%d;#eta;#phi (rad);Efficiency", l));
1864 axetaphiFake->GetZaxis()->SetRangeUser(-0.1, 1.1);
1865 axetaphiFake->GetYaxis()->SetRangeUser(-3.2, 3.2);
1866 axetaphiFake->GetXaxis()->SetRangeUser(-2, 2);
1867 axetaphiFake->Draw();
1868 mEffEtaPhiFake[l]->Draw("same colz");
1869 effEtaPhi[l][1]->Update();
1870 effEtaPhi[l][1]->Write();
1871
1872 // EtaAllPt
1873 if (mVerboseOutput) {
1874 std::cout << "Eta L" << l << "\n\n";
1875 }
1876
1877 effEtaAllPt[l] = std::make_unique<TCanvas>(Form("effEtaAllPt_L%d", l));
1878
1879 mEffEtaGoodAllPt[l] = std::make_unique<TEfficiency>(*mNGoodMatchesEtaAllPt[l], *mDuplicatedEtaAllPt[l]);
1880 stileEfficiencyGraph(mEffEtaGoodAllPt[l], Form("mEffEtaGoodAllPt_L%d", l), Form("L%d;#eta;Efficiency", l), false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
1881
1882 for (int ibin = 1; ibin <= mNFakeMatchesEtaAllPt[l]->GetNbinsX(); ibin++) {
1883 if (mNFakeMatchesEtaAllPt[l]->GetBinContent(ibin) > mDuplicatedEtaAllPt[l]->GetBinContent(ibin)) {
1884 if (mVerboseOutput) {
1885 std::cout << "--- EtaAllPt: Npass = " << mNFakeMatchesEtaAllPt[l]->GetBinContent(ibin) << ", Nall = " << mDuplicatedEtaAllPt[l]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1886 }
1887 mNFakeMatchesEtaAllPt[l]->SetBinContent(ibin, mDuplicatedEtaAllPt[l]->GetBinContent(ibin));
1888 }
1889 }
1890 mEffEtaFakeAllPt[l] = std::make_unique<TEfficiency>(*mNFakeMatchesEtaAllPt[l], *mDuplicatedEtaAllPt[l]);
1891 stileEfficiencyGraph(mEffEtaFakeAllPt[l], Form("mEffEtaFakeAllPt_L%d", l), Form("L%d;#eta;Efficiency", l), false, kFullDiamond, 1, kRed + 1, kRed + 1);
1892
1893 axetaAllPt->SetTitle(Form("L%d;#eta;Efficiency", l));
1894 axetaAllPt->GetYaxis()->SetRangeUser(-0.1, 1.1);
1895
1896 axetaAllPt->Draw();
1897 mEffEtaGoodAllPt[l]->Draw("same p");
1898 mEffEtaFakeAllPt[l]->Draw("same p");
1899
1900 auto legEta = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
1901 legEta->AddEntry(mEffEtaGoodAllPt[l].get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
1902 legEta->AddEntry(mEffEtaFakeAllPt[l].get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
1903 legEta->Draw("same");
1904 effEtaAllPt[l]->Write();
1905
1907 for (int ipt = 0; ipt < 3; ipt++) {
1908 // eta
1909 effEta[l][ipt] = std::make_unique<TCanvas>(Form("effEta_L%d_pt%d", l, ipt));
1910
1911 mEffEtaGood[l][ipt] = std::make_unique<TEfficiency>(*mNGoodMatchesEta[l][ipt], *mDuplicatedEta[l][ipt]);
1912 stileEfficiencyGraph(mEffEtaGood[l][ipt], Form("mEffEtaGood_L%d_pt%d", l, ipt), Form("L%d %.1f #leq #it{p}_{T} < %.1f GeV/#it{c};#eta;Efficiency", l, mrangesPt[ipt][0], mrangesPt[ipt][1]), false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
1913
1914 for (int ibin = 1; ibin <= mNFakeMatchesEta[l][ipt]->GetNbinsX(); ibin++) {
1915 if (mNFakeMatchesEta[l][ipt]->GetBinContent(ibin) > mDuplicatedEta[l][ipt]->GetBinContent(ibin)) {
1916 if (mVerboseOutput) {
1917 std::cout << "--- Eta : Npass = " << mNFakeMatchesEta[l][ipt]->GetBinContent(ibin) << ", Nall = " << mDuplicatedEta[l][ipt]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1918 }
1919 mNFakeMatchesEta[l][ipt]->SetBinContent(ibin, mDuplicatedEta[l][ipt]->GetBinContent(ibin));
1920 }
1921 }
1922
1923 mEffEtaFake[l][ipt] = std::make_unique<TEfficiency>(*mNFakeMatchesEta[l][ipt], *mDuplicatedEta[l][ipt]);
1924 stileEfficiencyGraph(mEffEtaFake[l][ipt], Form("mEffEtaFake_L%d_pt%d", l, ipt), Form("L%d %.1f #leq #it{p}_{T} < %.1f GeV/#it{c};#eta;Efficiency", l, mrangesPt[ipt][0], mrangesPt[ipt][1]), false, kFullDiamond, 1, kRed + 1, kRed + 1);
1925
1926 axeta[ipt]->SetTitle(Form("L%d %.1f #leq #it{p}_{T} < %.1f GeV/#it{c};#eta;Efficiency", l, mrangesPt[ipt][0], mrangesPt[ipt][1]));
1927 axeta[ipt]->GetYaxis()->SetRangeUser(-0.1, 1.1);
1928
1929 axeta[ipt]->Draw();
1930 mEffEtaGood[l][ipt]->Draw("same p");
1931 mEffEtaFake[l][ipt]->Draw("same p");
1932
1933 auto legEta = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
1934 legEta->AddEntry(mEffEtaGood[l][ipt].get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
1935 legEta->AddEntry(mEffEtaFake[l][ipt].get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
1936 legEta->Draw("same");
1937 effEta[l][ipt]->Write();
1938
1939 // phi
1940 effPhi[l][ipt] = std::make_unique<TCanvas>(Form("effPhi_L%d_pt%d", l, ipt));
1941
1942 for (int ibin = 1; ibin <= mNGoodMatchesPhi[l][ipt]->GetNbinsX(); ibin++) {
1943 if (mNGoodMatchesPhi[l][ipt]->GetBinContent(ibin) > mDuplicatedPhi[l][ipt]->GetBinContent(ibin)) {
1944 if (mVerboseOutput) {
1945 std::cout << "--- Phi L: Npass = " << mNGoodMatchesPhi[l][ipt]->GetBinContent(ibin) << ", Nall = " << mDuplicatedPhi[l][ipt]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1946 }
1947 mNGoodMatchesPhi[l][ipt]->SetBinContent(ibin, 0);
1948 }
1949 }
1950
1951 mEffPhiGood[l][ipt] = std::make_unique<TEfficiency>(*mNGoodMatchesPhi[l][ipt], *mDuplicatedPhi[l][ipt]);
1952 stileEfficiencyGraph(mEffPhiGood[l][ipt], Form("mEffPhiGood_L%d_pt%d", l, ipt), Form("L%d %.1f #leq #it{p}_{T} < %.1f GeV/#it{c};#phi (rad);Efficiency", l, mrangesPt[ipt][0], mrangesPt[ipt][1]), false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
1953
1954 for (int ibin = 1; ibin <= mNFakeMatchesPhi[l][ipt]->GetNbinsX(); ibin++) {
1955 if (mNFakeMatchesPhi[l][ipt]->GetBinContent(ibin) > mDuplicatedPhi[l][ipt]->GetBinContent(ibin)) {
1956 if (mVerboseOutput) {
1957 std::cout << "--- Phi L: Npass = " << mNFakeMatchesPhi[l][ipt]->GetBinContent(ibin) << ", Nall = " << mDuplicatedPhi[l][ipt]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1958 }
1959 mNFakeMatchesPhi[l][ipt]->SetBinContent(ibin, mDuplicatedPhi[l][ipt]->GetBinContent(ibin));
1960 }
1961 }
1962
1963 mEffPhiFake[l][ipt] = std::make_unique<TEfficiency>(*mNFakeMatchesPhi[l][ipt], *mDuplicatedPhi[l][ipt]);
1964 stileEfficiencyGraph(mEffPhiFake[l][ipt], Form("mEffPhiFake_L%d_pt%d", l, ipt), Form("L%d %.1f #leq #it{p}_{T} < %.1f GeV/#it{c};#phi (rad);Efficiency", l, mrangesPt[ipt][0], mrangesPt[ipt][1]), false, kFullDiamond, 1, kRed + 1, kRed + 1);
1965
1966 axphi[ipt]->SetTitle(Form("L%d %.1f #leq #it{p}_{T} < %.1f GeV/#it{c};#phi (rad);Efficiency", l, mrangesPt[ipt][0], mrangesPt[ipt][1]));
1967 axphi[ipt]->GetYaxis()->SetRangeUser(-0.1, 1.1);
1968
1969 axphi[ipt]->Draw();
1970 mEffPhiGood[l][ipt]->Draw("same p");
1971 mEffPhiFake[l][ipt]->Draw("same p");
1972
1973 auto legPhi = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
1974 legPhi->AddEntry(mEffPhiGood[l][ipt].get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
1975 legPhi->AddEntry(mEffPhiFake[l][ipt].get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
1976 legPhi->Draw("same");
1977 effPhi[l][ipt]->Write();
1978 }
1979
1980 // PhiAllPt
1981 if (mVerboseOutput) {
1982 std::cout << "Phi L" << l << "\n\n";
1983 }
1984
1985 effPhiAllPt[l] = std::make_unique<TCanvas>(Form("effPhiAllPt_L%d", l));
1986
1987 for (int ibin = 1; ibin <= mNGoodMatchesPhiAllPt[l]->GetNbinsX(); ibin++) {
1988 if (mNGoodMatchesPhiAllPt[l]->GetBinContent(ibin) > mDuplicatedPhiAllPt[l]->GetBinContent(ibin)) {
1989 if (mVerboseOutput) {
1990 std::cout << "--- phi all good Npass = " << mNGoodMatchesPhiAllPt[l]->GetBinContent(ibin) << ", Nall = " << mDuplicatedPhiAllPt[l]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
1991 }
1992 mNGoodMatchesPhiAllPt[l]->SetBinContent(ibin, 0);
1993 }
1994 }
1995
1996 mEffPhiGoodAllPt[l] = std::make_unique<TEfficiency>(*mNGoodMatchesPhiAllPt[l], *mDuplicatedPhiAllPt[l]);
1997 stileEfficiencyGraph(mEffPhiGoodAllPt[l], Form("mEffPhiGoodAllPt_L%d", l), Form("L%d;#phi;Efficiency", l), false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
1998
1999 for (int ibin = 1; ibin <= mNFakeMatchesPhiAllPt[l]->GetNbinsX(); ibin++) {
2000 if (mNFakeMatchesPhiAllPt[l]->GetBinContent(ibin) > mDuplicatedPhiAllPt[l]->GetBinContent(ibin)) {
2001 if (mVerboseOutput) {
2002 std::cout << "--- phi all fake Npass = " << mNFakeMatchesPhiAllPt[l]->GetBinContent(ibin) << ", Nall = " << mDuplicatedPhiAllPt[l]->GetBinContent(ibin) << " for ibin = " << ibin << std::endl;
2003 }
2004 mNFakeMatchesPhiAllPt[l]->SetBinContent(ibin, mDuplicatedPhiAllPt[l]->GetBinContent(ibin));
2005 }
2006 }
2007 mEffPhiFakeAllPt[l] = std::make_unique<TEfficiency>(*mNFakeMatchesPhiAllPt[l], *mDuplicatedPhiAllPt[l]);
2008 stileEfficiencyGraph(mEffPhiFakeAllPt[l], Form("mEffPhiFakeAllPt_L%d", l), Form("L%d;#phi;Efficiency", l), false, kFullDiamond, 1, kRed + 1, kRed + 1);
2009
2010 axphiAllPt->SetTitle(Form("L%d;#phi;Efficiency", l));
2011 axphiAllPt->GetYaxis()->SetRangeUser(-0.1, 1.1);
2012 axphiAllPt->Draw();
2013 mEffPhiGoodAllPt[l]->Draw("same p");
2014 mEffPhiFakeAllPt[l]->Draw("same p");
2015
2016 auto legPhi = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
2017 legPhi->AddEntry(mEffPhiGoodAllPt[l].get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
2018 legPhi->AddEntry(mEffPhiFakeAllPt[l].get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
2019 legPhi->Draw("same");
2020 effPhiAllPt[l]->Write();
2021 }
2022
2024 std::unique_ptr<TCanvas> effRowAll = std::make_unique<TCanvas>("effRowAll");
2025 auto numRowGoodAll = std::unique_ptr<TH1D>((TH1D*)mNGoodMatchesRow[0]->Clone("numRowGoodAll"));
2026 numRowGoodAll->Add(mNGoodMatchesRow[1].get());
2027 numRowGoodAll->Add(mNGoodMatchesRow[2].get());
2028 numRowGoodAll->Write();
2029 auto numRowFakeAll = std::unique_ptr<TH1D>((TH1D*)mNFakeMatchesRow[0]->Clone("numRowFakeAll"));
2030 numRowFakeAll->Add(mNFakeMatchesRow[1].get());
2031 numRowFakeAll->Add(mNFakeMatchesRow[2].get());
2032 numRowFakeAll->Write();
2033 auto denRowAll = std::unique_ptr<TH1D>((TH1D*)mDuplicatedRow[0]->Clone("denRowAll"));
2034 denRowAll->Add(mDuplicatedRow[1].get());
2035 denRowAll->Add(mDuplicatedRow[2].get());
2036 denRowAll->Write();
2037
2038 std::unique_ptr<TEfficiency> mEffRowGoodAll = std::make_unique<TEfficiency>(*numRowGoodAll, *denRowAll);
2039 stileEfficiencyGraph(mEffRowGoodAll, "mEffRowGoodAll", "L0 + L1 + L2;Row;Efficiency", false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
2040 std::unique_ptr<TEfficiency> mEffRowFakeAll = std::make_unique<TEfficiency>(*numRowFakeAll, *denRowAll);
2041 stileEfficiencyGraph(mEffRowFakeAll, "mEffRowFakeAll", "L0 + L1 + L2;Row;Efficiency", false, kFullDiamond, 1, kRed + 1, kRed + 1);
2042 axRow->SetTitle("L0 + L1 + L2;Row;Efficiency");
2043 axRow->GetYaxis()->SetRangeUser(-0.1, 1.1);
2044 axRow->Draw();
2045 mEffRowGoodAll->Draw("same p");
2046 mEffRowFakeAll->Draw("same p");
2047
2048 auto legRow = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
2049 legRow->AddEntry(mEffRowGoodAll.get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
2050 legRow->AddEntry(mEffRowFakeAll.get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
2051 legRow->Draw("same");
2052 effRowAll->Write();
2053
2055 std::unique_ptr<TCanvas> effColAll = std::make_unique<TCanvas>("effColAll");
2056 auto numColGoodAll = std::unique_ptr<TH1D>((TH1D*)mNGoodMatchesCol[0]->Clone("numColGoodAll"));
2057 numColGoodAll->Add(mNGoodMatchesCol[1].get());
2058 numColGoodAll->Add(mNGoodMatchesCol[2].get());
2059 numColGoodAll->Write();
2060 auto numColFakeAll = std::unique_ptr<TH1D>((TH1D*)mNFakeMatchesCol[0]->Clone("numColFakeAll"));
2061 numColFakeAll->Add(mNFakeMatchesCol[1].get());
2062 numColFakeAll->Add(mNFakeMatchesCol[2].get());
2063 numColFakeAll->Write();
2064 auto denColAll = std::unique_ptr<TH1D>((TH1D*)mDuplicatedCol[0]->Clone("denColAll"));
2065 denColAll->Add(mDuplicatedCol[1].get());
2066 denColAll->Add(mDuplicatedCol[2].get());
2067 denColAll->Write();
2068
2069 std::unique_ptr<TEfficiency> mEffColGoodAll = std::make_unique<TEfficiency>(*numColGoodAll, *denColAll);
2070 stileEfficiencyGraph(mEffColGoodAll, "mEffColGoodAll", "L0 + L1 + L2;Column;Efficiency", false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
2071 std::unique_ptr<TEfficiency> mEffColFakeAll = std::make_unique<TEfficiency>(*numColFakeAll, *denColAll);
2072 stileEfficiencyGraph(mEffColFakeAll, "mEffColFakeAll", "L0 + L1 + L2;Column;Efficiency", false, kFullDiamond, 1, kRed + 1, kRed + 1);
2073 axCol->SetTitle("L0 + L1 + L2;Col;Efficiency");
2074 axCol->GetYaxis()->SetRangeUser(-0.1, 1.1);
2075 axCol->Draw();
2076 mEffColGoodAll->Draw("same p");
2077 mEffColFakeAll->Draw("same p");
2078
2079 auto legCol = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
2080 legCol->AddEntry(mEffColGoodAll.get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
2081 legCol->AddEntry(mEffColFakeAll.get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
2082 legCol->Draw("same");
2083 effColAll->Write();
2084
2086 std::unique_ptr<TCanvas> effZAll = std::make_unique<TCanvas>("effZAll");
2087 auto numZGoodAll = std::unique_ptr<TH1D>((TH1D*)mNGoodMatchesZ[0]->Clone("numZGoodAll"));
2088 numZGoodAll->Add(mNGoodMatchesZ[1].get());
2089 numZGoodAll->Add(mNGoodMatchesZ[2].get());
2090 numZGoodAll->Write();
2091 auto numZFakeAll = std::unique_ptr<TH1D>((TH1D*)mNFakeMatchesZ[0]->Clone("numZFakeAll"));
2092 numZFakeAll->Add(mNFakeMatchesZ[1].get());
2093 numZFakeAll->Add(mNFakeMatchesZ[2].get());
2094 numZFakeAll->Write();
2095 auto denZAll = std::unique_ptr<TH1D>((TH1D*)mDuplicatedZ[0]->Clone("denZAll"));
2096 denZAll->Add(mDuplicatedZ[1].get());
2097 denZAll->Add(mDuplicatedZ[2].get());
2098 denZAll->Write();
2099
2100 std::unique_ptr<TEfficiency> mEffZGoodAll = std::make_unique<TEfficiency>(*numZGoodAll, *denZAll);
2101 stileEfficiencyGraph(mEffZGoodAll, "mEffZGoodAll", "L0 + L1 + L2;Z;Efficiency", false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
2102 std::unique_ptr<TEfficiency> mEffZFakeAll = std::make_unique<TEfficiency>(*numZFakeAll, *denZAll);
2103 stileEfficiencyGraph(mEffZFakeAll, "mEffZFakeAll", "L0 + L1 + L2;Z;Efficiency", false, kFullDiamond, 1, kRed + 1, kRed + 1);
2104 axZ->SetTitle("L0 + L1 + L2;Z;Efficiency");
2105 axZ->GetYaxis()->SetRangeUser(-0.1, 1.1);
2106 axZ->Draw();
2107 mEffZGoodAll->Draw("same p");
2108 mEffZFakeAll->Draw("same p");
2109
2110 auto legZ = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
2111 legZ->AddEntry(mEffZGoodAll.get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
2112 legZ->AddEntry(mEffZFakeAll.get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
2113 legZ->Draw("same");
2114 effZAll->Write();
2115
2117 std::unique_ptr<TCanvas> effEtaAll = std::make_unique<TCanvas>("effEtaAll");
2118 auto numEtaGoodAll = std::unique_ptr<TH1D>((TH1D*)mNGoodMatchesEtaAllPt[0]->Clone("numEtaGoodAll"));
2119 numEtaGoodAll->Add(mNGoodMatchesEtaAllPt[1].get());
2120 numEtaGoodAll->Add(mNGoodMatchesEtaAllPt[2].get());
2121 numEtaGoodAll->Write();
2122 auto numEtaFakeAll = std::unique_ptr<TH1D>((TH1D*)mNFakeMatchesEtaAllPt[0]->Clone("numEtaFakeAll"));
2123 numEtaFakeAll->Add(mNFakeMatchesEtaAllPt[1].get());
2124 numEtaFakeAll->Add(mNFakeMatchesEtaAllPt[2].get());
2125 numEtaFakeAll->Write();
2126 auto denEtaAll = std::unique_ptr<TH1D>((TH1D*)mDuplicatedEtaAllPt[0]->Clone("denEtaAll"));
2127 denEtaAll->Add(mDuplicatedEtaAllPt[1].get());
2128 denEtaAll->Add(mDuplicatedEtaAllPt[2].get());
2129 denEtaAll->Write();
2130
2131 std::unique_ptr<TEfficiency> mEffEtaGoodAll = std::make_unique<TEfficiency>(*numEtaGoodAll, *denEtaAll);
2132 stileEfficiencyGraph(mEffEtaGoodAll, "mEffEtaGoodAll", "L0 + L1 + L2;#Eta;Efficiency", false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
2133 std::unique_ptr<TEfficiency> mEffEtaFakeAll = std::make_unique<TEfficiency>(*numEtaFakeAll, *denEtaAll);
2134 stileEfficiencyGraph(mEffEtaFakeAll, "mEffEtaFakeAll", "L0 + L1 + L2;#Eta;Efficiency", false, kFullDiamond, 1, kRed + 1, kRed + 1);
2135 axetaAllPt->SetTitle("L0 + L1 + L2;Eta;Efficiency");
2136 axetaAllPt->GetYaxis()->SetRangeUser(-0.1, 1.1);
2137 axetaAllPt->Draw();
2138 mEffEtaGoodAll->Draw("same p");
2139 mEffEtaFakeAll->Draw("same p");
2140
2141 auto legEta = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
2142 legEta->AddEntry(mEffEtaGoodAll.get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
2143 legEta->AddEntry(mEffEtaFakeAll.get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
2144 legEta->Draw("same");
2145 effEtaAll->Write();
2146
2148 std::unique_ptr<TCanvas> effPhiAll = std::make_unique<TCanvas>("effPhiAll");
2149 auto numPhiGoodAll = std::unique_ptr<TH1D>((TH1D*)mNGoodMatchesPhiAllPt[0]->Clone("numPhiGoodAll"));
2150 numPhiGoodAll->Add(mNGoodMatchesPhiAllPt[1].get());
2151 numPhiGoodAll->Add(mNGoodMatchesPhiAllPt[2].get());
2152 numPhiGoodAll->Write();
2153 auto numPhiFakeAll = std::unique_ptr<TH1D>((TH1D*)mNFakeMatchesPhiAllPt[0]->Clone("numPhiFakeAll"));
2154 numPhiFakeAll->Add(mNFakeMatchesPhiAllPt[1].get());
2155 numPhiFakeAll->Add(mNFakeMatchesPhiAllPt[2].get());
2156 numPhiFakeAll->Write();
2157 auto denPhiAll = std::unique_ptr<TH1D>((TH1D*)mDuplicatedPhiAllPt[0]->Clone("denPhiAll"));
2158 denPhiAll->Add(mDuplicatedPhiAllPt[1].get());
2159 denPhiAll->Add(mDuplicatedPhiAllPt[2].get());
2160 denPhiAll->Write();
2161
2162 std::unique_ptr<TEfficiency> mEffPhiGoodAll = std::make_unique<TEfficiency>(*numPhiGoodAll, *denPhiAll);
2163 stileEfficiencyGraph(mEffPhiGoodAll, "mEffPhiGoodAll", "L0 + L1 + L2;#Phi (rad);Efficiency", false, kFullDiamond, 1, kGreen + 3, kGreen + 3);
2164 std::unique_ptr<TEfficiency> mEffPhiFakeAll = std::make_unique<TEfficiency>(*numPhiFakeAll, *denPhiAll);
2165 stileEfficiencyGraph(mEffPhiFakeAll, "mEffPhiFakeAll", "L0 + L1 + L2;#Phi (rad);Efficiency", false, kFullDiamond, 1, kRed + 1, kRed + 1);
2166 axphiAllPt->SetTitle("L0 + L1 + L2;Phi;Efficiency");
2167 axphiAllPt->GetYaxis()->SetRangeUser(-0.1, 1.1);
2168 axphiAllPt->Draw();
2169 mEffPhiGoodAll->Draw("same p");
2170 mEffPhiFakeAll->Draw("same p");
2171
2172 auto legPhi = std::make_unique<TLegend>(0.70, 0.15, 0.89, 0.35);
2173 legPhi->AddEntry(mEffPhiGoodAll.get(), "#frac{# good matches}{# tot duplicated clusters}", "pl");
2174 legPhi->AddEntry(mEffPhiFakeAll.get(), "#frac{# fake matches}{# tot duplicated clusters}", "pl");
2175 legPhi->Draw("same");
2176 effPhiAll->Write();
2177}
2178
2180{
2181 // Extract the efficiency for the IB, exploiting the staves overlaps and the duplicated clusters for the tracks passing through the overlaps
2182 // The denominator for the efficiency calculation will be the number of tracks per layer fulfilling some cuts (eta, z, row, col)
2183 // The numerator will be the number of duplicated clusters for the tracks passing through the overlaps
2184
2185 LOGP(info, "getEfficiency()");
2186
2187 o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
2188 std::array<float, 2> clusOriginalDCA, clusDuplicatedDCA;
2189 auto propagator = o2::base::Propagator::Instance();
2190
2191 unsigned int rofIndexTrack = 0;
2192 unsigned int rofNEntriesTrack = 0;
2193 unsigned int rofIndexClus = 0;
2194 unsigned int rofNEntriesClus = 0;
2195
2196 int nbPt = 75;
2197 double xbins[nbPt + 1], ptcutl = 0.05, ptcuth = 7.5;
2198 double a = std::log(ptcuth / ptcutl) / nbPt;
2199 for (int i = 0; i <= nbPt; i++) {
2200 xbins[i] = ptcutl * std::exp(i * a);
2201 }
2202
2203 int totNClusters;
2204 int nDuplClusters;
2205
2206 for (unsigned int iROF = 0; iROF < mTracksROFRecords.size(); iROF++) { // loop on ROFRecords array
2207
2208 rofIndexTrack = mTracksROFRecords[iROF].getFirstEntry();
2209 rofNEntriesTrack = mTracksROFRecords[iROF].getNEntries();
2210
2211 rofIndexClus = mClustersROFRecords[iROF].getFirstEntry();
2212 rofNEntriesClus = mClustersROFRecords[iROF].getNEntries();
2213
2215 for (unsigned int iTrack = rofIndexTrack; iTrack < rofIndexTrack + rofNEntriesTrack; iTrack++) { // loop on tracks per ROF
2216 auto track = mTracks[iTrack];
2217 o2::track::TrackParCov trackParCov = mTracks[iTrack];
2218
2219 auto pt = trackParCov.getPt(); // Always 0.6 GeV/c for B = 0 T
2220 auto eta = trackParCov.getEta();
2221 float phi = -999.;
2222 float phiOriginal = -999.;
2223
2224 float chi2 = track.getChi2();
2225
2226 float ip[2];
2227 track.getImpactParams(0, 0, 0, 0, ip);
2228
2229 // float phiTrack = trackParCov.getPhi(); // * 180 / M_PI;
2230
2231 // applying the cuts on the track - only eta
2232 if (eta < mEtaCuts[0] || eta >= mEtaCuts[1]) {
2233 continue;
2234 }
2235
2236 int firstClus = track.getFirstClusterEntry(); // get the first cluster of the track
2237 int ncl = track.getNumberOfClusters(); // get the number of clusters of the track
2238
2240 if (ncl < 7) {
2241 continue;
2242 }
2243
2244 o2::MCCompLabel tracklab;
2245 if (isMC) {
2246 tracklab = mTracksMCLabels[iTrack];
2247 if (tracklab.isFake()) {
2248 continue;
2249 }
2250 }
2251
2252 if (mVerboseOutput && isMC) {
2253 LOGP(info, "track Label: ");
2254 tracklab.print();
2255 }
2256
2257 for (int iclTrack = firstClus; iclTrack < firstClus + ncl; iclTrack++) { // loop on clusters associated to the track to extract layer, stave and chip to restrict the possible matches to be searched with the DCA cut
2258 auto& clusOriginal = mClusters[mInputITSidxs[iclTrack]];
2259 auto clusOriginalPoint = mITSClustersArray[mInputITSidxs[iclTrack]];
2260 auto layerOriginal = mGeometry->getLayer(clusOriginal.getSensorID());
2261
2262 UShort_t rowOriginal = clusOriginal.getRow();
2263 UShort_t colOriginal = clusOriginal.getCol();
2264
2266 if (clusOriginal.getChipID() >= 0 && clusOriginal.getChipID() <= 8) {
2267 l0_00->Fill(clusOriginal.getCol() + (1024 * (clusOriginal.getChipID() % 9)), clusOriginal.getRow());
2268 }
2269 if (clusOriginal.getChipID() >= 252 && clusOriginal.getChipID() <= 260) {
2270 l1_15->Fill(clusOriginal.getCol() + (1024 * (clusOriginal.getChipID() % 9)), clusOriginal.getRow());
2271 }
2272 if (clusOriginal.getChipID() >= 423 && clusOriginal.getChipID() <= 431) {
2273 l2_19->Fill(clusOriginal.getCol() + (1024 * (clusOriginal.getChipID() % 9)), clusOriginal.getRow());
2274 }
2275
2277 if (layerOriginal >= NLAYERS) {
2278 continue;
2279 }
2280
2281 chipmap->Fill(clusOriginal.getCol(), clusOriginal.getRow());
2282
2283 IPOriginalxy[layerOriginal]->Fill(ip[0]);
2284 IPOriginalz[layerOriginal]->Fill(ip[1]);
2285
2287 o2::math_utils::Point3D<float> clusOriginalPointTrack = {clusOriginalPoint.getX(), clusOriginalPoint.getY(), clusOriginalPoint.getZ()};
2288 o2::math_utils::Point3D<float> clusOriginalPointGlob = mGeometry->getMatrixT2G(clusOriginal.getSensorID()) * clusOriginalPointTrack;
2289 phiOriginal = clusOriginalPointGlob.phi(); // * 180 / M_PI;
2290
2291 if (std::abs(clusOriginalPointGlob.y()) < 0.5) {
2292 continue;
2293 }
2294
2295 if (std::abs(clusOriginalPointGlob.z()) >= 10) {
2296 continue;
2297 }
2298
2299 if (rowOriginal < 2 || (rowOriginal > 15 && rowOriginal < 496) || rowOriginal > 509) {
2300 continue;
2301 }
2302
2303 if (mUseMC) {
2304 if (std::find(mExcludedChipMC.begin(), mExcludedChipMC.end(), clusOriginal.getChipID()) != mExcludedChipMC.end()) {
2305 continue;
2306 }
2307 }
2308
2309 if (clusOriginal.getCol() < 160 || clusOriginal.getCol() > 870) {
2310 continue;
2311 }
2312
2314 m2DClusterOriginalPositions->Fill(clusOriginalPointGlob.x(), clusOriginalPointGlob.y());
2315 m3DClusterPositions->Fill(clusOriginalPointGlob.x(), clusOriginalPointGlob.y(), clusOriginalPointGlob.z());
2316 chi2trackAccepted->Fill(chi2);
2317 denPt[layerOriginal]->Fill(pt);
2318 denPhi[layerOriginal]->Fill(phiOriginal);
2319 denEta[layerOriginal]->Fill(eta);
2320 denRow[layerOriginal]->Fill(rowOriginal);
2321 denCol[layerOriginal]->Fill(clusOriginal.getCol());
2322 denZ[layerOriginal]->Fill(clusOriginalPointGlob.z());
2323 nTracksSelected[layerOriginal]++;
2324 mDenColEta[layerOriginal]->Fill(clusOriginal.getCol(), eta);
2325 mDenRowPhi[layerOriginal]->Fill(clusOriginal.getRow(), clusOriginalPointGlob.z());
2326 mDenRowCol[layerOriginal]->Fill(clusOriginal.getRow(), clusOriginal.getCol());
2327 denLayers->Fill(layerOriginal);
2328
2330 gsl::span<const o2::MCCompLabel> labsOriginal = {};
2331 if (isMC) {
2332 labsOriginal = mClustersMCLCont->getLabels(mInputITSidxs[iclTrack]); // get labels of the cluster associated to the track (original)
2333 }
2334
2335 auto staveOriginal = mGeometry->getStave(clusOriginal.getSensorID());
2336 auto chipOriginal = mGeometry->getChipIdInStave(clusOriginal.getSensorID());
2337
2338 std::tuple<int, double, gsl::span<const o2::MCCompLabel>> clusID_rDCA_label = {0, 999., gsl::span<const o2::MCCompLabel>()}; // inizializing tuple with dummy values (if data, ignore the third value)
2339
2340 bool adjacentFound = 0;
2341 float phiDuplicated = -999.;
2342 float ptDuplicated = -999.;
2343 float etaDuplicated = -999.;
2344 float clusZ = -999.;
2345
2346 o2::itsmft::CompClusterExt clusDuplicatedSelected = o2::itsmft::CompClusterExt();
2347
2349 for (unsigned int iClus = rofIndexClus; iClus < rofIndexClus + rofNEntriesClus; iClus++) { // iteration over ALL the clusters in the ROF
2350 auto clusDuplicated = mClusters[iClus];
2351 auto clusDuplicatedPoint = mITSClustersArray[iClus];
2352
2353 o2::math_utils::Point3D<float> clusDuplicatedPointTrack = {clusDuplicatedPoint.getX(), clusDuplicatedPoint.getY(), clusDuplicatedPoint.getZ()};
2354 o2::math_utils::Point3D<float> clusDuplicatedPointGlob = mGeometry->getMatrixT2G(clusDuplicated.getSensorID()) * clusDuplicatedPointTrack;
2355 phi = clusDuplicatedPointGlob.phi(); // * 180 / M_PI;
2356
2358 if (clusDuplicated.getSensorID() == clusOriginal.getSensorID()) {
2359 continue;
2360 }
2361 auto layerDuplicated = mGeometry->getLayer(clusDuplicated.getSensorID());
2362 if (layerDuplicated != layerOriginal) {
2363 continue;
2364 }
2365 auto staveDuplicated = mGeometry->getStave(clusDuplicated.getSensorID());
2366 if (abs(staveDuplicated - staveOriginal) != 1) {
2367 continue;
2368 }
2369 auto chipDuplicated = mGeometry->getChipIdInStave(clusDuplicated.getSensorID());
2370 if (abs(chipDuplicated - chipOriginal) > 1) {
2371 continue;
2372 }
2373
2374 gsl::span<const o2::MCCompLabel> labsDuplicated = {};
2375 if (isMC) {
2376 labsDuplicated = mClustersMCLCont->getLabels(iClus);
2377 }
2378
2381 trackParCov.rotate(mGeometry->getSensorRefAlpha(clusDuplicated.getSensorID()));
2382 if (!propagator->propagateToDCA(clusDuplicatedPointGlob, trackParCov, b, 2.f, matCorr, &clusDuplicatedDCA)) { // check if the propagation fails
2383 continue;
2384 }
2385
2386 DCAxyData[layerDuplicated]->Fill(clusDuplicatedDCA[0]);
2387 DCAzData[layerDuplicated]->Fill(clusDuplicatedDCA[1]);
2388
2389 // Imposing that the distance between the duplicated cluster and the track is less than x sigma
2390 if (!(clusDuplicatedDCA[0] > mDCACutsXY[layerDuplicated][0] && clusDuplicatedDCA[0] < mDCACutsXY[layerDuplicated][1] && clusDuplicatedDCA[1] > mDCACutsZ[layerDuplicated][0] && clusDuplicatedDCA[1] < mDCACutsZ[layerDuplicated][1])) {
2391 DCAxyRejected[layerDuplicated]->Fill(clusDuplicatedDCA[0]);
2392 DCAzRejected[layerDuplicated]->Fill(clusDuplicatedDCA[1]);
2393 continue;
2394 }
2395
2396 m2DClusterDuplicatedPositions->Fill(clusDuplicatedPointGlob.x(), clusDuplicatedPointGlob.y());
2397 m3DDuplicatedClusterPositions->Fill(clusDuplicatedPointGlob.x(), clusDuplicatedPointGlob.y(), clusDuplicatedPointGlob.z());
2398
2399 if (mVerboseOutput) {
2400 LOGP(info, "Propagation ok");
2401 }
2402 double rDCA = std::hypot(clusDuplicatedDCA[0], clusDuplicatedDCA[1]);
2403
2404 // taking the closest cluster within x sigma
2405 if (rDCA < std::get<1>(clusID_rDCA_label)) { // updating the closest cluster
2406 if (isMC) {
2407 clusID_rDCA_label = {iClus, rDCA, labsDuplicated};
2408 } else {
2409 clusID_rDCA_label = {iClus, rDCA, gsl::span<const o2::MCCompLabel>()};
2410 }
2411 phiDuplicated = phiOriginal;
2412 ptDuplicated = pt;
2413 etaDuplicated = eta;
2414 clusZ = clusOriginalPointGlob.z();
2415 clusDuplicatedSelected = clusDuplicated;
2416 }
2417 adjacentFound = 1;
2418 } // end loop on all the clusters in the rof -> at this point we have the information on the closest cluster (if there is one)
2419
2420 // here clusID_rDCA_label is updated with the closest cluster to the track other than the original one
2421
2422 if (!adjacentFound) {
2423 radiusNotFound[layerOriginal]->Fill(sqrt(clusOriginalPointGlob.x() * clusOriginalPointGlob.x() + clusOriginalPointGlob.y() * clusOriginalPointGlob.y()));
2424 colNotFound[layerOriginal]->Fill(clusOriginal.getCol() + (1024 * (clusOriginal.getChipID() % 9)));
2425 rowNotFound[layerOriginal]->Fill(rowOriginal);
2426 zNotFound[layerOriginal]->Fill(clusOriginalPointGlob.z());
2427 phiNotFound[layerOriginal]->Fill(phiOriginal);
2428 continue;
2429 }
2430
2431 chipOrigVsOverlap->Fill(clusOriginal.getChipID() % 9, clusDuplicatedSelected.getChipID() % 9);
2432 mChipFound->Fill(clusOriginal.getChipID());
2433 zFound[layerOriginal]->Fill(clusOriginalPointGlob.z());
2434 radiusFound[layerOriginal]->Fill(sqrt(clusOriginalPointGlob.x() * clusOriginalPointGlob.x() + clusOriginalPointGlob.y() * clusOriginalPointGlob.y()));
2435 colFoundOriginalVsDuplicated[layerOriginal]->Fill(clusOriginal.getCol() + (1024 * (clusOriginal.getChipID() % 9)), clusDuplicatedSelected.getCol() + (1024 * (clusDuplicatedSelected.getChipID() % 9)));
2436 colFoundOriginal[layerOriginal]->Fill(clusOriginal.getCol() + (1024 * (clusOriginal.getChipID() % 9)));
2437 m2DClusterFoundPositions->Fill(clusOriginalPointGlob.x(), clusOriginalPointGlob.y());
2438 phiFound[layerOriginal]->Fill(phiOriginal);
2439 rowFound[layerOriginal]->Fill(rowOriginal);
2440 nDuplClusters++;
2441 nDuplicatedClusters[layerOriginal]++;
2442 numPt[layerOriginal]->Fill(pt);
2443 numPhi[layerOriginal]->Fill(phiDuplicated);
2444 numEta[layerOriginal]->Fill(etaDuplicated);
2445 numRow[layerOriginal]->Fill(rowOriginal);
2446 numCol[layerOriginal]->Fill(clusOriginal.getCol());
2447 numZ[layerOriginal]->Fill(clusOriginalPointGlob.z());
2448 mZvsPhiDUplicated[layerOriginal]->Fill(clusZ, phiDuplicated);
2449 mNumColEta[layerOriginal]->Fill(clusOriginal.getCol(), eta);
2450 mNumRowPhi[layerOriginal]->Fill(clusOriginal.getRow(), clusOriginalPointGlob.z());
2451 mNumRowCol[layerOriginal]->Fill(clusOriginal.getRow(), clusOriginal.getCol());
2452 numLayers->Fill(layerOriginal);
2453
2454 // checking if it is a good or fake match looking at the labels (only if isMC)
2455 if (isMC) {
2456 bool isGood = false;
2457 for (auto lab : std::get<2>(clusID_rDCA_label)) {
2458 if (lab == tracklab) {
2459 isGood = true;
2460 numPtGood[layerOriginal]->Fill(ptDuplicated);
2461 numPhiGood[layerOriginal]->Fill(phiDuplicated);
2462 numEtaGood[layerOriginal]->Fill(etaDuplicated);
2463 numRowGood[layerOriginal]->Fill(rowOriginal);
2464 numColGood[layerOriginal]->Fill(clusOriginal.getCol());
2465 numZGood[layerOriginal]->Fill(clusOriginalPointGlob.z());
2466 numGoodLayers->Fill(layerOriginal);
2467 continue;
2468 }
2469 }
2470 if (!isGood) {
2471 numPtFake[layerOriginal]->Fill(ptDuplicated);
2472 numPhiFake[layerOriginal]->Fill(phiDuplicated);
2473 numEtaFake[layerOriginal]->Fill(etaDuplicated);
2474 numRowFake[layerOriginal]->Fill(rowOriginal);
2475 numColFake[layerOriginal]->Fill(clusOriginal.getCol());
2476 numZFake[layerOriginal]->Fill(clusOriginalPointGlob.z());
2477 numFakeLayers->Fill(layerOriginal);
2478 }
2479 }
2480 } // end loop on clusters associated to the track
2481 totNClusters += NLAYERS;
2482 } // end loop on tracks per ROF
2483 } // end loop on ROFRecords array
2484
2485 std::cout << " Num of duplicated clusters L0: " << nDuplicatedClusters[0] << " N tracks selected: " << nTracksSelected[0] << std::endl;
2486 std::cout << " Num of duplicated clusters L1: " << nDuplicatedClusters[1] << " N tracks selected: " << nTracksSelected[1] << std::endl;
2487 std::cout << " Num of duplicated clusters L2: " << nDuplicatedClusters[2] << " N tracks selected: " << nTracksSelected[2] << std::endl;
2488
2489 std::cout << " --------- N total clusters: " << totNClusters << std::endl;
2490 std::cout << " --------- N duplicated clusters: " << nDuplClusters << std::endl;
2491}
2492
2494{
2495 LOGP(info, "--------------- process");
2496
2498
2499 if (mUseMC) {
2500 // getDCAClusterTrackMC();
2502 // studyClusterSelectionMC();
2503 // countDuplicatedAfterCuts();
2504 getEfficiency(mUseMC);
2505 } else {
2506 getEfficiency(mUseMC);
2507 }
2508
2509 LOGP(info, "** Found in {} rofs:\n\t- {} clusters\n\t",
2510 mClustersROFRecords.size(), mClusters.size());
2511
2512 if (mUseMC) {
2513 LOGP(info, "mClusters size: {}, mClustersROFRecords size: {}, mClustersMCLCont size: {}, mClustersconverted size: {} ", mClusters.size(), mClustersROFRecords.size(), mClustersMCLCont->getNElements(), mITSClustersArray.size());
2514 LOGP(info, "mTracks size: {}, mTracksROFRecords size: {}, mTracksMCLabels size: {}", mTracks.size(), mTracksROFRecords.size(), mTracksMCLabels.size());
2515 } else {
2516 LOGP(info, "mClusters size: {}, mClustersROFRecords size: {}, mClustersconverted size: {} ", mClusters.size(), mClustersROFRecords.size(), mITSClustersArray.size());
2517 LOGP(info, "mTracks size: {}, mTracksROFRecords size: {}", mTracks.size(), mTracksROFRecords.size());
2518 }
2519}
2520
2521void EfficiencyStudy::updateTimeDependentParams(ProcessingContext& pc)
2522{
2523 static bool initOnceDone = false;
2525 if (!initOnceDone) { // this params need to be queried only once
2526 initOnceDone = true;
2527 mGeometry = GeometryTGeo::Instance();
2528 mGeometry->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::T2GRot, o2::math_utils::TransformType::T2G, o2::math_utils::TransformType::L2G));
2529 }
2530}
2531
2533{
2534 LOGP(info, "--------------- endOfStream");
2535
2536 mOutFile->mkdir("EfficiencyFinal/");
2537 mOutFile->mkdir("DCAFinal/");
2538 mOutFile->mkdir("NotFoundChecks/");
2539
2540 mOutFile->mkdir("DCA/");
2541 mOutFile->mkdir("Pt_Eta_Phi/");
2542
2543 if (mUseMC) {
2544
2545 mOutFile->cd("DCA");
2546 mDCAxyDuplicated->Write();
2547 mDCAzDuplicated->Write();
2548 for (int i = 0; i < NLAYERS; i++) {
2549 mDCAxyDuplicated_layer[i]->Write();
2550 mDCAzDuplicated_layer[i]->Write();
2551
2552 mDCAxyOriginal[i]->Write();
2553 mDCAzOriginal[i]->Write();
2554 }
2555
2556 mOutFile->cd("Pt_Eta_Phi/");
2557 for (int i = 0; i < NLAYERS; i++) {
2558 mDuplicatedPhiAllPt[i]->Write();
2559 mPtDuplicated[i]->Write();
2560 mEtaDuplicated[i]->Write();
2561 mPhiDuplicated[i]->Write();
2562 mPhiOriginalIfDuplicated[i]->Write();
2563 mDuplicatedPt[i]->Write();
2564 mDuplicatedPtEta[i]->Write();
2565 mDuplicatedPtPhi[i]->Write();
2566 mDuplicatedEtaPhi[i]->Write();
2567 mDuplicatedEtaAllPt[i]->Write();
2568 mDuplicatedRow[i]->Write();
2569 mDuplicatedCol[i]->Write();
2570 mDuplicatedZ[i]->Write();
2571
2572 for (int p = 0; p < 3; p++) {
2573 mDuplicatedEta[i][p]->Write();
2574 mDuplicatedPhi[i][p]->Write();
2575 }
2576 mPt_EtaDupl[i]->Write();
2577 }
2578 }
2579
2580 mOutFile->cd("Pt_Eta_Phi/");
2581 for (int i = 0; i < NLAYERS; i++) {
2582 IPOriginalxy[i]->Write();
2583 IPOriginalz[i]->Write();
2584 mPhiOriginal[i]->Write();
2585 mPtOriginal[i]->Write();
2586 mEtaOriginal[i]->Write();
2587 mZvsPhiDUplicated[i]->Write();
2588 chipRowDuplicated[i]->Write();
2589 chipRowOriginalIfDuplicated[i]->Write();
2590 }
2591
2592 mOutFile->mkdir("chi2");
2593 mOutFile->cd("chi2/");
2594
2595 chi2trackAccepted->Write();
2596
2597 mOutFile->cd("EfficiencyFinal/");
2598 TList listNum;
2599 TList listDen;
2600 auto numPhiAll = std::unique_ptr<TH1D>((TH1D*)numPhi[0]->Clone("numPhiAll"));
2601 auto denPhiAll = std::unique_ptr<TH1D>((TH1D*)denPhi[0]->Clone("denPhiAll"));
2602
2603 TList listNumColEta;
2604 TList listDenColEta;
2605 auto numColEtaAll = std::unique_ptr<TH1D>((TH1D*)mNumColEta[0]->Clone("numColEtaAll"));
2606 auto denColEtaAll = std::unique_ptr<TH1D>((TH1D*)mDenColEta[0]->Clone("denColEtaAll"));
2607
2608 TList listNumRowPhi;
2609 TList listDenRowPhi;
2610 auto numRowPhiAll = std::unique_ptr<TH1D>((TH1D*)mNumRowPhi[0]->Clone("numRowPhiAll"));
2611 auto denRowPhiAll = std::unique_ptr<TH1D>((TH1D*)mDenRowPhi[0]->Clone("denRowPhiAll"));
2612
2613 TList listNumRowCol;
2614 TList listDenRowCol;
2615 auto numRowColAll = std::unique_ptr<TH1D>((TH1D*)mNumRowCol[0]->Clone("numRowColAll"));
2616 auto denRowColAll = std::unique_ptr<TH1D>((TH1D*)mDenRowCol[0]->Clone("denRowColAll"));
2617
2618 std::unique_ptr<TEfficiency> effLayers = std::make_unique<TEfficiency>(*numLayers, *denLayers);
2619 effLayers->SetName("effLayers");
2620 effLayers->SetTitle("; ;Efficiency");
2621 std::unique_ptr<TEfficiency> effLayersGood = std::make_unique<TEfficiency>(*numGoodLayers, *denLayers);
2622 effLayersGood->SetName("effLayersGood");
2623 effLayersGood->SetTitle("; ;Efficiency Good Matches");
2624 std::unique_ptr<TEfficiency> effLayersFake = std::make_unique<TEfficiency>(*numFakeLayers, *denLayers);
2625 effLayersFake->SetName("effLayersFake");
2626 effLayersFake->SetTitle("; ;Efficiency Fake Matches");
2627 effLayers->Write();
2628 effLayersGood->Write();
2629 effLayersFake->Write();
2630 denLayers->Write();
2631 numLayers->Write();
2632 numGoodLayers->Write();
2633 numFakeLayers->Write();
2634
2635 for (int l = 0; l < NLAYERS; l++) {
2636
2637 std::unique_ptr<TEfficiency> effPt = std::make_unique<TEfficiency>(*numPt[l], *denPt[l]);
2638 effPt->SetName(Form("effPt_layer%d", l));
2639 effPt->SetTitle(Form("L%d;p_{T} (GeV/c);Efficiency", l));
2640 std::unique_ptr<TEfficiency> effPtGood = std::make_unique<TEfficiency>(*numPtGood[l], *denPt[l]);
2641 effPtGood->SetName(Form("effPtGood_layer%d", l));
2642 effPtGood->SetTitle(Form("L%d;p_{T} (GeV/c);Efficiency Good Matches", l));
2643 std::unique_ptr<TEfficiency> effPtFake = std::make_unique<TEfficiency>(*numPtFake[l], *denPt[l]);
2644 effPtFake->SetName(Form("effPtFake_layer%d", l));
2645 effPtFake->SetTitle(Form("L%d;p_{T} (GeV/c);Efficiency Fake Matches", l));
2646 effPt->Write();
2647 effPtGood->Write();
2648 effPtFake->Write();
2649
2650 std::unique_ptr<TEfficiency> effPhi = std::make_unique<TEfficiency>(*numPhi[l], *denPhi[l]);
2651 effPhi->SetName(Form("effPhi_layer%d", l));
2652 effPhi->SetTitle(Form("L%d;#phi;Efficiency", l));
2653 std::unique_ptr<TEfficiency> effPhiGood = std::make_unique<TEfficiency>(*numPhiGood[l], *denPhi[l]);
2654 effPhiGood->SetName(Form("effPhiGood_layer%d", l));
2655 effPhiGood->SetTitle(Form("L%d;#phi;Efficiency Good Matches", l));
2656 std::unique_ptr<TEfficiency> effPhiFake = std::make_unique<TEfficiency>(*numPhiFake[l], *denPhi[l]);
2657 effPhiFake->SetName(Form("effPhiFake_layer%d", l));
2658 effPhiFake->SetTitle(Form("L%d;#phi;Efficiency Fake Matches", l));
2659 effPhi->Write();
2660 effPhiGood->Write();
2661 effPhiFake->Write();
2662 listNum.Add(numPhi[l].get());
2663 listDen.Add(denPhi[l].get());
2664
2665 std::unique_ptr<TEfficiency> effEta = std::make_unique<TEfficiency>(*numEta[l], *denEta[l]);
2666 effEta->SetName(Form("effEta_layer%d", l));
2667 effEta->SetTitle(Form("L%d;#eta;Efficiency", l));
2668 std::unique_ptr<TEfficiency> effEtaGood = std::make_unique<TEfficiency>(*numEtaGood[l], *denEta[l]);
2669 effEtaGood->SetName(Form("effEtaGood_layer%d", l));
2670 effEtaGood->SetTitle(Form("L%d;#eta;Efficiency Good Matches", l));
2671 std::unique_ptr<TEfficiency> effEtaFake = std::make_unique<TEfficiency>(*numEtaFake[l], *denEta[l]);
2672 effEtaFake->SetName(Form("effEtaFake_layer%d", l));
2673 effEtaFake->SetTitle(Form("L%d;#eta;Efficiency Fake Matches", l));
2674 effEta->Write();
2675 effEtaGood->Write();
2676 effEtaFake->Write();
2677
2678 std::unique_ptr<TEfficiency> effRow = std::make_unique<TEfficiency>(*numRow[l], *denRow[l]);
2679 effRow->SetName(Form("effRow_layer%d", l));
2680 effRow->SetTitle(Form("L%d;#Row;Efficiency", l));
2681 std::unique_ptr<TEfficiency> effRowGood = std::make_unique<TEfficiency>(*numRowGood[l], *denRow[l]);
2682 effRowGood->SetName(Form("effRowGood_layer%d", l));
2683 effRowGood->SetTitle(Form("L%d;#Row;Efficiency Good Matches", l));
2684 std::unique_ptr<TEfficiency> effRowFake = std::make_unique<TEfficiency>(*numRowFake[l], *denRow[l]);
2685 effRowFake->SetName(Form("effRowFake_layer%d", l));
2686 effRowFake->SetTitle(Form("L%d;#Row;Efficiency Fake Matches", l));
2687 effRow->Write();
2688 effRowGood->Write();
2689 effRowFake->Write();
2690
2691 std::unique_ptr<TEfficiency> effCol = std::make_unique<TEfficiency>(*numCol[l], *denCol[l]);
2692 effCol->SetName(Form("effCol_layer%d", l));
2693 effCol->SetTitle(Form("L%d;#Col;Efficiency", l));
2694 std::unique_ptr<TEfficiency> effColGood = std::make_unique<TEfficiency>(*numColGood[l], *denCol[l]);
2695 effColGood->SetName(Form("effColGood_layer%d", l));
2696 effColGood->SetTitle(Form("L%d;#Col;Efficiency Good Matches", l));
2697 std::unique_ptr<TEfficiency> effColFake = std::make_unique<TEfficiency>(*numColFake[l], *denCol[l]);
2698 effColFake->SetName(Form("effColFake_layer%d", l));
2699 effColFake->SetTitle(Form("L%d;#Col;Efficiency Fake Matches", l));
2700 effCol->Write();
2701 effColGood->Write();
2702 effColFake->Write();
2703
2704 std::unique_ptr<TEfficiency> effZ = std::make_unique<TEfficiency>(*numZ[l], *denZ[l]);
2705 effZ->SetName(Form("effZ_layer%d", l));
2706 effZ->SetTitle(Form("L%d;#Z (cm);Efficiency", l));
2707 std::unique_ptr<TEfficiency> effZGood = std::make_unique<TEfficiency>(*numZGood[l], *denZ[l]);
2708 effZGood->SetName(Form("effZGood_layer%d", l));
2709 effZGood->SetTitle(Form("L%d;#Z (cm);Efficiency Good Matches", l));
2710 std::unique_ptr<TEfficiency> effZFake = std::make_unique<TEfficiency>(*numZFake[l], *denZ[l]);
2711 effZFake->SetName(Form("effZFake_layer%d", l));
2712 effZFake->SetTitle(Form("L%d;#Z (cm);Efficiency Fake Matches", l));
2713 effZ->Write();
2714 effZGood->Write();
2715 effZFake->Write();
2716
2717 std::unique_ptr<TEfficiency> effColEta = std::make_unique<TEfficiency>(*mNumColEta[l], *mDenColEta[l]);
2718 effColEta->SetName(Form("effColEta_layer%d", l));
2719 effColEta->SetTitle(Form("L%d;Column;#eta", l));
2720 effColEta->Write();
2721
2722 listNumColEta.Add(mNumColEta[l].get());
2723 listDenColEta.Add(mDenColEta[l].get());
2724
2725 std::unique_ptr<TEfficiency> effRowPhi = std::make_unique<TEfficiency>(*mNumRowPhi[l], *mDenRowPhi[l]);
2726 effRowPhi->SetName(Form("effRowPhi_layer%d", l));
2727 effRowPhi->SetTitle(Form("L%d;Column;#eta", l));
2728 effRowPhi->Write();
2729
2730 listNumRowPhi.Add(mNumRowPhi[l].get());
2731 listDenRowPhi.Add(mDenRowPhi[l].get());
2732
2733 std::unique_ptr<TEfficiency> effRowCol = std::make_unique<TEfficiency>(*mNumRowCol[l], *mDenRowCol[l]);
2734 effRowCol->SetName(Form("effRowCol_layer%d", l));
2735 effRowCol->SetTitle(Form("L%d;Column;#eta", l));
2736 effRowCol->Write();
2737
2738 listNumRowCol.Add(mNumRowCol[l].get());
2739 listDenRowCol.Add(mDenRowCol[l].get());
2740
2741 mNumRowCol[l]->Write();
2742 mDenRowCol[l]->Write();
2743 mNumRowPhi[l]->Write();
2744 mDenRowPhi[l]->Write();
2745 mNumColEta[l]->Write();
2746 mDenColEta[l]->Write();
2747 numPhi[l]->Write();
2748 denPhi[l]->Write();
2749 numPt[l]->Write();
2750 denPt[l]->Write();
2751 numEta[l]->Write();
2752 denEta[l]->Write();
2753 numRow[l]->Write();
2754 denRow[l]->Write();
2755 numCol[l]->Write();
2756 denCol[l]->Write();
2757 numZ[l]->Write();
2758 denZ[l]->Write();
2759 }
2760 numPhiAll->Merge(&listNum);
2761 denPhiAll->Merge(&listDen);
2762
2763 numColEtaAll->Merge(&listNumColEta);
2764 denColEtaAll->Merge(&listDenColEta);
2765
2766 numRowPhiAll->Merge(&listNumRowPhi);
2767 denRowPhiAll->Merge(&listDenRowPhi);
2768
2769 numRowColAll->Merge(&listNumRowCol);
2770 denRowColAll->Merge(&listDenRowCol);
2771
2772 std::unique_ptr<TEfficiency> effPhiAll = std::make_unique<TEfficiency>(*numPhiAll, *denPhiAll);
2773 effPhiAll->SetName("effPhi_AllLayers");
2774 effPhiAll->SetTitle("L0 + L1 + L2;#phi;Efficiency");
2775 effPhiAll->Write();
2776 numPhiAll->Write();
2777 denPhiAll->Write();
2778
2779 std::unique_ptr<TEfficiency> effColEtaAll = std::make_unique<TEfficiency>(*numColEtaAll, *denColEtaAll);
2780 effColEtaAll->SetName("effColEta_AllLayers");
2781 effColEtaAll->SetTitle("L0 + L1 + L2;Column;#eta");
2782 effColEtaAll->Write();
2783 numColEtaAll->Write();
2784 denColEtaAll->Write();
2785
2786 std::unique_ptr<TEfficiency> effRowPhiAll = std::make_unique<TEfficiency>(*numRowPhiAll, *denRowPhiAll);
2787 effRowPhiAll->SetName("effRowPhi_AllLayers");
2788 effRowPhiAll->SetTitle("L0 + L1 + L2;Column;#eta");
2789 effRowPhiAll->Write();
2790 numRowPhiAll->Write();
2791 denRowPhiAll->Write();
2792
2793 std::unique_ptr<TEfficiency> effRowColAll = std::make_unique<TEfficiency>(*numRowColAll, *denRowColAll);
2794 effRowColAll->SetName("effRowCol_AllLayers");
2795 effRowColAll->SetTitle("L0 + L1 + L2;Column;#eta");
2796 effRowColAll->Write();
2797 numRowColAll->Write();
2798 denRowColAll->Write();
2799
2800 mOutFile->cd("DCAFinal/");
2801
2802 for (int l = 0; l < NLAYERS; l++) {
2803 DCAxyData[l]->Write();
2804 DCAzData[l]->Write();
2805 DCAxyRejected[l]->Write();
2806 DCAzRejected[l]->Write();
2807 }
2808
2809 mOutFile->cd("NotFoundChecks/");
2810
2811 for (int l = 0; l < NLAYERS; l++) {
2812 phiFound[l]->Write();
2813 phiNotFound[l]->Write();
2814 rowFound[l]->Write();
2815 rowNotFound[l]->Write();
2816 zFound[l]->Write();
2817 zNotFound[l]->Write();
2818 radiusFound[l]->Write();
2819 radiusNotFound[l]->Write();
2820 colFoundOriginalVsDuplicated[l]->Write();
2821 colFoundOriginal[l]->Write();
2822 colNotFound[l]->Write();
2823 }
2824 mChipFound->Write();
2825 mChipNotFound->Write();
2826 m2DClusterFoundPositions->Write();
2827 l0_00->Write();
2828 l1_15->Write();
2829 l2_19->Write();
2830 chipOrigVsOverlap->Write();
2831 chipmap->SetContour(100);
2832 chipmap->Write();
2833
2834 mOutFile->Close();
2835}
2836
2838{
2839 std::cout << "-------- finaliseCCDB" << std::endl;
2840 if (o2::base::GRPGeomHelper::instance().finaliseCCDB(matcher, obj)) {
2841 return;
2842 }
2843 if (matcher == ConcreteDataMatcher("ITS", "CLUSDICT", 0)) {
2845 return;
2846 }
2847}
2848
2849DataProcessorSpec getEfficiencyStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC, std::shared_ptr<o2::steer::MCKinematicsReader> kineReader, bool itsStag)
2850{
2851 std::vector<OutputSpec> outputs;
2852 auto dataRequest = std::make_shared<DataRequest>();
2853 dataRequest->setITSPerLayer(itsStag);
2854 dataRequest->requestTracks(srcTracksMask, useMC);
2855 dataRequest->requestClusters(srcClustersMask, useMC);
2856
2857 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
2858 true, // GRPECS=true
2859 false, // GRPLHCIF
2860 true, // GRPMagField
2861 true, // askMatLUT
2863 dataRequest->inputs,
2864 true);
2865 return DataProcessorSpec{
2866 "its-efficiency-study",
2867 dataRequest->inputs,
2868 outputs,
2869 AlgorithmSpec{adaptFromTask<EfficiencyStudy>(dataRequest, srcTracksMask, useMC, kineReader, ggRequest)},
2870 Options{}};
2871}
2872
2873} // namespace o2::its::study
Definition of the ITSMFT compact cluster.
Wrapper container for different reconstructed object types.
Definition of the ClusterTopology class.
int32_t i
Helper for geometry and GRP related CCDB requests.
Definition of the GeometryTGeo class.
#define NLAYERS
Definition of the ITSMFT ROFrame (trigger) record.
float chi2
Definition of the MCTrack class.
uint32_t j
Definition RawData.h:0
uint32_t c
Definition RawData.h:2
Definition of the ITS track.
bool isFake() const
Definition MCCompLabel.h:85
void print() const
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
Definition Propagator.h:180
gsl::span< TruthElement > getLabels(uint32_t dataindex)
const Mat3D & getMatrixT2G(int sensID) const
const char * getSymbolicName(int index) const
float getSensorRefAlpha(int isn) const
int getChipIdInStave(int index) const
Get chip number within stave, from 0.
static GeometryTGeo * Instance()
int getLayer(int index) const final
Get chip layer, from 0.
void fillMatrixCache(int mask) override
int getStave(int index) const
Get chip stave, from 0.
void setClusterDictionary(const o2::itsmft::TopologyDictionary *d)
void finaliseCCDB(ConcreteDataMatcher &, void *) final
int getDCAClusterTrackMC(int countDuplicated)
void run(ProcessingContext &) final
void stileEfficiencyGraph(std::unique_ptr< TEfficiency > &eff, const char *name, const char *title, bool bidimensional, const int markerStyle, const double markersize, const int markercolor, const int linercolor)
void init(InitContext &) final
void initialiseRun(o2::globaltracking::RecoContainer &)
void process(o2::globaltracking::RecoContainer &)
EfficiencyStudy(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.
UShort_t getChipID() const
UShort_t getCol() const
Definition CompCluster.h:58
GLenum src
Definition glcorearb.h:1767
GLuint const GLchar * name
Definition glcorearb.h:781
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< ConfigParamSpec > Options
auto get(const std::byte *buffer, size_t=0)
Definition DataHeader.h:457
void convertCompactClusters(gsl::span< const itsmft::CompClusterExt > clusters, gsl::span< const unsigned char >::iterator &pattIt, std::vector< o2::BaseCluster< float > > &output, const itsmft::TopologyDictionary *dict)
convert compact clusters to 3D spacepoints
Definition IOUtils.cxx:35
float mEtaCuts[2]
Definition Efficiency.h:31
float sigmaDcaXY[3]
Definition Efficiency.h:43
float dcaZ[3]
Definition Efficiency.h:42
float mDCACutsZ[3][2]
Definition Efficiency.h:49
float sigmaDcaZ[3]
Definition Efficiency.h:44
o2::framework::DataProcessorSpec getEfficiencyStudy(mask_t srcTracksMask, mask_t srcClustersMask, bool useMC, std::shared_ptr< o2::steer::MCKinematicsReader > kineReader, bool itsStag)
float mDCACutsXY[3][2]
Definition Efficiency.h:48
std::vector< int > mExcludedChipMC
excluding bad chips in MC that are not present in data: to be checked based on the anchoring
Definition Efficiency.h:52
float dcaXY[3]
no cut for B=0
Definition Efficiency.h:41
const bool const int TrackITSInternal< NLayers > & track
const float const float const float bz
TrackParCovF TrackParCov
Definition Track.h:33
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
auto getITSClustersROFRecords(int layer=0) const
auto getITSClustersPatterns(int layer=0) const
void collectData(o2::framework::ProcessingContext &pc, const DataRequest &request)
auto getITSClusters(int layer=0) const
auto getITSClustersMCLabels(int layer=0) const
std::vector< o2::mch::ChannelCode > cc
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< int > row