Belle II Software development
SVDROIFinderAnalysisModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <tracking/modules/roiFinding/svd/SVDROIFinderAnalysisModule.h>
10#include <framework/datastore/StoreArray.h>
11#include <framework/datastore/RelationIndex.h>
12#include <framework/logging/Logger.h>
13
14#include <mdst/dataobjects/MCParticle.h>
15#include <tracking/dataobjects/RecoTrack.h>
16#include <tracking/dataobjects/ROIid.h>
17#include <tracking/dataobjects/SVDIntercept.h>
18#include <svd/dataobjects/SVDShaperDigit.h>
19#include <svd/dataobjects/SVDTrueHit.h>
20#include <vxd/geometry/GeoCache.h>
21
22#include <TMath.h>
23
24#include <iostream>
25
26
27using namespace Belle2;
28
29//-----------------------------------------------------------------
30// Register the Module
31//-----------------------------------------------------------------
32REG_MODULE(SVDROIFinderAnalysis);
33
34//-----------------------------------------------------------------
35// Implementation
36//-----------------------------------------------------------------
37
39 , m_recoTrackListName()
40 , m_SVDInterceptListName()
41 , m_ROIListName()
42 , m_rootFilePtr(nullptr)
43 , m_rootFileName("")
44 , m_writeToRoot(false)
45 , m_rootEvent(-1)
46 //efficiency graphs
47 , m_gEff2(nullptr)
48 , m_gEff(nullptr)
49 , m_h1DigitsPerParticle(nullptr)
50 , m_h1RecoTracksPerParticle(nullptr)
51 , m_h1digiIn(nullptr)
52 , m_h1digiOut2(nullptr)
53 , m_h1digiOut3(nullptr)
54 , m_h1digiOut4(nullptr)
55 , m_h1digiOut5(nullptr)
56 //tracks with no digit in ROI
57 , m_h1TrackOneDigiIn(nullptr)
58 , m_h1nnotINtrack2(nullptr)
59 , m_h1nnotINtrack3(nullptr)
60 , m_h1nnotINtrack4(nullptr)
61 , m_h1nnotINtrack5(nullptr)
62 //all tracks
63 , m_h1Track(nullptr)
64 , m_h1Track_pt(nullptr)
65 , m_h1Track_phi(nullptr)
66 , m_h1Track_lambda(nullptr)
67 , m_h1Track_cosTheta(nullptr)
68 , m_h1Track_pVal(nullptr)
69 , m_h1Track_nSVDhits(nullptr)
70 , m_h1Track_nCDChits(nullptr)
71 //tracks with at least one digit in ROI
72 , m_h1INtrack1(nullptr)
73 , m_h1INtrack1_pt(nullptr)
74 , m_h1INtrack1_phi(nullptr)
75 , m_h1INtrack1_lambda(nullptr)
76 , m_h1INtrack1_cosTheta(nullptr)
77 , m_h1INtrack1_pVal(nullptr)
78 , m_h1INtrack1_nSVDhits(nullptr)
79 , m_h1INtrack1_nCDChits(nullptr)
80 //tracks with no intercept
81 , m_h1notINtrack5(nullptr)
82 , m_h1notINtrack5_pt(nullptr)
83 , m_h1notINtrack5_phi(nullptr)
84 , m_h1notINtrack5_lambda(nullptr)
85 , m_h1notINtrack5_cosTheta(nullptr)
86 , m_h1notINtrack5_pVal(nullptr)
87 , m_h1notINtrack5_nSVDhits(nullptr)
88 , m_h1notINtrack5_nCDChits(nullptr)
89 //digits inside ROI
90 , m_h1PullU(nullptr)
91 , m_h1PullV(nullptr)
92 , m_h2sigmaUphi(nullptr)
93 , m_h2sigmaVphi(nullptr)
94 , m_h1ResidU(nullptr)
95 , m_h1ResidV(nullptr)
96 , m_h1SigmaU(nullptr)
97 , m_h1SigmaV(nullptr)
98 , m_h1GlobalTime(nullptr)
99 //digits outside2 ROI
100 , m_h2sigmaUphi_out2(nullptr)
101 , m_h2sigmaVphi_out2(nullptr)
102 , m_h1ResidU_out2(nullptr)
103 , m_h1ResidV_out2(nullptr)
104 , m_h1SigmaU_out2(nullptr)
105 , m_h1SigmaV_out2(nullptr)
106 , m_h1GlobalTime_out2(nullptr)
107 //digits outside3 ROI
108 , m_h2sigmaUphi_out3(nullptr)
109 , m_h2sigmaVphi_out3(nullptr)
110 , m_h1ResidU_out3(nullptr)
111 , m_h1ResidV_out3(nullptr)
112 , m_h1SigmaU_out3(nullptr)
113 , m_h1SigmaV_out3(nullptr)
114 , m_h1GlobalTime_out3(nullptr)
115 //digits outside4 ROI
116 , m_h2sigmaUphi_out4(nullptr)
117 , m_h2sigmaVphi_out4(nullptr)
118 , m_h1SigmaU_out4(nullptr)
119 , m_h1SigmaV_out4(nullptr)
120 , m_h1GlobalTime_out4(nullptr)
121 //digits outside5 ROI
122 , m_h1GlobalTime_out5(nullptr)
123
124 //ROI stuff
125 , m_h2ROIbottomLeft(nullptr)
126 , m_h2ROItopRight(nullptr)
127 , m_h2ROIuMinMax(nullptr)
128 , m_h2ROIvMinMax(nullptr)
129 , m_h1totROIs(nullptr)
130 , m_h1okROIs(nullptr)
131 , m_h1totUstrips(nullptr)
132 , m_h1totVstrips(nullptr)
133
134 , m_h1effPerTrack(nullptr)
135
136 //variables
137 , m_globalTime(0.)
138 , m_coorU(0.)
139 , m_coorV(0.)
140 , m_sigmaU(0.)
141 , m_sigmaV(0.)
142 , m_vxdID(-1)
143
144 , m_coormc(0.)
145 , m_idmc(-1)
146 , m_vxdIDmc(-1)
147 , m_pTmc(0.)
148 , m_momXmc(0.)
149 , m_momYmc(0.)
150 , m_momZmc(0.)
151 , m_thetamc(0.)
152 , m_costhetamc(0.)
153 , m_phimc(0.)
154 , m_lambdamc(0.)
155
156 , Ntrack(0)
157 , NtrackHit(0)
158 , n_notINtrack2(0)
159 , n_notINtrack3(0)
160 , n_notINtrack4(0)
161 , n_notINtrack5(0)
162
163 , n_rois(0)
164 , n_OKrois(0)
165 , m_nGoodROIs(0)
166 , n_intercepts(0)
167 , n_tracks(0)
168 , n_tracksWithDigits(0)
169 , n_tracksWithDigitsInROI(0)
170
171
172 , n_svdDigit(0)
173 , n_svdDigitInROI(0)
174 , n_notINdigit2(0)
175 , n_notINdigit3(0)
176 , n_notINdigit4(0)
177 , n_notINdigit5(0)
178
179 //vectors
180 , nsvdDigit{0}
181 , nsvdDigitInROI{0}
182 , nnotINdigit2{0}
183 , nnotINdigit3{0}
184 , nnotINdigit4{0}
185 , nnotINdigit5{0}
186 , TrackOneDigiIn{0}
187 , nnotINtrack2{0}
188 , nnotINtrack3{0}
189 , nnotINtrack4{0}
190 , nnotINtrack5{0}
191
192{
193 //Set module properties
194 setDescription("This module performs the analysis of the SVDROIFinder module output");
195
196 addParam("isSimulation", m_isSimulation,
197 "set true if you want to evaluate efficiency on simulation", bool(true));
198 addParam("writeToRoot", m_writeToRoot,
199 "set true if you want to save the informations in a root file named by parameter 'rootFileName'", bool(true));
200
201 addParam("rootFileName", m_rootFileName,
202 "fileName used for . Will be ignored if parameter 'writeToRoot' is false (standard)",
203 std::string("svdDataRedAnalysis"));
204
205 addParam("recoTrackListName", m_recoTrackListName,
206 "name of the input collection of RecoTracks", std::string(""));
207
208 addParam("shapers", m_shapersName,
209 "name of the input collection of SVDShaperDigits", std::string(""));
210
211 addParam("SVDInterceptListName", m_SVDInterceptListName,
212 "name of the list of interceptions", std::string(""));
213
214 addParam("ROIListName", m_ROIListName,
215 "name of the list of ROIs", std::string(""));
216
217 m_rootEvent = 0;
218}
219
221{
222}
223
224
226{
227
228 m_shapers.isRequired(m_shapersName);
230 m_ROIs.isRequired(m_ROIListName);
233
234 n_rois = 0;
235 n_OKrois = 0; //simulation
236 m_nGoodROIs = 0; //data
237 n_intercepts = 0;
238 n_tracks = 0;
239 n_svdDigit = 0;
240 n_svdDigitInROI = 0;
241
244 NtrackHit = 0;
245 n_notINtrack2 = 0;
246 n_notINtrack3 = 0;
247 n_notINtrack4 = 0;
248 n_notINtrack5 = 0;
249
250 for (int i = 0; i < 6; i++) {
251 nsvdDigit[i] = 0;
252 nsvdDigitInROI[i] = 0;
253 }
254
255 if (m_writeToRoot == true) {
256 m_rootFileName += ".root";
257 m_rootFilePtr = new TFile(m_rootFileName.c_str(), "RECREATE");
258 } else
259 m_rootFilePtr = nullptr;
260
261
262 m_h1GlobalTime = new TH1F("hGlobalTime", "global time for SVDShaperDigits contained in ROI", 200, -100, 100);
263 m_h1PullU = new TH1F("hPullU", "U pulls for SVDShaperDigits contained in ROI", 100, -6, 6);
264 m_h1PullV = new TH1F("hPullV", "V pulls for SVDShaperDigits contained in ROI", 100, -6, 6);
265 m_h2sigmaUphi = new TH2F("hsigmaUvsPhi", "sigmaU vs phi digits in ROI", 100, -180, 180, 100, 0, 0.35);
266 m_h2sigmaVphi = new TH2F("hsigmaVvsPhi", "sigmaU vs phi digits in ROI", 100, -180, 180, 100, 0, 0.4);
267 m_h1ResidU = new TH1F("hResidU", "U resid for SVDShaperDigits contained in ROI", 100, -0.5, 0.5);
268 m_h1ResidV = new TH1F("hResidV", "V resid for SVDShaperDigits contained in ROI", 100, -0.5, 0.5);
269 m_h1SigmaU = new TH1F("hSigmaU", "sigmaU for SVDShaperDigits contained in ROI", 100, 0, 0.35);
270 m_h1SigmaV = new TH1F("hSigmaV", "sigmaV for SVDShaperDigits contained in ROI", 100, 0, 0.35);
271
272
273 m_h1GlobalTime_out2 = new TH1F("hGlobalTime_out2", "global time for SVDShaperDigits not contained in ROI", 200, -100, 100);
274 m_h2sigmaUphi_out2 = new TH2F("hsigmaUvsPhi_out2", "sigmaU vs phi digits not contained in ROI", 100, -180, 180, 100, 0, 0.35);
275 m_h2sigmaVphi_out2 = new TH2F("hsigmaVvsPhi_out2", "sigmaU vs phi digits not contained in ROI", 100, -180, 180, 100, 0, 0.4);
276 m_h1ResidU_out2 = new TH1F("hResidU_out2", "U resid for SVDShaperDigits not contained in ROI", 100, -2.5, 2.5);
277 m_h1ResidV_out2 = new TH1F("hResidV_out2", "V resid for SVDShaperDigits not contained in ROI", 100, -2.5, 2.5);
278 m_h1SigmaU_out2 = new TH1F("hSigmaU_out2", "sigmaU for SVDShaperDigits not contained in ROI", 100, 0, 0.35);
279 m_h1SigmaV_out2 = new TH1F("hSigmaV_out2", "sigmaV for SVDShaperDigits not contained in ROI", 100, 0, 0.35);
280
281 m_h1GlobalTime_out3 = new TH1F("hGlobalTime_out3", "global time for SVDShaperDigits not contained in ROI", 200, -100, 100);
282 m_h2sigmaUphi_out3 = new TH2F("hsigmaUvsPhi_out3", "sigmaU vs phi digits not contained in ROI", 100, -180, 180, 100, 0, 0.35);
283 m_h2sigmaVphi_out3 = new TH2F("hsigmaVvsPhi_out3", "sigmaU vs phi digits not contained in ROI", 100, -180, 180, 100, 0, 0.4);
284 m_h1ResidU_out3 = new TH1F("hResidU_out3", "U resid for SVDShaperDigits not contained in ROI", 100, -2.5, 2.5);
285 m_h1ResidV_out3 = new TH1F("hResidV_out3", "V resid for SVDShaperDigits not contained in ROI", 100, -2.5, 2.5);
286 m_h1SigmaU_out3 = new TH1F("hSigmaU_out3", "sigmaU for SVDShaperDigits not contained in ROI", 100, 0, 0.35);
287 m_h1SigmaV_out3 = new TH1F("hSigmaV_out3", "sigmaV for SVDShaperDigits not contained in ROI", 100, 0, 0.35);
288
289
290 m_h1GlobalTime_out4 = new TH1F("hGlobalTime_out4", "global time for SVDShaperDigits not contained in ROI", 200, -100, 100);
291 m_h2sigmaUphi_out4 = new TH2F("hsigmaUvsPhi_out4", "sigmaU vs phi digits not contained in ROI", 100, -180, 180, 100, 0, 0.35);
292 m_h2sigmaVphi_out4 = new TH2F("hsigmaVvsPhi_out4", "sigmaU vs phi digits not contained in ROI", 100, -180, 180, 100, 0, 0.4);
293 m_h1SigmaU_out4 = new TH1F("hSigmaU_out4", "sigmaU for SVDShaperDigits not contained in ROI", 100, 0, 0.35);
294 m_h1SigmaV_out4 = new TH1F("hSigmaV_out4", "sigmaV for SVDShaperDigits not contained in ROI", 100, 0, 0.35);
295
296
297 m_h1GlobalTime_out5 = new TH1F("hGlobalTime_out5", "global time for SVDShaperDigits not contained in ROI", 200, -100, 100);
298
299
300
301 m_h1totROIs = new TH1F("h1TotNROIs", "number of all ROIs", 110, 0, 110);
302 m_h1okROIs = new TH1F("h1OkNROIs", "number of all ROIs containing a SVDShaperDigit", 110, 0, 110);
303
304 m_h1totUstrips = new TH1F("h1TotUstrips", "number of U strips in ROIs", 100, 0, 250000);
305 m_h1totVstrips = new TH1F("h1TotVstrips", "number of V strips in ROIs", 100, 0, 250000);
306
307 m_h1effPerTrack = new TH1F("heffPerTrack", "fraction of digits in ROI per track", 100, -0.02, 1.02);
308
309
310
311 m_h2ROIbottomLeft = new TH2F("h2ROIbottomLeft", "u,v ID of the bottom left pixel", 650, -200, 450, 1300, -300, 1000);
312 m_h2ROItopRight = new TH2F("h2ROItopRight", "u,v ID of the top right pixel", 650, -200, 450, 1300, -300, 1000);
313
314 m_h2ROIuMinMax = new TH2F("h2ROIuMinMax", "u Min vs Max", 650, -200, 450, 650, -200, 450);
315 m_h2ROIvMinMax = new TH2F("h2ROIvMinMax", "v Min vs Max", 1300, -300, 1000, 1300, -300, 1000);
316
317
318 m_h1DigitsPerParticle = new TH1F("h1DigitsPerPart", "Number of SVDShaperDigits per Particle", 50, 0, 50);
319 m_h1RecoTracksPerParticle = new TH1F("h1RecoTracksPerPart", "Number of RecoTracks per Particle", 10, 0, 10);
320
321
322 //analysis
323 Double_t lowBin[6 + 1];
324 for (int i = 0; i < 6; i++)
325 lowBin[i] = pt[i] - ptErr[i];
326 lowBin[6] = pt[5] + ptErr[5];
327
328 m_h1TrackOneDigiIn = new TH1F("hTracksDigiIn", "Tracks with at least one digit contained in a ROI", 6, lowBin);
329 m_h1nnotINtrack2 = new TH1F("h1outROITrack", "Tracks with ROI with correct VxdID but no digits inside ROI", 6, lowBin);
330 m_h1nnotINtrack3 = new TH1F("h1noROITrack", "Tracks with ROI with wrong VxdID but no digits inside ROI", 6, lowBin);
331 m_h1nnotINtrack4 = new TH1F("h1wrongVxdIDTrack", "Tracks with no ROI, Intercept with correct VxdID", 6, lowBin);
332 m_h1nnotINtrack5 = new TH1F("h1noInterTrack", "Tracks with no Intercept matching a VxdID of digits", 6, lowBin);
333
334 m_h1notINtrack5 = new TH1F("hNoInterTrack", "track with no intercepts", 20, 0, 20);
335 m_h1notINtrack5_pt = new TH1F("hNoInterTrack_pT", "track with no intercepts", 100, 0, 6);
336 m_h1notINtrack5_phi = new TH1F("h1NoInterTrack_phi", "hNoInterTrack_phi", 100, -180, 180);
337 m_h1notINtrack5_lambda = new TH1F("h1NoInterTrack_lambda", "hNoInterTrack_lambda", 100, -180, 180);
338 m_h1notINtrack5_cosTheta = new TH1F("h1NoInterTrack_cosTheta", "hNoInterTrack_cosTheta", 100, -1, 1);
339 m_h1notINtrack5_pVal = new TH1F("hNoInterTrack_pVal", "track with no intercepts", 100, 0, 1);
340 m_h1notINtrack5_nSVDhits = new TH1F("hNoInterTrack_nSVDhits", "track with no intercepts", 50, 0, 50);
341 m_h1notINtrack5_nCDChits = new TH1F("hNoInterTrack_nCDChits", "track with no intercepts", 100, 0, 100);
342
343 m_h1INtrack1 = new TH1F("hINTrack", "track with at least one digit inside ROI", 20, 0, 20);
344 m_h1INtrack1_pt = new TH1F("hINTrack_pT", "track with at least one digit inside ROI", 100, 0, 6);
345 m_h1INtrack1_phi = new TH1F("h1INTrack_phi", "hINTrack_phi", 100, -180, 180);
346 m_h1INtrack1_lambda = new TH1F("h1INTrack_lambda", "hINTrack_lambda", 100, -180, 180);
347 m_h1INtrack1_cosTheta = new TH1F("h1INTrack_cosTheta", "hINTrack_cosTheta", 100, -1, 1);
348 m_h1INtrack1_pVal = new TH1F("h1INTrack_pVal", "track with no intercepts", 100, 0, 1);
349 m_h1INtrack1_nSVDhits = new TH1F("h1INTrack_nSVDhits", "track with no intercepts", 50, 0, 50);
350 m_h1INtrack1_nCDChits = new TH1F("h1INTrack_nCDChits", "track with no intercepts", 100, 0, 100);
351
352 m_h1Track = new TH1F("hTrack", "all tracks", 20, 0, 20);
353 m_h1Track_pt = new TH1F("hTrack_pT", "all tracks with digits", 100, 0, 6);
354 m_h1Track_lambda = new TH1F("h1Track_lambda", "hTrack_lambda", 100, -180, 180);
355 m_h1Track_phi = new TH1F("h1Track_phi", "hTrack_phi", 100, -180, 180);
356 m_h1Track_cosTheta = new TH1F("h1Track_cosTheta", "hTrack_cos theta", 100, -1, 1);
357 m_h1Track_pVal = new TH1F("h1Track_pVal", "track with no intercepts", 100, 0, 1);
358 m_h1Track_nSVDhits = new TH1F("h1Track_nSVDhits", "track with no intercepts", 50, 0, 50);
359 m_h1Track_nCDChits = new TH1F("h1Track_nCDChits", "track with no intercepts", 100, 0, 100);
360
361 m_h1digiIn = new TH1F("hdigiIn", "digits inside ROI", 6, lowBin);
362 m_h1digiOut2 = new TH1F("hdigiOut2", "ROI exists with with correct VxdID but no digits inside ROI", 6, lowBin);
363 m_h1digiOut3 = new TH1F("hdigiOut3", "ROI exists with with wrong VxdID", 6, lowBin);
364 m_h1digiOut4 = new TH1F("hdigiOut4", "ROI does not exist, but intercept has correct VxdID", 6, lowBin);
365 m_h1digiOut5 = new TH1F("hdigiOut5", "no ROI, no Intercpets with correct VXDid", 6, lowBin);
366
367 // m_h2_VXDhitsPR_xy = new TH2F("hNoInteTrack_SVDhitsXY", "SVD Hits Missed by the VXDTF", 200, -15, 15, 200, -15, 15);
368
369 // m_h2_VXDhitsPR_rz = new TH2F("hNoInteTrack_SVDhitsRZ", "SVD Hits Missed by the VXDTF, r_{T} z", 200, -30, 40, 200, 0, 15);
370
371
372}
373
375{
376 m_rootEvent = 0;
377}
378
379
381{
382
383 typedef RelationIndex < RecoTrack, SVDIntercept>::range_from SVDInterceptsFromRecoTracks;
384 typedef RelationIndex < RecoTrack, SVDIntercept>::iterator_from SVDInterceptIteratorType;
385 typedef RelationIndex < SVDShaperDigit, SVDTrueHit>::range_from SVDTrueHitFromSVDShaperDigit;
387 RelationIndex < SVDShaperDigit, SVDTrueHit >
388 relDigitTrueHit(DataStore::relationName(DataStore::arrayName<SVDShaperDigit>(""),
389 DataStore::arrayName<SVDTrueHit>("")));
390 RelationIndex < RecoTrack, SVDIntercept >
392
393 double tmpGlobalTime;
394 int tmpNGlobalTime;
395
396 NtrackHit = 0;
397 Ntrack = 0;
398
399 B2DEBUG(21, " ++++++++++++++ SVDROIFinderAnalysisModule");
400
401 int nROIs = 0;
402
403
404
405 //ROIs general
406 for (int i = 0; i < (int)m_ROIs.getEntries(); i++) { //loop on ROIlist
407
408 m_h2ROIbottomLeft->Fill(m_ROIs[i]->getMinUid(), m_ROIs[i]->getMinVid());
409 m_h2ROItopRight->Fill(m_ROIs[i]->getMaxUid(), m_ROIs[i]->getMaxVid());
410 m_h2ROIuMinMax->Fill(m_ROIs[i]->getMinUid(), m_ROIs[i]->getMaxUid());
411 m_h2ROIvMinMax->Fill(m_ROIs[i]->getMinVid(), m_ROIs[i]->getMaxVid());
412
413 for (int s = 0; s < m_shapers.getEntries(); s++) {
414 if (m_ROIs[i]->Contains(*(m_shapers[s]))) {
415 m_nGoodROIs++;
416 break;
417 }
418
419 }
420
421
422 bool isOK = false;
423
424 for (int j = 0; j < (int)m_mcParticles.getEntries(); j++) {
425 MCParticle* aMcParticle = m_mcParticles[j];
426
427 // continue only if MCParticle has a related SVDShaperDigit and RecoTrack
428 RelationVector<SVDShaperDigit> svdDigits_MCParticle = aMcParticle->getRelationsFrom<SVDShaperDigit>();
429
430 if (!isOK)
431 //loop on SVDShaperDigits
432 for (unsigned int iSVDShaperDigit = 0; iSVDShaperDigit < svdDigits_MCParticle.size(); iSVDShaperDigit++)
433 if (m_ROIs[i]->Contains(*(svdDigits_MCParticle[iSVDShaperDigit]))) {
434 nROIs++;
435 isOK = true;
436 break;
437 }
438 }
439 }
440
441 m_h1totROIs->Fill(m_ROIs.getEntries());
442 n_rois += m_ROIs.getEntries();
443
444 //RecoTrack general
446
447 //SVDIntercepts general
448 n_intercepts += m_SVDIntercepts.getEntries();
449
450 Int_t n_NoInterceptTracks = 0;
451
452 //loop on MCParticles
453 for (int j = 0; j < (int)m_mcParticles.getEntries(); j++) {
454
455 MCParticle* aMcParticle = m_mcParticles[j];
456
457 // continue only if MCParticle has a related SVDShaperDigit and RecoTrack
458 RelationVector<SVDShaperDigit> svdDigits_MCParticle = aMcParticle->getRelationsFrom<SVDShaperDigit>();
459 RelationVector<RecoTrack> recoTracks_MCParticle = aMcParticle->getRelationsWith<RecoTrack>();
460
461 m_h1DigitsPerParticle->Fill(svdDigits_MCParticle.size());
462 if (svdDigits_MCParticle.size() == 0)
463 continue;
464
465 // m_h1RecoTracksPerParticle->Fill(recoTracks_MCParticle.size());
466 // if (recoTracks_MCParticle.size() == 0)
467 // continue;
468
469 Ntrack++;
470
471 B2DEBUG(21, "Number of RecoTracks = " << recoTracks_MCParticle.size() << " and SVDShaperDigits = " << svdDigits_MCParticle.size() <<
472 " related to this MCParticle");
473
474 //retrieve general informations of MCParticle
475 m_momXmc = (aMcParticle->getMomentum()).X();
476 m_momYmc = (aMcParticle->getMomentum()).Y();
477 m_momZmc = (aMcParticle->getMomentum()).Z();
478 m_phimc = (aMcParticle->getMomentum()).Phi() * TMath::RadToDeg();
479 m_thetamc = (aMcParticle->getMomentum()).Theta() * TMath::RadToDeg();
480 m_costhetamc = cos((aMcParticle->getMomentum()).Theta());
481 m_lambdamc = 90 - m_thetamc;
482 m_pTmc = (aMcParticle->getMomentum()).Rho();
483
484
485 bool part_outsideROI = false;
486 bool part_noROI = false;
487 bool part_wrongVxdID = false;
488 bool part_noInter = false;
489 bool hasOneDigitInROI = false;
490
491 Int_t nDigitsInRoiPerTrack = 0;
492 Int_t nDigitsPerTrack = 0;
493
494 //loop on SVDShaperDigits
495 for (unsigned int iSVDShaperDigit = 0; iSVDShaperDigit < svdDigits_MCParticle.size(); iSVDShaperDigit++) {
496
497 bool isU = svdDigits_MCParticle[iSVDShaperDigit]->isUStrip();
498
499 bool hasIntercept = false;
500 bool hasROI = false;
501 bool interceptRightVxdID = false;
502 bool MissingHit = true;
503
504 n_svdDigit ++ ;
505 nDigitsPerTrack++;
506
507 SVDTrueHitFromSVDShaperDigit SVDTrueHits = relDigitTrueHit.getElementsFrom(*svdDigits_MCParticle[iSVDShaperDigit]);
508 SVDTrueHitIteratorType theSVDTrueHitIterator = SVDTrueHits.begin();
509 SVDTrueHitIteratorType theSVDTrueHitIteratorEnd = SVDTrueHits.end();
510 tmpGlobalTime = 0;
511 tmpNGlobalTime = 0;
512
513 for (; theSVDTrueHitIterator != theSVDTrueHitIteratorEnd; theSVDTrueHitIterator++) {
514 tmpGlobalTime = tmpGlobalTime + theSVDTrueHitIterator->to->getGlobalTime();
515 tmpNGlobalTime++;
516 }
517
518 m_globalTime = tmpGlobalTime / tmpNGlobalTime;
519 m_idmc = svdDigits_MCParticle[iSVDShaperDigit]->getCellID();
520 m_vxdIDmc = svdDigits_MCParticle[iSVDShaperDigit]->getSensorID();
521
523 const VXD::SensorInfoBase& aSensorInfo = aGeometry.getSensorInfo(m_vxdIDmc);
524
525 if (isU)
526 m_coormc = aSensorInfo.getUCellPosition(m_idmc);
527 else
528 m_coormc = aSensorInfo.getVCellPosition(m_idmc);
529
530 if (m_pTmc > 1) nsvdDigit[5]++;
531 if (m_pTmc <= 1 && m_pTmc > 0.5) nsvdDigit[4]++;
532 if (m_pTmc <= 0.5 && m_pTmc > 0.3) nsvdDigit[3]++;
533 if (m_pTmc <= 0.3 && m_pTmc > 0.2) nsvdDigit[2]++;
534 if (m_pTmc <= 0.2 && m_pTmc > 0.1) nsvdDigit[1]++;
535 if (m_pTmc <= 0.1) nsvdDigit[0]++;
536
537
538 // for (int i = 0; i < (int)recoTracks_MCParticle.size(); i++) { //loop on related RecoTracks
539 for (int i = 0; i < (int)m_trackList.getEntries(); i++) { //loop on all RecoTracks
540
541 // SVDInterceptsFromRecoTracks SVDIntercepts = recoTrackToSVDIntercept.getElementsFrom(recoTracks_MCParticle[i]);
542 SVDInterceptsFromRecoTracks SVDIntercepts = recoTrackToSVDIntercept.getElementsFrom(m_trackList[i]);
543
544 SVDInterceptIteratorType theSVDInterceptIterator = SVDIntercepts.begin();
545 SVDInterceptIteratorType theSVDInterceptIteratorEnd = SVDIntercepts.end();
546
547
548 for (; theSVDInterceptIterator != theSVDInterceptIteratorEnd; theSVDInterceptIterator++) {
549
550 const SVDIntercept* theIntercept = theSVDInterceptIterator->to;
551
552 if (theIntercept) {
553
554 hasIntercept = true;
555
556 m_coorU = theIntercept->getCoorU();
557 m_coorV = theIntercept->getCoorV();
558 m_sigmaU = theIntercept->getSigmaU();
559 m_sigmaV = theIntercept->getSigmaV();
560 m_vxdID = theIntercept->getSensorID();
561
562 if (m_vxdID == m_vxdIDmc)
563 interceptRightVxdID = true;
564 else
565 continue;
566
567 const ROIid* theROIid = theIntercept->getRelatedTo<ROIid>(m_ROIListName);
568
569 if (theROIid) {
570
571 hasROI = true;
572
573 if (theROIid->Contains(*(svdDigits_MCParticle[iSVDShaperDigit]))) { //CASO1
574
575 if (MissingHit) {
576 nDigitsInRoiPerTrack++;
577
579
580 if (isU) {
581 m_h1PullU->Fill((m_coorU - m_coormc) / m_sigmaU);
582 m_h1ResidU->Fill(m_coorU - m_coormc);
584 m_h1SigmaU->Fill(m_sigmaU);
585 } else {
586 m_h1PullV->Fill((m_coorV - m_coormc) / m_sigmaV);
587 m_h1ResidV->Fill(m_coorV - m_coormc);
589 m_h1SigmaV->Fill(m_sigmaV);
590 }
591
592 hasOneDigitInROI = true;
594
595 if (m_pTmc > 1) nsvdDigitInROI[5]++;
596 if (m_pTmc <= 1 && m_pTmc > 0.5) nsvdDigitInROI[4]++;
597 if (m_pTmc <= 0.5 && m_pTmc > 0.3) nsvdDigitInROI[3]++;
598 if (m_pTmc <= 0.3 && m_pTmc > 0.2) nsvdDigitInROI[2]++;
599 if (m_pTmc <= 0.2 && m_pTmc > 0.1) nsvdDigitInROI[1]++;
600 if (m_pTmc <= 0.1) nsvdDigitInROI[0]++;
601
602 MissingHit = false;
603 }
604
605
606 break; // To avoid double counting (intercepts)
607 } //if theROIid contains
608 } //if (theROIid)
609 } //if (theintercept)
610 } //(end loop on intercept list)
611
612 if (!MissingHit)
613 break;// To avoid double counting (recoTracks)
614
615 } //(end loop on recoTracks)
616
617
618 if (MissingHit) {
619
620 if (hasROI && hasIntercept && interceptRightVxdID) {
621 part_outsideROI = true;
622
623 n_notINdigit2 ++;
624
626 if (isU) {
630 } else {
634 }
635
636 if (m_pTmc > 1) nnotINdigit2[5]++;
637 if (m_pTmc <= 1 && m_pTmc > 0.5) nnotINdigit2[4]++;
638 if (m_pTmc <= 0.5 && m_pTmc > 0.3) nnotINdigit2[3]++;
639 if (m_pTmc <= 0.3 && m_pTmc > 0.2) nnotINdigit2[2]++;
640 if (m_pTmc <= 0.2 && m_pTmc > 0.1) nnotINdigit2[1]++;
641 if (m_pTmc <= 0.1) nnotINdigit2[0]++;
642
643 } else if (!hasROI && hasIntercept && interceptRightVxdID) {
644 part_noROI = true;
645
646 n_notINdigit3 ++;
647
649 if (isU) {
653 } else {
657 }
658
659 if (m_pTmc > 1) nnotINdigit3[5]++;
660 if (m_pTmc <= 1 && m_pTmc > 0.5) nnotINdigit3[4]++;
661 if (m_pTmc <= 0.5 && m_pTmc > 0.3) nnotINdigit3[3]++;
662 if (m_pTmc <= 0.3 && m_pTmc > 0.2) nnotINdigit3[2]++;
663 if (m_pTmc <= 0.2 && m_pTmc > 0.1) nnotINdigit3[1]++;
664 if (m_pTmc <= 0.1) nnotINdigit3[0]++;
665
666 } else if (hasIntercept && !interceptRightVxdID) {
667 part_wrongVxdID = true;
668
669 n_notINdigit4 ++;
670
672 if (isU) {
675 } else {
678 }
679
680 if (m_pTmc > 1) nnotINdigit4[5]++;
681 if (m_pTmc <= 1 && m_pTmc > 0.5) nnotINdigit4[4]++;
682 if (m_pTmc <= 0.5 && m_pTmc > 0.3) nnotINdigit4[3]++;
683 if (m_pTmc <= 0.3 && m_pTmc > 0.2) nnotINdigit4[2]++;
684 if (m_pTmc <= 0.2 && m_pTmc > 0.1) nnotINdigit4[1]++;
685 if (m_pTmc <= 0.1) nnotINdigit4[0]++;
686
687 } else if (!hasIntercept) {
688 part_noInter = true;
689
690 n_notINdigit5 ++;
691
693
694 if (m_pTmc > 1) nnotINdigit5[5]++;
695 if (m_pTmc <= 1 && m_pTmc > 0.5) nnotINdigit5[4]++;
696 if (m_pTmc <= 0.5 && m_pTmc > 0.3) nnotINdigit5[3]++;
697 if (m_pTmc <= 0.3 && m_pTmc > 0.2) nnotINdigit5[2]++;
698 if (m_pTmc <= 0.2 && m_pTmc > 0.1) nnotINdigit5[1]++;
699 if (m_pTmc <= 0.1) nnotINdigit5[0]++;
700 }
701 }
702 } //end loop on digits
703
704 m_h1effPerTrack->Fill((float) nDigitsInRoiPerTrack / nDigitsPerTrack);
705 m_h1Track_pt->Fill(m_pTmc);
706 m_h1Track_phi->Fill(m_phimc);
709
710 if (hasOneDigitInROI) {
711 NtrackHit++;
712 if (m_pTmc > 1) TrackOneDigiIn[5]++;
713 if (m_pTmc <= 1 && m_pTmc > 0.5) TrackOneDigiIn[4]++;
714 if (m_pTmc <= 0.5 && m_pTmc > 0.3) TrackOneDigiIn[3]++;
715 if (m_pTmc <= 0.3 && m_pTmc > 0.2) TrackOneDigiIn[2]++;
716 if (m_pTmc <= 0.2 && m_pTmc > 0.1) TrackOneDigiIn[1]++;
717 if (m_pTmc <= 0.1) TrackOneDigiIn[0]++;
718
719 m_h1INtrack1_pt->Fill(m_pTmc);
723 } else if (part_outsideROI) { //CASO2
725 if (m_pTmc > 1) nnotINtrack2[5]++;
726 if (m_pTmc <= 1 && m_pTmc > 0.5) nnotINtrack2[4]++;
727 if (m_pTmc <= 0.5 && m_pTmc > 0.3) nnotINtrack2[3]++;
728 if (m_pTmc <= 0.3 && m_pTmc > 0.2) nnotINtrack2[2]++;
729 if (m_pTmc <= 0.2 && m_pTmc > 0.1) nnotINtrack2[1]++;
730 if (m_pTmc <= 0.1) nnotINtrack2[0]++;
731 } else if (part_noROI) { //CASO3
733 if (m_pTmc > 1) nnotINtrack3[5]++;
734 if (m_pTmc <= 1 && m_pTmc > 0.5) nnotINtrack3[4]++;
735 if (m_pTmc <= 0.5 && m_pTmc > 0.3) nnotINtrack3[3]++;
736 if (m_pTmc <= 0.3 && m_pTmc > 0.2) nnotINtrack3[2]++;
737 if (m_pTmc <= 0.2 && m_pTmc > 0.1) nnotINtrack3[1]++;
738 if (m_pTmc <= 0.1) nnotINtrack3[0]++;
739 } else if (part_wrongVxdID) { //CASO4
741 if (m_pTmc > 1) nnotINtrack4[5]++;
742 if (m_pTmc <= 1 && m_pTmc > 0.5) nnotINtrack4[4]++;
743 if (m_pTmc <= 0.5 && m_pTmc > 0.3) nnotINtrack4[3]++;
744 if (m_pTmc <= 0.3 && m_pTmc > 0.2) nnotINtrack4[2]++;
745 if (m_pTmc <= 0.2 && m_pTmc > 0.1) nnotINtrack4[1]++;
746 if (m_pTmc <= 0.1) nnotINtrack4[0]++;
747 } else if (part_noInter) { //CASO5
749 if (m_pTmc > 1) nnotINtrack5[5]++;
750 if (m_pTmc <= 1 && m_pTmc > 0.5) nnotINtrack5[4]++;
751 if (m_pTmc <= 0.5 && m_pTmc > 0.3) nnotINtrack5[3]++;
752 if (m_pTmc <= 0.3 && m_pTmc > 0.2) nnotINtrack5[2]++;
753 if (m_pTmc <= 0.2 && m_pTmc > 0.1) nnotINtrack5[1]++;
754 if (m_pTmc <= 0.1) nnotINtrack5[0]++;
755
756 n_NoInterceptTracks++;
761 }
762
763 } // close loop on MCParticlet
764
765
766 m_h1notINtrack5->Fill(n_NoInterceptTracks);
767 m_h1Track->Fill(Ntrack);
768 m_h1INtrack1->Fill(NtrackHit);
769
772
773 m_rootEvent++;
774 if ((m_ROIs.getEntries() > 0) && m_isSimulation) {
775 B2RESULT(" o SVDROIFinder ANALYSIS: tot ROIs = " << m_ROIs.getEntries() << ", ok ROIs = " << nROIs);
776 B2RESULT(" o : NtrackHit/Ntrack = " << NtrackHit << "/ " << Ntrack << " = " <<
777 (double)NtrackHit / Ntrack);
778 for (int i = 0; i < m_ROIs.getEntries(); i++) {
779 VxdID sensor = m_ROIs[i]->getSensorID();
780 B2RESULT(i << " ROI " << sensor.getLadderNumber() << "." << sensor.getLayerNumber() << "." << sensor.getSensorNumber() <<
781 ": " << m_ROIs[i]->getMinUid() << ", " << m_ROIs[i]->getMinVid() << ", " << m_ROIs[i]->getMaxUid() << ", " <<
782 m_ROIs[i]->getMaxVid());
783 }
784 }
785 if (nROIs > m_ROIs.getEntries()) B2RESULT(" HOUSTON WE HAVE A PROBLEM!");
786
787 m_h1okROIs->Fill(nROIs);
788 n_OKrois += nROIs;
789}
790
791
793{
794}
795
796
798{
799
800 Double_t epsilon[6];
801 Double_t epsilonErr[6];
802 double epsilonTot = (double)n_svdDigitInROI / (double) n_svdDigit;
803 Double_t epsilon2[6];
804 Double_t epsilon2Err[6];
805 double epsilon2Tot = (double)n_tracksWithDigitsInROI / (double) n_tracksWithDigits;
806
807 for (int i = 0; i < 6; i++) {
808 m_h1digiOut2->SetBinContent(i + 1, nnotINdigit2[i]);
809 m_h1digiOut3->SetBinContent(i + 1, nnotINdigit3[i]);
810 m_h1digiOut4->SetBinContent(i + 1, nnotINdigit4[i]);
811 m_h1digiOut5->SetBinContent(i + 1, nnotINdigit5[i]);
812 m_h1digiIn->SetBinContent(i + 1, nsvdDigitInROI[i]);
813 }
814
815 for (int i = 0; i < 6; i++) {
816 m_h1nnotINtrack2->SetBinContent(i + 1, nnotINtrack2[i]);
817 m_h1nnotINtrack3->SetBinContent(i + 1, nnotINtrack3[i]);
818 m_h1nnotINtrack4->SetBinContent(i + 1, nnotINtrack4[i]);
819 m_h1nnotINtrack5->SetBinContent(i + 1, nnotINtrack5[i]);
820 m_h1TrackOneDigiIn->SetBinContent(i + 1, TrackOneDigiIn[i]);
821 }
822
823 B2RESULT(" ROI Analysis Summary ");
824 B2RESULT("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
825 B2RESULT("");
826 B2RESULT(" number of tracks = " << n_tracks);
827 B2RESULT(" number of Intercepts = " << n_intercepts);
828 B2RESULT(" number of ROIs = " << n_rois);
829 if (m_isSimulation)
830 B2RESULT(" number of GOOD ROIs = " << n_OKrois);
831 // B2RESULT("");
832 B2RESULT(" average number of ROIs = " << m_h1totROIs->GetMean());
833 if (m_isSimulation) {
834 B2RESULT(" average number of ROIs w digits = " << m_h1okROIs->GetMean());
835 B2RESULT("");
836 B2RESULT("");
837 B2RESULT("tracks w digits: " << n_tracksWithDigits);
838 B2RESULT("tracks w digits in ROI: " << n_tracksWithDigitsInROI);
839
840 B2RESULT("efficiency PTD : " << epsilon2Tot << " +/- " << sqrt(epsilon2Tot * (1 - epsilon2Tot) / n_tracksWithDigits));
841
842 Int_t totTrackOneDigiIn = 0; //not used for the moment, added to double check
843 Int_t totnnotINtrack2 = 0;
844 Int_t totnnotINtrack3 = 0;
845 Int_t totnnotINtrack4 = 0;
846 Int_t totnnotINtrack5 = 0;
847
848 Int_t totTrack[6];
849
850 for (int j = 0; j < m_h1TrackOneDigiIn->GetNbinsX(); j++) {
851 totTrackOneDigiIn = totTrackOneDigiIn + m_h1TrackOneDigiIn->GetBinContent(j + 1);
852 totnnotINtrack2 = totnnotINtrack2 + m_h1nnotINtrack2->GetBinContent(j + 1);
853 totnnotINtrack3 = totnnotINtrack3 + m_h1nnotINtrack3->GetBinContent(j + 1);
854 totnnotINtrack4 = totnnotINtrack4 + m_h1nnotINtrack4->GetBinContent(j + 1);
855 totnnotINtrack5 = totnnotINtrack5 + m_h1nnotINtrack5->GetBinContent(j + 1);
856
857 totTrack[j] = m_h1nnotINtrack5->GetBinContent(j + 1) + m_h1nnotINtrack4->GetBinContent(j + 1) + m_h1nnotINtrack3->GetBinContent(
858 j + 1) + m_h1nnotINtrack2->GetBinContent(j + 1) + m_h1TrackOneDigiIn->GetBinContent(j + 1);
859 }
860
861 B2RESULT(" out ROI = " << totnnotINtrack2);
862 B2RESULT(" no ROI = " << totnnotINtrack3);
863 B2RESULT(" wrongVxdID = " << totnnotINtrack4);
864 B2RESULT(" no Inter = " << totnnotINtrack5);
865 B2RESULT("");
866
867 B2RESULT(" svdDigit : " << n_svdDigit);
868 B2RESULT(" svdDigitIn : " << n_svdDigitInROI);
869
870 B2RESULT(" eff DGT: " << epsilonTot << " +/- " << sqrt(epsilonTot * (1 - epsilonTot) / n_svdDigit));
871 B2RESULT(" inefficiency (SVDShaperDigits): ");
872 B2RESULT(" out ROI: " << n_notINdigit2);
873 B2RESULT(" no ROI: " << n_notINdigit3);
874 B2RESULT(" wrongVxdID: " << n_notINdigit4);
875 B2RESULT(" noInter: " << n_notINdigit5);
876 B2RESULT("");
877
878
879 B2RESULT(" pT > 1 : " << pt[5]);
880 B2RESULT(" out ROI: " << nnotINdigit2[5]);
881 B2RESULT(" no ROI: " << nnotINdigit3[5]);
882 B2RESULT(" wrongVxdID: " << nnotINdigit4[5]);
883 B2RESULT(" noInter: " << nnotINdigit5[5]);
884 B2RESULT(" svdDigit : " << nsvdDigit[5]);
885 B2RESULT(" svdDigitIn : " << nsvdDigitInROI[5]);
886 if ((nsvdDigit[5] - nsvdDigitInROI[5]) != (nnotINdigit2[5] + nnotINdigit3[5] + nnotINdigit4[5] + nnotINdigit5[5]))
887 B2RESULT(" svdDigitOut : " << nsvdDigit[5] - nsvdDigitInROI[5] << " != " << nnotINdigit2[5] + nnotINdigit3[5] + nnotINdigit4[5] +
888 nnotINdigit5[5]);
889 epsilon[5] = (double)nsvdDigitInROI[5] / (double) nsvdDigit[5];
890 epsilonErr[5] = sqrt(epsilon[5] * (1 - epsilon[5]) / nsvdDigit[5]);
891 B2RESULT(" efficiency : " << epsilon[5] << " +/- " << epsilonErr[5]);
892 epsilon2[5] = (double)TrackOneDigiIn[5] / (double) totTrack[5] ;
893 epsilon2Err[5] = sqrt(epsilon2[5] * (1 - epsilon2[5]) / totTrack[5]);
894 B2RESULT(" efficiency2 : " << epsilon2[5] << " +/- " << epsilon2Err[5]);
895 B2RESULT("");
896
897 B2RESULT(" 0.5 < pT < 1 : " << pt[4]);
898 B2RESULT(" out ROI: " << nnotINdigit2[4]);
899 B2RESULT(" no ROI: " << nnotINdigit3[4]);
900 B2RESULT(" wrongVxdID: " << nnotINdigit4[4]);
901 B2RESULT(" noInter: " << nnotINdigit5[4]);
902 B2RESULT(" svdDigit : " << nsvdDigit[4]);
903 B2RESULT(" svdDigitIn : " << nsvdDigitInROI[4]);
904 if ((nsvdDigit[4] - nsvdDigitInROI[4]) != (nnotINdigit2[4] + nnotINdigit3[4] + nnotINdigit4[4] + nnotINdigit5[4]))
905 B2RESULT(" svdDigitOut : " << nsvdDigit[4] - nsvdDigitInROI[4] << " != " << nnotINdigit2[4] + nnotINdigit3[4] + nnotINdigit4[4] +
906 nnotINdigit5[4]);
907 epsilon[4] = (double)nsvdDigitInROI[4] / (double) nsvdDigit[4];
908 epsilonErr[4] = sqrt(epsilon[4] * (1 - epsilon[4]) / nsvdDigit[4]);
909 B2RESULT(" efficiency : " << epsilon[4] << " +/- " << epsilonErr[4]);
910 epsilon2[4] = (double)TrackOneDigiIn[4] / (double) totTrack[4] ;
911 epsilon2Err[4] = sqrt(epsilon2[4] * (1 - epsilon2[4]) / totTrack[4]);
912 B2RESULT(" efficiency2 : " << epsilon2[4] << " +/- " << epsilon2Err[4]);
913
914 B2RESULT("");
915 B2RESULT(" 0.3 < pT < 0.5 : " << pt[3]);
916 B2RESULT(" out ROI: " << nnotINdigit2[3]);
917 B2RESULT(" no ROI: " << nnotINdigit3[3]);
918 B2RESULT(" wrongVxdID: " << nnotINdigit4[3]);
919 B2RESULT(" noInter: " << nnotINdigit5[3]);
920 B2RESULT(" svdDigit : " << nsvdDigit[3]);
921 B2RESULT(" svdDigitIn : " << nsvdDigitInROI[3]);
922 if ((nsvdDigit[3] - nsvdDigitInROI[3]) != (nnotINdigit2[3] + nnotINdigit3[3] + nnotINdigit4[3] + nnotINdigit5[3]))
923 B2RESULT(" svdDigitOut : " << nsvdDigit[3] - nsvdDigitInROI[3] << " != " << nnotINdigit2[3] + nnotINdigit3[3] + nnotINdigit4[3] +
924 nnotINdigit5[3]);
925 epsilon[3] = (double)nsvdDigitInROI[3] / (double) nsvdDigit[3];
926 epsilonErr[3] = sqrt(epsilon[3] * (1 - epsilon[3]) / nsvdDigit[3]);
927 B2RESULT(" efficiency : " << epsilon[3] << " +/- " << epsilonErr[3]);
928 epsilon2[3] = (double)TrackOneDigiIn[3] / (double) totTrack[3];
929 epsilon2Err[3] = sqrt(epsilon2[3] * (1 - epsilon2[3]) / totTrack[3]);
930 B2RESULT(" efficiency2 : " << epsilon2[3] << " +/- " << epsilon2Err[3]);
931
932 B2RESULT("");
933 B2RESULT(" 0.2 < pT < 0.3 : " << pt[2]);
934 B2RESULT(" out ROI: " << nnotINdigit2[2]);
935 B2RESULT(" no ROI: " << nnotINdigit3[2]);
936 B2RESULT(" wrongVxdID: " << nnotINdigit4[2]);
937 B2RESULT(" noInter: " << nnotINdigit5[2]);
938 B2RESULT(" svdDigit : " << nsvdDigit[2]);
939 B2RESULT(" svdDigitIn : " << nsvdDigitInROI[2]);
940 if ((nsvdDigit[2] - nsvdDigitInROI[2]) != (nnotINdigit2[2] + nnotINdigit3[2] + nnotINdigit4[2] + nnotINdigit5[2]))
941 B2RESULT(" svdDigitOut : " << nsvdDigit[2] - nsvdDigitInROI[2] << " != " << nnotINdigit2[2] + nnotINdigit3[2] + nnotINdigit4[2] +
942 nnotINdigit5[2]);
943 epsilon[2] = (double)nsvdDigitInROI[2] / (double) nsvdDigit[2];
944 epsilonErr[2] = sqrt(epsilon[2] * (1 - epsilon[2]) / nsvdDigit[2]);
945 B2RESULT(" efficiency : " << epsilon[2] << " +/- " << epsilonErr[2]);
946 epsilon2[2] = (double)TrackOneDigiIn[2] / (double) totTrack[2] ;
947 epsilon2Err[2] = sqrt(epsilon2[2] * (1 - epsilon2[2]) / totTrack[2]);
948 B2RESULT(" efficiency2 : " << epsilon2[2] << " +/- " << epsilon2Err[2]);
949
950 B2RESULT("");
951 B2RESULT(" 0.1 < pT < 0.2 : " << pt[1]);
952 B2RESULT(" out ROI: " << nnotINdigit2[1]);
953 B2RESULT(" no ROI: " << nnotINdigit3[1]);
954 B2RESULT(" wrongVxdID: " << nnotINdigit4[1]);
955 B2RESULT(" noInter: " << nnotINdigit5[1]);
956 B2RESULT(" svdDigit : " << nsvdDigit[1]);
957 B2RESULT(" svdDigitIn : " << nsvdDigitInROI[1]);
958 if ((nsvdDigit[1] - nsvdDigitInROI[1]) != (nnotINdigit2[1] + nnotINdigit3[1] + nnotINdigit4[1] + nnotINdigit5[1]))
959 B2RESULT(" svdDigitOut : " << nsvdDigit[1] - nsvdDigitInROI[1] << " ?=? " << nnotINdigit2[1] + nnotINdigit3[1] + nnotINdigit4[1] +
960 nnotINdigit5[1]);
961 epsilon[1] = (double)nsvdDigitInROI[1] / (double) nsvdDigit[1];
962 epsilonErr[1] = sqrt(epsilon[1] * (1 - epsilon[1]) / nsvdDigit[1]);
963 B2RESULT(" efficiency : " << epsilon[1] << " +/- " << epsilonErr[1]);
964 epsilon2[1] = (double)TrackOneDigiIn[1] / (double) totTrack[1] ;
965 epsilon2Err[1] = sqrt(epsilon2[1] * (1 - epsilon2[1]) / totTrack[1]);
966 B2RESULT(" efficiency2 : " << epsilon2[1] << " +/- " << epsilon2Err[1]);
967
968 B2RESULT("");
969 B2RESULT(" pT < 0.1 : " << pt[0]);
970 B2RESULT(" out ROI: " << nnotINdigit2[0]);
971 B2RESULT(" no ROI: " << nnotINdigit3[0]);
972 B2RESULT(" wrongVxdID: " << nnotINdigit4[0]);
973 B2RESULT(" noInter: " << nnotINdigit5[0]);
974 B2RESULT(" svdDigit : " << nsvdDigit[0]);
975 B2RESULT(" svdDigitIn : " << nsvdDigitInROI[0]);
976 if ((nsvdDigit[0] - nsvdDigitInROI[0]) != (nnotINdigit2[0] + nnotINdigit3[0] + nnotINdigit4[0] + nnotINdigit5[0]))
977 B2RESULT(" svdDigitOut : " << nsvdDigit[0] - nsvdDigitInROI[0] << " ?=? " << nnotINdigit2[0] + nnotINdigit3[0] + nnotINdigit4[0] +
978 nnotINdigit5[0]);
979 epsilon[0] = (double)nsvdDigitInROI[0] / (double) nsvdDigit[0];
980 epsilonErr[0] = sqrt(epsilon[0] * (1 - epsilon[0]) / nsvdDigit[0]);
981 B2RESULT(" efficiency : " << epsilon[0] << " +/- " << epsilonErr[0]);
982 epsilon2[0] = (double)TrackOneDigiIn[0] / (double) totTrack[0] ;
983 epsilon2Err[0] = sqrt(epsilon2[0] * (1 - epsilon2[0]) / totTrack[0]);
984 B2RESULT(" efficiency2 : " << epsilon2[0] << " +/- " << epsilon2Err[0]);
985
986 B2RESULT("legend:");
987 B2RESULT(" CASO2: if (ROI exists but no SVDShaperDigit inside)");
988 B2RESULT(" CASO3: if (ROI does not exist, intercept with correct VxdID)");
989 B2RESULT(" CASO4: if (intercept with wrong VxdID)");
990 B2RESULT(" CASO5: if (intercept does not exist)");
991
992 B2RESULT("==========================");
993 }
994 B2RESULT(" tot ROIs = " << n_rois);
995 B2RESULT(" ROIs with digits = " << m_nGoodROIs);
996 B2RESULT(" SVD INefficiency = " << 1 - (float)m_nGoodROIs / n_rois);
997
998 m_gEff2 = new TGraphErrors(6, pt, epsilon2, ptErr, epsilon2Err);
999 m_gEff2->SetName("g_eff2");
1000 m_gEff2->SetTitle("Normalized to MCParticles with digits and related track");
1001 m_gEff = new TGraphErrors(6, pt, epsilon, ptErr, epsilonErr);
1002 m_gEff->SetName("g_eff");
1003 m_gEff->SetTitle("Normalized to digits of MCParticles with digits and related track");
1004
1005
1006
1007 if (m_rootFilePtr != nullptr) {
1008 m_rootFilePtr->cd(); //important! without this the famework root I/O (SimpleOutput etc) could mix with the root I/O of this module
1009
1010 TDirectory* oldDir = gDirectory;
1011 TDirectory* m_digiDir = oldDir->mkdir("digits");
1012 TDirectory* m_tracksDir = oldDir->mkdir("tracks");
1013 TDirectory* m_notINtrack5 = oldDir->mkdir("notINtrack5");
1014 TDirectory* m_INtrack1 = oldDir->mkdir("INtrack1");
1015 TDirectory* m_alltracks = oldDir->mkdir("alltracks");
1016 TDirectory* m_in = oldDir->mkdir("digi_in");
1017 TDirectory* m_out2 = oldDir->mkdir("digi_out2");
1018 TDirectory* m_out3 = oldDir->mkdir("digi_out3");
1019 TDirectory* m_out4 = oldDir->mkdir("digi_out4");
1020 TDirectory* m_out5 = oldDir->mkdir("digi_out5");
1021 TDirectory* m_ROIDir = oldDir->mkdir("roi");
1022
1023 m_h1DigitsPerParticle->Write();
1025
1026 m_gEff->Write();
1027 m_gEff2->Write();
1028 m_h1effPerTrack->Write();
1029
1030
1031 m_digiDir->cd();
1032 m_h1digiIn->Write();
1033 m_h1digiOut2->Write();
1034 m_h1digiOut3->Write();
1035 m_h1digiOut4->Write();
1036 m_h1digiOut5->Write();
1037
1038 m_tracksDir->cd();
1039 m_h1TrackOneDigiIn->Write();
1040 m_h1nnotINtrack2->Write();
1041 m_h1nnotINtrack3->Write();
1042 m_h1nnotINtrack4->Write();
1043 m_h1nnotINtrack5->Write();
1044
1045 m_notINtrack5->cd();
1046 m_h1notINtrack5->Write();
1047 m_h1notINtrack5_pt->Write();
1048 m_h1notINtrack5_phi->Write();
1049 m_h1notINtrack5_lambda->Write();
1050 m_h1notINtrack5_cosTheta->Write();
1051
1052 m_INtrack1->cd();
1053 m_h1INtrack1->Write();
1054 m_h1INtrack1_pt->Write();
1055 m_h1INtrack1_phi->Write();
1056 m_h1INtrack1_lambda->Write();
1057 m_h1INtrack1_cosTheta->Write();
1058
1059 m_alltracks->cd();
1060 m_h1Track->Write();
1061 m_h1Track_pt->Write();
1062 m_h1Track_phi->Write();
1063 m_h1Track_lambda->Write();
1064 m_h1Track_cosTheta->Write();
1065
1066 m_in->cd();
1067 m_h1GlobalTime->Write();
1068 m_h1PullU->Write();
1069 m_h1PullV->Write();
1070 m_h1ResidU->Write();
1071 m_h1ResidV->Write();
1072 m_h1SigmaU->Write();
1073 m_h1SigmaV->Write();
1074 m_h2sigmaUphi->Write();
1075 m_h2sigmaVphi->Write();
1076
1077 m_out2->cd();
1078 m_h1GlobalTime_out2->Write();
1079 m_h1ResidU_out2->Write();
1080 m_h1ResidV_out2->Write();
1081 m_h1SigmaU_out2->Write();
1082 m_h1SigmaV_out2->Write();
1083 m_h2sigmaUphi_out2->Write();
1084 m_h2sigmaVphi_out2->Write();
1085
1086 m_out3->cd();
1087 m_h1GlobalTime_out3->Write();
1088 m_h1ResidU_out3->Write();
1089 m_h1ResidV_out3->Write();
1090 m_h1SigmaU_out3->Write();
1091 m_h1SigmaV_out3->Write();
1092 m_h2sigmaUphi_out3->Write();
1093 m_h2sigmaVphi_out3->Write();
1094
1095 m_out4->cd();
1096 m_h1GlobalTime_out4->Write();
1097 m_h1SigmaU_out4->Write();
1098 m_h1SigmaV_out4->Write();
1099 m_h2sigmaUphi_out4->Write();
1100 m_h2sigmaVphi_out4->Write();
1101
1102 m_out5->cd();
1103 m_h1GlobalTime_out5->Write();
1104
1105 m_ROIDir->cd();
1106 m_h1totUstrips->Write();
1107 m_h1totVstrips->Write();
1108 m_h1okROIs->Write();
1109 m_h1totROIs->Write();
1110
1111
1112 m_h2ROIbottomLeft->Write();
1113 m_h2ROItopRight->Write();
1114 m_h2ROIuMinMax->Write();
1115 m_h2ROIvMinMax->Write();
1116 m_rootFilePtr->Close();
1117
1118 }
1119
1120}
1121
static std::string relationName(const std::string &fromName, const std::string &toName, std::string const &namedRelation="")
Return storage name for a relation between two arrays of the given names.
Definition: DataStore.h:180
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
ROOT::Math::XYZVector getMomentum() const
Return momentum.
Definition: MCParticle.h:198
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
ROIid stores the U and V ids and the sensor id of the Region Of Interest.
Definition: ROIid.h:25
bool Contains(const PXDRawHit &thePXDRawHit) const
true if the ROI contains the thePXDRawHit
Definition: ROIid.cc:25
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
index_from::const_iterator iterator_from
Element iterator of the from side index.
Definition: RelationIndex.h:95
range_from getElementsFrom(const FROM *from) const
Return a range of all elements pointing from the given object.
boost::iterator_range< iterator_from > range_from
Iterator range [first,second) of the from side.
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
RelationVector< FROM > getRelationsFrom(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from another store array to this object.
RelationVector< T > getRelationsWith(const std::string &name="", const std::string &namedRelation="") const
Get the relations between this object and another store array.
SVDIntercept stores the U,V coordinates and uncertainties of the intersection of a track with an SVD ...
Definition: SVDIntercept.h:22
unsigned int nnotINtrack3[6]
tracks, inefficiency #3, in pT bins
TH1F * m_h1SigmaU_out4
distribution of sigmaU for SVDShaperDigits not contained in a ROI
TH1F * m_h1GlobalTime_out3
distribution of global time for PDXDigits not contained in a ROI
TH1F * m_h1GlobalTime_out4
distribution of global time for PDXDigits not contained in a ROI
TH1F * m_h1notINtrack5_nCDChits
denominator track pVal
unsigned int nsvdDigit[6]
number of svd digits in bins of pt
TH1F * m_h1ResidU_out2
distribution of U resid for SVDShaperDigits not contained in a ROI
TH1F * m_h1INtrack1
track with no intercept
TH1F * m_h1nnotINtrack2
tracks with lost digit: ROI exist with right vxdID
TH2F * m_h2sigmaVphi_out2
distribution of sigmaV VS phi for PDXDigits not contained in a ROI
TH1F * m_h1SigmaV_out4
distribution of sigmaV for SVDShaperDigits not contained in a ROI
TH1F * m_h1ResidV
distribution of V resid for SVDShaperDigits contained in a ROI
TH1F * m_h1nnotINtrack3
lost digit: ROI exist with wrong vxdID
TH1F * m_h1nnotINtrack5
lost digit: ROI does not exist, intercept with wrong vxdID
TH1F * m_h1nnotINtrack4
lost digit: ROI does not exist, intercept with right vxdID
unsigned int n_notINdigit2
number of lost digits: no hit, correct vxdID
Double_t ptErr[6]
bin widths (transverse momentum)
unsigned int n_notINtrack4
nuner of tracks with no ROI (intercept with correct vxdID)
unsigned int n_intercepts
number of intercepts
TH1F * m_h1INtrack1_nCDChits
denominator track pVal
std::string m_recoTrackListName
Track list name.
TH1F * m_h1INtrack1_pt
track with no intercept pT
bool m_writeToRoot
if true, a rootFile named by m_rootFileName will be filled with info
TH1F * m_h1INtrack1_lambda
track with no intercept lambda
TH1F * m_h1SigmaV_out3
distribution of sigmaV for SVDShaperDigits not contained in a ROI
unsigned int nnotINtrack2[6]
tracks, inefficiency #2, in pT bins
TH1F * m_h1INtrack1_phi
track with no intercept phi
TH1F * m_h1PullV
distribution of V pulls for PDXDigits contained in a ROI
StoreArray< SVDIntercept > m_SVDIntercepts
svd intercept store array
void initialize() override
Initializes the Module.
TH1F * m_h1ResidV_out2
distribution of V resid for SVDShaperDigits not contained in a ROI
TH1F * m_h1Track_pVal
denominator track pVal
TH1F * m_h1PullU
distribution of U pulls for PDXDigits contained in a ROI
TH1F * m_h1okROIs
distribution of number of ROIs containin a SVDShaperDigit
TH1F * m_h1Track_cosTheta
denominator track cosTheta
TH1F * m_h1INtrack1_nSVDhits
denominator track pVal
unsigned int nnotINdigit3[6]
number of lost digits in bins of pt: no hit, wrong vxdID
unsigned int nnotINtrack4[6]
tracks, inefficiency #4, in pT bins
StoreArray< SVDShaperDigit > m_shapers
shaper digits sotre array
unsigned int n_notINtrack2
nuner of tracks with no digits in ROI (correct vxdID)
TH1F * m_h1notINtrack5_phi
track with no intercept phi
unsigned int n_notINdigit3
number of lost digits: no hit, wrong vxdID
TH1F * m_h1Track_nCDChits
denominator track pVal
TH1F * m_h1digiOut5
lost digit: ROI does not exist, intercept with wrong vxdID
TH1F * m_h1Track_lambda
denominator track lambda
unsigned int nnotINdigit4[6]
number of lost digits in bins of pt: no ROI, intercepts with correct vxdID
unsigned int nnotINdigit2[6]
number of lost digits in bins of pt: no hit, correct vxdID
StoreArray< RecoTrack > m_trackList
reco track store array
TH1F * m_h1notINtrack5_lambda
track with no intercept lambda
std::string m_SVDInterceptListName
Intercept list name.
TGraphErrors * m_gEff2
efficiency graph
void endRun() override
Executed at the end of the run.
TH1F * m_h1totROIs
distribution of number of all ROIs
TH1F * m_h1TrackOneDigiIn
tracks with at least digit contained in ROI
TH2F * m_h2sigmaUphi_out2
distribution of sigmaU VS phi for PDXDigits not contained in a ROI
void terminate() override
Termination action.
TH1F * m_h1ResidU_out3
distribution of U resid for SVDShaperDigits not contained in a ROI
unsigned int n_svdDigit
number of svd digits
TH1F * m_h1digiOut4
lost digit: ROI does not exist, intercept with right vxdID
unsigned int nnotINtrack5[6]
tracks, inefficiency #5, in pT bins
unsigned int n_notINdigit5
number of lost digits: no ROI, intercepts with wrong vxdID
TH1F * m_h1GlobalTime
distribution of global time for PDXDigits contained in a ROI
TH2F * m_h2ROItopRight
top right corner coordinates
SVDROIFinderAnalysisModule()
Constructor of the module.
unsigned int nsvdDigitInROI[6]
number of svd digits inside ROI in bins of pt
unsigned int NtrackHit
nuner of tracks with hits
TH1F * m_h1SigmaU_out2
distribution of sigmaU for SVDShaperDigits not contained in a ROI
TH1F * m_h1notINtrack5_pVal
denominator track pVal
TH1F * m_h1SigmaV
distribution of sigmaV for SVDShaperDigits contained in a ROI
TH1F * m_h1digiOut2
lost digit: ROI exist with right vxdID
TH1F * m_h1GlobalTime_out2
distribution of global time for PDXDigits not contained in a ROI
TH1F * m_h1INtrack1_cosTheta
track with no intercept costheta
unsigned int n_tracksWithDigitsInROI
number of tracks with digits in ROI
~SVDROIFinderAnalysisModule()
Destructor of the module.
TH2F * m_h2sigmaUphi_out4
distribution of sigmaU VS phi for PDXDigits not contained in a ROI
TH1F * m_h1RecoTracksPerParticle
number of reco tracks per particle
TH1F * m_h1SigmaU
distribution of sigmaU for SVDShaperDigits contained in a ROI
TH1F * m_h1GlobalTime_out5
distribution of global time for PDXDigits not contained in a ROI
unsigned int Ntrack
nuner of tracks with svd digits
unsigned int n_notINtrack5
nuner of tracks with no ROI (intercept with wrong vxdID)
TH1F * m_h1ResidV_out3
distribution of V resid for SVDShaperDigits not contained in a ROI
unsigned int nnotINdigit5[6]
number of lost digits in bins of pt: no ROI, intercepts with wrong vxdID
unsigned int n_tracksWithDigits
number of tracks with digits
TH1F * m_h1Track_nSVDhits
denominator track pVal
unsigned int n_notINdigit4
number of lost digits: no ROI, intercepts with correct vxdID
TH1F * m_h1ResidU
distribution of U resid for SVDShaperDigits contained in a ROI
void beginRun() override
Initializations at the begin of the run.
TH1F * m_h1notINtrack5_nSVDhits
denominator track pVal
double m_lambdamc
true lambda = pi/2 - theta
TH1F * m_h1INtrack1_pVal
denominator track pVal
TH2F * m_h2sigmaVphi_out3
distribution of sigmaV VS phi for PDXDigits not contained in a ROI
TH1F * m_h1notINtrack5_pt
track with no intercept pT
TH2F * m_h2sigmaVphi_out4
distribution of sigmaV VS phi for PDXDigits not contained in a ROI
unsigned int n_OKrois
good rois (simulation)
Double_t pt[6]
bin edges (in pt = transverse momentum)
unsigned int n_svdDigitInROI
number of svd digits in ROIs
bool m_isSimulation
true if the module is run on simulated events
TH1F * m_h1notINtrack5
track with no intercept
TH2F * m_h2sigmaUphi
distribution of sigmaU VS phi for PDXDigits contained in a ROI
TH2F * m_h2ROIbottomLeft
bottom left corner coordinates
TH1F * m_h1digiIn
digits contained in ROI histogram
TH2F * m_h2ROIvMinMax
min VS max of the V coordinate
TH1F * m_h1totUstrips
distribution of number of u strips of all ROIs
TH1F * m_h1SigmaV_out2
distribution of sigmaV for SVDShaperDigits not contained in a ROI
TH1F * m_h1DigitsPerParticle
number of digits per particle
std::string m_shapersName
SVDShaperDigits name.
StoreArray< MCParticle > m_mcParticles
mc particle store array
TH1F * m_h1totVstrips
distribution of number of v strips of all ROIs
TH2F * m_h2sigmaVphi
distribution of sigmaV VS phi for PDXDigits contained in a ROI
TH2F * m_h2sigmaUphi_out3
distribution of sigmaU VS phi for PDXDigits not contained in a ROI
TFile * m_rootFilePtr
pointer at root file used for storing infos for debugging and validating purposes
unsigned int TrackOneDigiIn[6]
tracks with one digit in, in pT bins
TH2F * m_h2ROIuMinMax
min VS max of the U coordinate
double m_coormc
true intercept coordinate
unsigned int n_notINtrack3
nuner of tracks with no digits in ROI (wrong vxdID)
TH1F * m_h1SigmaU_out3
distribution of sigmaU for SVDShaperDigits not contained in a ROI
TH1F * m_h1digiOut3
lost digit: ROI exist with wrong vxdID
StoreArray< ROIid > m_ROIs
rois store array
TH1F * m_h1notINtrack5_cosTheta
track with no intercept costheta
The SVD ShaperDigit class.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
double getSigmaV() const
return the statistical error on the V coordinate of the intercept
Definition: VXDIntercept.h:62
double getCoorV() const
return the V coordinate of the intercept
Definition: VXDIntercept.h:60
double getSigmaU() const
return the statistical error on the U coordinate of the intercept
Definition: VXDIntercept.h:61
VxdID::baseType getSensorID() const
return the sensor ID
Definition: VXDIntercept.h:68
double getCoorU() const
return the U coordinate of the intercept
Definition: VXDIntercept.h:59
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
Definition: GeoCache.h:39
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:67
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
Base class to provide Sensor Information for PXD and SVD.
double getVCellPosition(int vID) const
Return the position of a specific strip/pixel in v direction.
double getUCellPosition(int uID, int vID=-1) const
Return the position of a specific strip/pixel in u direction.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.