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