Belle II Software  release-08-01-10
SVDPerformanceModule.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 #include <svd/modules/svdPerformance/SVDPerformanceModule.h>
9 #include <framework/datastore/StoreObjPtr.h>
10 #include <framework/datastore/RelationVector.h>
11 #include <time.h>
12 #include <mdst/dataobjects/MCParticle.h>
13 #include <mdst/dataobjects/HitPatternVXD.h>
14 #include <svd/dataobjects/SVDTrueHit.h>
15 
16 #include <boost/foreach.hpp>
17 
18 using namespace std;
19 using namespace Belle2;
20 
21 REG_MODULE(SVDPerformance);
22 
23 SVDPerformanceModule::SVDPerformanceModule() : Module()
24  , m_nTracks(0), m_Pvalue(), m_mom(0), m_nSVDhits(0)
25 {
26 
27  setDescription("This module check performances of SVD reconstruction of VXD TB data");
28 
29  addParam("outputFileName", m_rootFileName, "Name of output root file.", std::string("SVDPerformance_output.root"));
30  addParam("SVDEventInfo", m_svdEventInfoName, "Defines the name of the EventInfo", string(""));
31 
32  addParam("is2017TBanalysis", m_is2017TBanalysis, "True if analyzing 2017 TB data.", bool(false));
33  addParam("isSimulation", m_isSimulation, "True if analyzing simulated data.", bool(false));
34 
35  addParam("debugLowTime", m_debugLowTime, "Cluster Time below this number will produce a printout.", float(0.));
36 
37  addParam("ShaperDigitsName", m_ShaperDigitName, "Name of ShaperDigit Store Array.", std::string(""));
38  addParam("RecoDigitsName", m_RecoDigitName, "Name of RecoDigit Store Array.", std::string(""));
39  addParam("ClustersName", m_ClusterName, "Name of Cluster Store Array.", std::string(""));
40  addParam("TrackListName", m_TrackName, "Name of Track Store Array.", std::string(""));
41  addParam("TrackFitResultListName", m_TrackFitResultName, "Name of TracksFitResult Store Array.", std::string(""));
42 }
43 
44 
46 {
47 
48  m_svdShapers.isRequired(m_ShaperDigitName);
49  m_svdRecos.isOptional(m_RecoDigitName);
51  // m_Tracks.isRequired(m_TrackName);
52  // m_recoTracks.isRequired();
53  // m_tfr.isRequired(m_TrackFitResultName);
54 
55  if (!m_storeSVDEvtInfo.isOptional(m_svdEventInfoName)) m_svdEventInfoName = "SVDEventInfoSim";
57 
58  B2INFO(" ShaperDigits: " << m_ShaperDigitName);
59  B2INFO(" RecoDigits: " << m_RecoDigitName);
60  B2INFO(" Clusters: " << m_ClusterName);
61  B2INFO(" Tracks: " << m_TrackName);
62  B2INFO(" TrackFitResults: " << m_TrackFitResultName);
63 
64 
65  //create list of histograms to be saved in the rootfile
66  m_histoList_track = new TList;
67  m_histoList_corr = new TList;
68 
69  for (int i = 0; i < m_nLayers; i++) {
70  m_histoList_cluster[i] = new TList;
71  m_histoList_clTRK[i] = new TList;
72  m_histoList_reco[i] = new TList;
73  m_histoList_shaper[i] = new TList;
74  }
75 
76  m_rootFilePtr = new TFile(m_rootFileName.c_str(), "RECREATE");
77 
78  for (int s = 0; s < m_nLayers; s++)
80  sensorsOnLayer[s] = 2;
81  else
82  sensorsOnLayer[s] = s + 2;
83 
84  //create histograms
85  for (int i = 0; i < m_nLayers; i ++) //loop on Layers
86  for (int j = 0; j < (int)sensorsOnLayer[i]; j ++) { //loop on Sensors
87 
88  TString nameLayer = "";
89  nameLayer += i + 3;
90 
91  TString nameSensor = "";
92  if (m_is2017TBanalysis) {
93  if (i == 0)
94  nameSensor += j + 1;
95  else if (i == 1 || i == 2)
96  nameSensor += j + 2;
97  else if (i == 3)
98  nameSensor += j + 3;
99  } else
100  nameSensor += j + 1;
101 
102  for (int k = 0; k < m_nSides; k ++) { //loop on Sides
103 
104 
105  TString nameSide = "";
106  if (k == 1)
107  nameSide = "U";
108  else if (k == 0)
109  nameSide = "V";
110 
111  //SHAPER DIGITS
112  TString NameOfHisto = "shaper_N_L" + nameLayer + "S" + nameSensor + "" + nameSide;
113  TString TitleOfHisto = "number of ShaperDigits (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
114  h_nShaper[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 100, 0, 100, "n ShaperDigits", m_histoList_shaper[i]);
115 
116 
117  //RECO DIGITS
118  NameOfHisto = "reco_N_L" + nameLayer + "S" + nameSensor + "" + nameSide;
119  TitleOfHisto = "number of RecoDigits (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
120  h_nReco[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 100, 0, 100, "n RecoDigits", m_histoList_reco[i]);
121 
122  NameOfHisto = "reco_charge_L" + nameLayer + "S" + nameSensor + "" + nameSide;
123  TitleOfHisto = "charge of RecoDigits (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
124  h_recoCharge[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 100, 0, 100000, "charge (e-)", m_histoList_reco[i]);
125 
126  NameOfHisto = "reco_energy_L" + nameLayer + "S" + nameSensor + "" + nameSide;
127  TitleOfHisto = "energy collected by RecoDigits (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
128  h_recoEnergy[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 100, 0, 360, "energy (keV)", m_histoList_reco[i]);
129 
130  NameOfHisto = "reco_noise_L" + nameLayer + "S" + nameSensor + "" + nameSide;
131  TitleOfHisto = "strip noise (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
132  h_stripNoise[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 200, 300, 1800, "strip noise", m_histoList_reco[i]);
133 
134  NameOfHisto = "reco_time_L" + nameLayer + "S" + nameSensor + "" + nameSide;
135  TitleOfHisto = "strip time (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
136  h_recoTime[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 200, -100, 100, "strip time", m_histoList_reco[i]);
137 
138 
139  //CLUSTERS RELATED TO TRACKS
140  NameOfHisto = "clTRK_N_L" + nameLayer + "S" + nameSensor + "" + nameSide;
141  TitleOfHisto = "number of clusters related to Tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
142  h_nCltrk[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 50, 0, 50, "n clusters", m_histoList_clTRK[i]);
143 
144  NameOfHisto = "clTRK_size_L" + nameLayer + "S" + nameSensor + "" + nameSide;
145  TitleOfHisto = "cluster size (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
146  h_cltrkSize[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 15, 0, 15, "cluster size", m_histoList_clTRK[i]);
147 
148  NameOfHisto = "clTRK_charge_L" + nameLayer + "S" + nameSensor + "" + nameSide;
149  TitleOfHisto = "cluster Charge (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
150  h_cltrkCharge[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 500, 0, 100000, "charge(e-)", m_histoList_clTRK[i]);
151 
152  NameOfHisto = "clTRK_energy_L" + nameLayer + "S" + nameSensor + "" + nameSide;
153  TitleOfHisto = "cluster Energy (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
154  h_cltrkEnergy[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 360, 0, 360, "energy (keV)", m_histoList_clTRK[i]);
155 
156  NameOfHisto = "clTRK_SN_L" + nameLayer + "S" + nameSensor + "" + nameSide;
157  TitleOfHisto = "cluster S/N (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
158  h_cltrkSN[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 150, 0, 150, "S/N", m_histoList_clTRK[i]);
159 
160  NameOfHisto = "clTRK_chrgVSsize_L" + nameLayer + "S" + nameSensor + "" + nameSide;
161  TitleOfHisto = "cluster charge VS size (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
162  h_cltrkChargeVSSize[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 500, 0, 100000, "charge (e-)", 15, 0, 15, "cl size",
163  m_histoList_clTRK[i]);
164 
165  NameOfHisto = "clTRK_SNVSsize_L" + nameLayer + "S" + nameSensor + "" + nameSide;
166  TitleOfHisto = "cluster SN ratio VS size (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
167  h_cltrkSNVSSize[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 150, 0, 150, "S/N", 15, 0, 15, "cl size",
168  m_histoList_clTRK[i]);
169 
170  NameOfHisto = "clTRK_TimeVSsize_L" + nameLayer + "S" + nameSensor + "" + nameSide;
171  TitleOfHisto = "cluster time VS size (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
172  h_cltrkTimeVSSize[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 200, -100, 100, "cluster time (ns)", 15, 0, 15, "cl size",
173  m_histoList_clTRK[i]);
174 
175  NameOfHisto = "clTRK_time_L" + nameLayer + "S" + nameSensor + "" + nameSide;
176  TitleOfHisto = "cluster time (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
177  h_cltrkTime[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 200, -100, 100, "cluster time (ns)", m_histoList_clTRK[i]);
178 
179  NameOfHisto = "clTRK_timeTB1_L" + nameLayer + "S" + nameSensor + "" + nameSide;
180  TitleOfHisto = "cluster time - TB = 1 (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
181  h_cltrkTime_TB1[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 200, -100, 100, "cluster time (ns)", m_histoList_clTRK[i]);
182 
183  NameOfHisto = "clTRK_timeTB2_L" + nameLayer + "S" + nameSensor + "" + nameSide;
184  TitleOfHisto = "cluster time - TB = 2 (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
185  h_cltrkTime_TB2[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 200, -100, 100, "cluster time (ns)", m_histoList_clTRK[i]);
186 
187  NameOfHisto = "clTRK_timeTB3_L" + nameLayer + "S" + nameSensor + "" + nameSide;
188  TitleOfHisto = "cluster time - TB = 3 (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
189  h_cltrkTime_TB3[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 200, -100, 100, "cluster time (ns)", m_histoList_clTRK[i]);
190 
191  NameOfHisto = "clTRK_timeTB4_L" + nameLayer + "S" + nameSensor + "" + nameSide;
192  TitleOfHisto = "cluster time - TB = 4 (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
193  h_cltrkTime_TB4[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 200, -100, 100, "cluster time (ns)", m_histoList_clTRK[i]);
194 
195  if (m_isSimulation) {
196  NameOfHisto = "clTRK_timeVStrueTime_L" + nameLayer + "S" + nameSensor + "" + nameSide;
197  TitleOfHisto = "cluster time VS true hit time (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
198  h_cltrkTimeVSTrueTime[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 200, -100, 100, "cluster time", 60, -30, 30,
199  "true time", m_histoList_clTRK[i]);
200  }
201 
202  //1 STRIP CLUSTERS RELATED TO TRACKS
203  NameOfHisto = "1clTRK_charge_L" + nameLayer + "S" + nameSensor + "" + nameSide;
204  TitleOfHisto = "1-strip cluster Charge (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
205  h_1cltrkCharge[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 500, 0, 100000, "charge(e-)", m_histoList_clTRK[i]);
206 
207 
208  NameOfHisto = "1clTRK_SN_L" + nameLayer + "S" + nameSensor + "" + nameSide;
209  TitleOfHisto = "1-strip cluster S/N (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
210  h_1cltrkSN[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 150, 0, 150, "S/N", m_histoList_clTRK[i]);
211 
212  //2-STRIP CLUSTERS RELATED TO TRACKS
213  NameOfHisto = "2clTRK_charge_L" + nameLayer + "S" + nameSensor + "" + nameSide;
214  TitleOfHisto = "2-strip cluster Charge (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
215  h_2cltrkCharge[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 500, 0, 100000, "charge(e-)", m_histoList_clTRK[i]);
216 
217 
218  NameOfHisto = "2clTRK_SN_L" + nameLayer + "S" + nameSensor + "" + nameSide;
219  TitleOfHisto = "2-strip cluster S/N (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
220  h_2cltrkSN[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 150, 0, 150, "S/N", m_histoList_clTRK[i]);
221 
222  //CLUSTERS NOT RELATED TO TRACKS
223  NameOfHisto = "clNOtrk_N_L" + nameLayer + "S" + nameSensor + "" + nameSide;
224  TitleOfHisto = "number of clusters NOT related to Tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
225  h_nCl[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 50, 0, 50, "n clusters", m_histoList_cluster[i]);
226 
227  NameOfHisto = "clNOtrk_size_L" + nameLayer + "S" + nameSensor + "" + nameSide;
228  TitleOfHisto = "cluster size, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
229  h_clSize[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 15, 0, 15, "cluster size", m_histoList_cluster[i]);
230 
231  NameOfHisto = "clNOtrk_charge_L" + nameLayer + "S" + nameSensor + "" + nameSide;
232  TitleOfHisto = "cluster Charge, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
233  h_clCharge[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 500, 0, 100000, "charge (e-)", m_histoList_cluster[i]);
234 
235  NameOfHisto = "clNOtrk_energy_L" + nameLayer + "S" + nameSensor + "" + nameSide;
236  TitleOfHisto = "cluster Energy, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
237  h_clEnergy[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 360, 0, 360, "energy (keV)", m_histoList_cluster[i]);
238 
239  NameOfHisto = "clNOtrk_maxbin_L" + nameLayer + "S" + nameSensor + "" + nameSide;
240  TitleOfHisto = "cluster Seed maxbin, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
241  h_clSeedMaxbin[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 6, 0, 6, "max bin", m_histoList_cluster[i]);
242 
243  NameOfHisto = "clNOtrk_energyVSmaxbin_L" + nameLayer + "S" + nameSensor + "" + nameSide;
244  TitleOfHisto = "cluster Energy vs seed max bin U, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide +
245  " side)";
246  h_clEnergyVSMaxbin[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 360, 0, 360, "energy (keV)", 6, 0, 6, "seed max bin",
248 
249 
250  NameOfHisto = "clNOtrk_energyVSsizeMB12_L" + nameLayer + "S" + nameSensor + "" + nameSide;
251  TitleOfHisto = "cluster Energy vs Size, maxbin = 1,2 U, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," +
252  nameSide +
253  " side)";
254  h_clEnergyVSSize_mb12[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 360, 0, 360, "energy (keV)", 15, 0, 15, "cl size",
256 
257  NameOfHisto = "clNOtrk_energyVSsizeMB345_L" + nameLayer + "S" + nameSensor + "" + nameSide;
258  TitleOfHisto = "cluster Energy vs Size, maxbin = 3,4,5 U, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," +
259  nameSide +
260  " side)";
261  h_clEnergyVSSize_mb345[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 360, 0, 360, "energy (keV)", 15, 0, 15, "cl size",
263 
264  NameOfHisto = "clNOtrk_energyVSsizeMB6_L" + nameLayer + "S" + nameSensor + "" + nameSide;
265  TitleOfHisto = "cluster Energy vs Size, maxbin = 6 U, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," +
266  nameSide +
267  " side)";
268  h_clEnergyVSSize_mb6[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 360, 0, 360, "energy (keV)", 15, 0, 15, "cl size",
270 
271  if (k == 1) {
272  NameOfHisto = "clNOtrk_energyVScoorU_L" + nameLayer + "S" + nameSensor + "" + nameSide;
273  TitleOfHisto = "cluster Energy vs coor U, TB=3,4,5 NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide
274  +
275  " side)";
276  h_clEnergyVSCoorU[i][j][1] = createHistogram2D(NameOfHisto, TitleOfHisto, 360, 0, 360, "energy (keV)", 200, -3, 3, "coor U (cm)",
278 
279  NameOfHisto = "clNOtrk_coorU1VScoorU2_L" + nameLayer + "S" + nameSensor + "" + nameSide;
280  TitleOfHisto = "cluster coor1 U vs coor2 U, TB=3,4,5 NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," +
281  nameSide +
282  " side)";
283  h_clCoor1VSCoor2[i][j][1] = createHistogram1D(NameOfHisto, TitleOfHisto, 400, 0, 4, "delta U (cm)",
285 
286  NameOfHisto = "clNOtrk_cellIDU1VScellIDU2_L" + nameLayer + "S" + nameSensor + "" + nameSide;
287  TitleOfHisto = "cluster cellID1 U vs cellID2 U, TB=3,4,5 NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," +
288  nameSide +
289  " side)";
290  h_clCellID1VSCellID2[i][j][1] = createHistogram1D(NameOfHisto, TitleOfHisto, 768, 0, 768, "delta U (# of cells)",
292 
293  NameOfHisto = "clNOtrk_energy12VSdeltaU_L" + nameLayer + "S" + nameSensor + "" + nameSide;
294  TitleOfHisto = "cluster energy1+2 U vs delta U, TB=3,4,5 NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," +
295  nameSide +
296  " side)";
297  h_clEnergy12VSdelta[i][j][1] = createHistogram2D(NameOfHisto, TitleOfHisto, 360, 0, 360, "energy (keV)", 768, 0, 768,
298  "delta U (# of cells)",
300 
301  } else {
302  NameOfHisto = "clNOtrk_energyVScoorV_L" + nameLayer + "S" + nameSensor + "" + nameSide;
303  TitleOfHisto = "cluster Energy vs coor V, TB=3,4,5 NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide
304  +
305  " side)";
306  h_clEnergyVSCoorV[i][j][0] = createHistogram2D(NameOfHisto, TitleOfHisto, 360, 0, 360, "energy (keV)", 200, -6.5, 6.5,
307  "coor V (cm)", m_histoList_cluster[i]);
308 
309  NameOfHisto = "clNOtrk_coorV1VScoorV2_L" + nameLayer + "S" + nameSensor + "" + nameSide;
310  TitleOfHisto = "cluster coor1 V vs coor2 V, TB=3,4,5 NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," +
311  nameSide +
312  " side)";
313  h_clCoor1VSCoor2[i][j][0] = createHistogram1D(NameOfHisto, TitleOfHisto, 400, 0, 6, "delta V (cm)",
315  NameOfHisto = "clNOtrk_cellIDV1VScellIDV2_L" + nameLayer + "S" + nameSensor + "" + nameSide;
316  TitleOfHisto = "cluster cellID1 V vs cellID2 V, TB=3,4,5 NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," +
317  nameSide +
318  " side)";
319  h_clCellID1VSCellID2[i][j][0] = createHistogram1D(NameOfHisto, TitleOfHisto, 768, 0, 768, "delta V (# of cells)",
321 
322  NameOfHisto = "clNOtrk_energy12VSdeltaV_L" + nameLayer + "S" + nameSensor + "" + nameSide;
323  TitleOfHisto = "cluster energy1+2 V vs delta V, TB=3,4,5 NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," +
324  nameSide +
325  " side)";
326  h_clEnergy12VSdelta[i][j][0] = createHistogram2D(NameOfHisto, TitleOfHisto, 360, 0, 360, "energy (keV)", 768, 0, 768,
327  "delta V (# of cells)",
329 
330  }
331 
332  NameOfHisto = "clNOtrk_SN_L" + nameLayer + "S" + nameSensor + "" + nameSide;
333  TitleOfHisto = "cluster S/N, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
334  h_clSN[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 150, 0, 150, "S/N", m_histoList_cluster[i]);
335 
336  NameOfHisto = "clNOtrk_chrgVSsize_L" + nameLayer + "S" + nameSensor + "" + nameSide;
337  TitleOfHisto = "cluster charge VS size, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
338  h_clChargeVSSize[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 500, 0, 100000, "charge (e-)", 15, 0, 15, "cl size",
340  NameOfHisto = "clNOtrk_SNVSsize_L" + nameLayer + "S" + nameSensor + "" + nameSide;
341  TitleOfHisto = "cluster S/N ratio VS size, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide +
342  " side)";
343  h_clSNVSSize[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 150, 0, 150, "S/N", 15, 0, 15, "cl size",
345 
346  NameOfHisto = "clNOtrk_TimeVSsize_L" + nameLayer + "S" + nameSensor + "" + nameSide;
347  TitleOfHisto = "cluster time VS size, NOT related to tracks (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
348  h_clTimeVSSize[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 200, -100, 100, "cluster time (ns)", 15, 0, 15, "cl size",
350 
351  NameOfHisto = "clNOtrk_time_L" + nameLayer + "S" + nameSensor + "" + nameSide;
352  TitleOfHisto = "cluster time (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
353  h_clTime[i][j][k] = createHistogram1D(NameOfHisto, TitleOfHisto, 200, -100, 100, "cluster time", m_histoList_cluster[i]);
354 
355 
356  if (m_isSimulation) {
357  NameOfHisto = "clNOtrk_timeVStrueTime_L" + nameLayer + "S" + nameSensor + "" + nameSide;
358  TitleOfHisto = "cluster time VS true hit time (L" + nameLayer + ", sensor" + nameSensor + "," + nameSide + " side)";
359  h_clTimeVSTrueTime[i][j][k] = createHistogram2D(NameOfHisto, TitleOfHisto, 200, -100, 100, "cluster time", 60, -30, 30, "true time",
361  }
362 
363  }
364  TString NameOfHisto = "clNOtrk_nUVSnV_L" + nameLayer + "S" + nameSensor;
365  TString TitleOfHisto = "Number of U clusters VS number of V cluster, TB=3,4,5 (L" + nameLayer + ", sensor" + nameSensor + ")";
366  h_clNuVSNv[i][j] = createHistogram2D(NameOfHisto, TitleOfHisto, 50, 0, 50, "# V cluster", 50, 0, 50, "# U clusters",
368 
369  NameOfHisto = "clNOtrk_coorUVScoorV_L" + nameLayer + "S" + nameSensor;
370  TitleOfHisto = "cluster coor U VS cluster coor V, TB=3,4,5 (L" + nameLayer + ", sensor" + nameSensor + ")";
371  h_clCoorUVSCoorV[i][j] = createHistogram2D(NameOfHisto, TitleOfHisto, 200, -6.5, 6.5, "coor V", 200, -3, 3, "coor U",
373 
374  NameOfHisto = "clNOtrk_energyUVSenergyV_L" + nameLayer + "S" + nameSensor;
375  TitleOfHisto = "cluster energy U VS cluster energy V, TB=3,4,5 (L" + nameLayer + ", sensor" + nameSensor + ")";
376  h_clEnergyUVSEnergyV[i][j] = createHistogram2D(NameOfHisto, TitleOfHisto, 360, 0, 360, "energy V(keV)", 360, 0, 360,
377  "energy U (keV)",
379  //QUI
380  }
381 
382  //correlations
383  h_cltrk_UU = createHistogram1D("clTRK_dt_UU", "track-related U-U clusters time difference", 200, -100, 100, "time difference (ns)",
385  h_cltrk_VV = createHistogram1D("clTRK_dt_VV", "track-related V-V clusters time difference", 200, -100, 100, "time difference (ns)",
387  h_cltrk_UV = createHistogram1D("clTRK_dt_UV", "track-related U-V clusters time difference", 200, -100, 100, "time difference (ns)",
389 
390  h_cltrkTime_L4uL5u = createHistogram2D("clTRK_time_L4uL5u", "track-related cluster times on L4 and L5 U sides", 200, -100, 100,
391  "L4u cluster time", 200, -100, 100, "L5u cluster time",
393 
394  h_cltrkTime_L4vL5v = createHistogram2D("clTRK_time_L4vL5v", "track-related cluster times on L4 and L5 V sides", 200, -100, 100,
395  "L4v cluster time", 200, -100, 100, "L5v cluster time",
397 
398  h_cltrkTime_L5uL5v = createHistogram2D("clTRK_time_L5uL5v", "track-related cluster times on L5 U vs V sides", 200, -100, 100,
399  "L5u cluster time", 200, -100, 100, "L5v cluster time",
401 
402 
403 
404  // //correlations
405  // h_cl_UU = createHistogram1D("clNOTRK_dt_UU", "track-related U-U clusters time difference", 200, -100, 100, "time difference (ns)",
406  // m_histoList_corr);
407  // h_cl_VV = createHistogram1D("clNOTRK_dt_VV", "track-related V-V clusters time difference", 200, -100, 100, "time difference (ns)",
408  // m_histoList_corr);
409  // h_cl_UV = createHistogram1D("clNOTRK_dt_UV", "track-related U-V clusters time difference", 200, -100, 100, "time difference (ns)",
410  // m_histoList_corr);
411 
412  //tracks
413  m_nTracks = createHistogram1D("h1nTracks", "number of Tracks per event", 50, 0, 50, "n Tracks", m_histoList_track);
414  m_Pvalue = createHistogram1D("h1pValue", "Tracks p value", 100, 0, 1, "p value", m_histoList_track);
415  m_mom = createHistogram1D("h1momentum", " Tracks Momentum", 200, 0, 10, "p (GeV/c)", m_histoList_track);
416  m_nSVDhits = createHistogram1D("h1nSVDhits", "# SVD hits per track", 20, 0, 20, "# SVD hits", m_histoList_track);
417 
418  m_ntracks = 0;
419 }
420 
422 {
423  m_nEvents = 0;
424 }
425 
427 {
428 
429  SVDModeByte modeByte = m_storeSVDEvtInfo->getModeByte();
430 
431  m_nEvents++;
432  float c_eTOkeV = 3.6 / 1000; //keV = e * c_eTOkeV
433 
434  // StoreObjPtr<EventMetaData> eventMetaDataPtr;
435 
436  //ShaperDigits
437  int nShaperDigi[m_nLayers][m_nSensors][m_nSides];
438 
439  //RecoDigits
440  int nRecoDigi[m_nLayers][m_nSensors][m_nSides];
441 
442  // SVD clusters
443  int nCl[m_nLayers][m_nSensors][m_nSides];
444  int nCl345[m_nLayers][m_nSensors][m_nSides];
445  int nCltrk[m_nLayers][m_nSensors][m_nSides];
446 
447  for (int i = 0; i < m_nLayers; i ++) //loop on Layers
448  for (int j = 0; j < m_nSensors; j ++) //loop on Sensors
449  for (int k = 0; k < m_nSides; k ++) { //loop on Sides
450  nShaperDigi[i][j][k] = 0;
451  nRecoDigi[i][j][k] = 0;
452  nCl[i][j][k] = 0;
453  nCl345[i][j][k] = 0;
454  nCltrk[i][j][k] = 0;
455  }
456 
457  //tracks
458  if (m_Tracks) {
459  m_nTracks->Fill(m_Tracks.getEntries());
460  m_ntracks += m_Tracks.getEntries();
461  }
462 
463  BOOST_FOREACH(Track & track, m_Tracks) {
464 
465  const TrackFitResult* tfr = nullptr;
466  if (m_is2017TBanalysis)
467  tfr = track.getTrackFitResultWithClosestMass(Const::electron);
468  else
469  tfr = track.getTrackFitResultWithClosestMass(Const::pion);
470  if (tfr) {
471  m_Pvalue->Fill(tfr->getPValue());
472  m_mom->Fill(tfr->getMomentum().R());
473  m_nSVDhits->Fill((tfr->getHitPatternVXD()).getNSVDHits());
474 
475  if (m_is2017TBanalysis) {
476  if ((tfr->getPValue() < 0.001) || (tfr->getMomentum().R() < 1))
477  continue;
478  }
479  }
480  RelationVector<RecoTrack> theRC = DataStore::getRelationsWithObj<RecoTrack>(&track);
481  RelationVector<SVDCluster> svdClustersTrack = DataStore::getRelationsWithObj<SVDCluster>(theRC[0]);
482 
483 
484  for (int cl = 0 ; cl < (int)svdClustersTrack.size(); cl++) {
485 
486  float clCharge = svdClustersTrack[cl]->getCharge();
487  float clEnergy = svdClustersTrack[cl]->getCharge() * c_eTOkeV;
488  int clSize = svdClustersTrack[cl]->getSize();
489  float clSN = svdClustersTrack[cl]->getSNR();
490  float clTime = svdClustersTrack[cl]->getClsTime();
491  VxdID::baseType theVxdID = (VxdID::baseType)svdClustersTrack[cl]->getSensorID();
492  int layer = VxdID(theVxdID).getLayerNumber() - 3;
493  int sensor = getSensor(layer, VxdID(theVxdID).getSensorNumber(), m_is2017TBanalysis);
494  int side = svdClustersTrack[cl]->isUCluster();
495 
496  nCltrk[layer][sensor][side]++;
497  h_cltrkCharge[layer][sensor][side]->Fill(clCharge);
498  h_cltrkEnergy[layer][sensor][side]->Fill(clEnergy);
499  h_cltrkSize[layer][sensor][side]->Fill(clSize);
500  h_cltrkSN[layer][sensor][side]->Fill(clSN);
501  h_cltrkTime[layer][sensor][side]->Fill(clTime);
502 
503  SVDModeByte::baseType tb = modeByte.getTriggerBin();
504  if ((int) tb == 0) h_cltrkTime_TB1[layer][sensor][side]->Fill(clTime);
505  if ((int) tb == 1) h_cltrkTime_TB2[layer][sensor][side]->Fill(clTime);
506  if ((int) tb == 2) h_cltrkTime_TB3[layer][sensor][side]->Fill(clTime);
507  if ((int) tb == 3) h_cltrkTime_TB4[layer][sensor][side]->Fill(clTime);
508 
509  h_cltrkChargeVSSize[layer][sensor][side]->Fill(clCharge, clSize);
510  h_cltrkSNVSSize[layer][sensor][side]->Fill(clSN, clSize);
511  h_cltrkTimeVSSize[layer][sensor][side]->Fill(clTime, clSize);
512 
513  if (layer == 2) //layer5
514  for (int cll = 0 ; cll < cl; cll++) {
515  VxdID::baseType theVxdID2 = (VxdID::baseType)svdClustersTrack[cll]->getSensorID();
516  int side2 = svdClustersTrack[cll]->isUCluster();
517 
518  if ((VxdID(theVxdID2).getLayerNumber() == 5) && (side2 != side)) { //L5uL5v
519  if (side)
520  h_cltrkTime_L5uL5v->Fill(svdClustersTrack[cl]->getClsTime(), svdClustersTrack[cll]->getClsTime());
521  else
522  h_cltrkTime_L5uL5v->Fill(svdClustersTrack[cll]->getClsTime(), svdClustersTrack[cl]->getClsTime());
523  }
524 
525  if (VxdID(theVxdID2).getLayerNumber() == 4) { //L4
526 
527  if (side2 && side2 == side) //L4uL5u
528  h_cltrkTime_L4uL5u->Fill(svdClustersTrack[cl]->getClsTime(), svdClustersTrack[cll]->getClsTime());
529 
530  if (!side2 && side2 == side) //L4vL5v
531  h_cltrkTime_L4vL5v->Fill(svdClustersTrack[cl]->getClsTime(), svdClustersTrack[cll]->getClsTime());
532 
533  }
534  }
535 
536  //fill time difference
537  for (int cl2 = 0 ; cl2 < cl ; cl2++) {
538 
539  int layerDist = abs(VxdID(theVxdID).getLayerNumber() - svdClustersTrack[cl2]->getSensorID().getLayerNumber());
540 
541  int side2 = svdClustersTrack[cl2]->isUCluster();
542 
543  if (layerDist == 0) {
544  if ((side == 0) && (side2 == 1))
545  h_cltrk_UV -> Fill(svdClustersTrack[cl2]->getClsTime() - svdClustersTrack[cl]->getClsTime());
546 
547  if ((side == 1) && (side2 == 0))
548  h_cltrk_UV -> Fill(svdClustersTrack[cl]->getClsTime() - svdClustersTrack[cl2]->getClsTime());
549  } else if (layerDist == 1) {
550  if ((side == 1) && (side2 == 1))
551  h_cltrk_UU -> Fill(svdClustersTrack[cl]->getClsTime() - svdClustersTrack[cl2]->getClsTime());
552 
553  if ((side == 0) && (side2 == 0))
554  h_cltrk_VV -> Fill(svdClustersTrack[cl]->getClsTime() - svdClustersTrack[cl2]->getClsTime());
555  }
556 
557 
558 
559  }
560 
561  if (svdClustersTrack[cl]->getClsTime() < m_debugLowTime) {
562 
563  B2DEBUG(10, "CLUSTER WITH A TIME BELOW " << m_debugLowTime << "ns");
564  B2DEBUG(10, "size = " << svdClustersTrack[cl]->getSize() << ", SNR = " << svdClustersTrack[cl]->getSNR() << " charge = " <<
565  svdClustersTrack[cl]->getCharge() << ", SeedCharge = " << svdClustersTrack[cl]->getSeedCharge() << ", time = " <<
566  svdClustersTrack[cl]->getClsTime());
567  }
568 
569 
570  if (m_isSimulation) {
571  RelationVector<SVDTrueHit> svdTrueHitsTrack = DataStore::getRelationsWithObj<SVDTrueHit>(svdClustersTrack[cl]);
572 
573  for (int i = 0; i < (int)svdTrueHitsTrack.size(); i++) {
574  // if(svdTrueHitsTrack.size()>0){
575  h_cltrkTimeVSTrueTime[layer][sensor][side]->Fill(svdClustersTrack[cl]->getClsTime(), svdTrueHitsTrack[i]->getGlobalTime());
576  if (svdClustersTrack[cl]->getClsTime() < m_debugLowTime)
577  B2DEBUG(10, "True Hit Time = " << svdTrueHitsTrack[i]->getGlobalTime() << ", EnergyDep = " << svdTrueHitsTrack[i]->getEnergyDep() <<
578  ", size = " << svdTrueHitsTrack.size());
579  }
580 
581 
582  RelationVector<MCParticle> mcParticleTrack = DataStore::getRelationsWithObj<MCParticle>(svdClustersTrack[cl]);
583 
584  if (svdClustersTrack[cl]->getClsTime() < m_debugLowTime)
585  if ((int)mcParticleTrack.size() > 0)
586  B2DEBUG(10, "MCParticle PDG = " << mcParticleTrack[0]->getPDG() << ", energy = " << mcParticleTrack[0]->getEnergy() << ", size = "
587  << mcParticleTrack.size());
588 
589 
590  }
591 
592  if (clSize == 1) {
593  h_1cltrkCharge[layer][sensor][side]->Fill(clCharge);
594  h_1cltrkSN[layer][sensor][side]->Fill(svdClustersTrack[cl]->getSNR());
595  }
596 
597  if (clSize == 2) {
598  h_2cltrkCharge[layer][sensor][side]->Fill(clCharge);
599  h_2cltrkSN[layer][sensor][side]->Fill(svdClustersTrack[cl]->getSNR());
600  }
601  }
602 
603  }
604 
605  if (m_Tracks)
606  B2DEBUG(1, "%%%%%%%% NEW EVENT, number of Tracks = " << m_Tracks.getEntries());
607 
608  //shaper digits
609  for (int digi = 0 ; digi < m_svdShapers.getEntries(); digi++) {
610 
611 
612  VxdID::baseType theVxdID = (VxdID::baseType)m_svdShapers[digi]->getSensorID();
613  int layer = VxdID(theVxdID).getLayerNumber() - 3;
614  int sensor = getSensor(layer, VxdID(theVxdID).getSensorNumber(), m_is2017TBanalysis);
615  int side = m_svdShapers[digi]->isUStrip();
616  nShaperDigi[layer][sensor][side]++;
617 
618 
619  if (!m_svdShapers[digi]->isUStrip()) {
620  if (((layer == 0) && (m_svdShapers[digi]->getCellID() > 767)) ||
621  ((layer != 0) && (m_svdShapers[digi]->getCellID() > 511)))
622  B2WARNING(" SVDShaperDigits: unexpected cellID for Layer " << layer << " Ladder " << VxdID(theVxdID).getLadderNumber() <<
623  " Sensor " << VxdID(theVxdID).getSensorNumber() << " V side, strip = " << m_svdShapers[digi]->getCellID());
624  } else {
625  if (m_svdShapers[digi]->getCellID() > 767)
626  B2WARNING(" SVDShaperDigits: unexpected cellID for Layer " << layer << " Ladder " << VxdID(theVxdID).getLadderNumber() <<
627  " Sensor " << VxdID(theVxdID).getSensorNumber() << " U side, strip = " << m_svdShapers[digi]->getCellID());
628  }
629 
630  }
631 
632  //reco digits
633  if (m_svdRecos.isValid()) {
634  for (int digi = 0 ; digi < m_svdRecos.getEntries(); digi++) {
635 
636  VxdID::baseType theVxdID = (VxdID::baseType)m_svdRecos[digi]->getSensorID();
637  int layer = VxdID(theVxdID).getLayerNumber() - 3;
638  int sensor = getSensor(layer, VxdID(theVxdID).getSensorNumber(), m_is2017TBanalysis);
639  int side = m_svdRecos[digi]->isUStrip();
640  int cellID = m_svdRecos[digi]->getCellID();
641 
642  float thisNoise = m_NoiseCal.getNoiseInElectrons(theVxdID, side, cellID);
643 
644  h_stripNoise[layer][sensor][side]->Fill(thisNoise);
645  h_recoCharge[layer][sensor][side]->Fill(m_svdRecos[digi]->getCharge());
646  h_recoEnergy[layer][sensor][side]->Fill(m_svdRecos[digi]->getCharge()*c_eTOkeV);
647  h_recoTime[layer][sensor][side]->Fill(m_svdRecos[digi]->getTime());
648  nRecoDigi[layer][sensor][side]++;
649  }
650  }
651 
652  //clusters NOT related to tracks
653  for (int cl = 0 ; cl < m_svdClusters.getEntries(); cl++) {
654 
655  float clCharge = m_svdClusters[cl]->getCharge();
656  float clEnergy = m_svdClusters[cl]->getCharge() * c_eTOkeV;
657  float clCoor = m_svdClusters[cl]->getPosition();
658  int clSize = m_svdClusters[cl]->getSize();
659  float clTime = m_svdClusters[cl]->getClsTime();
660  float clSN = m_svdClusters[cl]->getSNR();
661  float seed_maxbin = -1;
662 
663  RelationVector<RecoTrack> theRC = DataStore::getRelationsWithObj<RecoTrack>(m_svdClusters[cl]);
664 
665  if ((int)theRC.size() > 0)
666  continue;
667 
668  //look for the max bin of the seed
669  RelationVector<SVDRecoDigit> theRecoDigits = DataStore::getRelationsWithObj<SVDRecoDigit>(m_svdClusters[cl]);
670  int index_seed = 0;
671  float charge = 0;
672  for (int r = 0; r < (int)theRecoDigits.size(); r++)
673  if (theRecoDigits.weight(r) > charge) {
674  index_seed = r;
675  charge = theRecoDigits[r]->getCharge();
676  }
677 
678  if (index_seed > -1) {
679  RelationVector<SVDShaperDigit> theSeedShaperDigits = DataStore::getRelationsWithObj<SVDShaperDigit>(theRecoDigits[index_seed]);
680 
682  samples = theSeedShaperDigits[0]->getSamples();
683  float amplitude = 0;
684  const int nAPVSamples = 6;
685  for (int k = 0; k < nAPVSamples; k ++) {
686  if (samples[k] > amplitude) {
687  amplitude = samples[k];
688  seed_maxbin = k;
689  }
690  }
691  }
692 
693  VxdID::baseType theVxdID = (VxdID::baseType)m_svdClusters[cl]->getSensorID();
694  int side = m_svdClusters[cl]->isUCluster();
695  int layer = VxdID(theVxdID).getLayerNumber() - 3;
696  int sensor = getSensor(layer, VxdID(theVxdID).getSensorNumber(), m_is2017TBanalysis);
697 
698  for (int cl2 = 0 ; cl2 < cl; cl2++) {
699  if (clSize > 1)
700  break;
701 
702  VxdID::baseType theVxdID2 = (VxdID::baseType)m_svdClusters[cl2]->getSensorID();
703  int side2 = m_svdClusters[cl2]->isUCluster();
704  int layer2 = VxdID(theVxdID2).getLayerNumber() - 3;
705  int sensor2 = getSensor(layer, VxdID(theVxdID2).getSensorNumber(), m_is2017TBanalysis);
706 
707  float clCoor1 = m_svdClusters[cl]->getPosition();
708  float clCoor2 = m_svdClusters[cl2]->getPosition();
709  float clEnergy1 = m_svdClusters[cl]->getCharge() * c_eTOkeV;
710  float clEnergy2 = m_svdClusters[cl2]->getCharge() * c_eTOkeV;
711  if ((layer != layer2) || (sensor != sensor2))
712  continue;
713 
714  if (seed_maxbin < 2 || seed_maxbin > 4)
715  continue;
716 
717  int cellID1 = -1;
718  for (int r = 0; r < (int)theRecoDigits.size(); r++)
719  if (cellID1 < theRecoDigits[r]->getCellID())
720  cellID1 = theRecoDigits[r]->getCellID();
721 
722  RelationVector<SVDRecoDigit> theRecoDigits2 = DataStore::getRelationsWithObj<SVDRecoDigit>(m_svdClusters[cl2]);
723  int dist = 768;
724  for (int r = 0; r < (int)theRecoDigits2.size(); r++)
725  if (cellID1 - theRecoDigits2[r]->getCellID() < dist)
726  dist = cellID1 - theRecoDigits2[r]->getCellID();
727 
728  if (side == 1 && side2 == 1) {
729  h_clCoor1VSCoor2[layer][sensor][1]->Fill(clCoor1 - clCoor2); //
730  h_clCellID1VSCellID2[layer][sensor][1]->Fill(dist);
731  h_clEnergy12VSdelta[layer][sensor][1]->Fill(clEnergy1 + clEnergy2, dist); //
732  }
733  if (side == 0 && side2 == 0) {
734  h_clCoor1VSCoor2[layer][sensor][0]->Fill(clCoor1 - clCoor2); //
735  h_clCellID1VSCellID2[layer][sensor][0]->Fill(dist);
736  h_clEnergy12VSdelta[layer][sensor][0]->Fill(clEnergy1 + clEnergy2, dist); //
737  }
738 
739  if (side == 1 && side2 == 0) {
740  h_clCoorUVSCoorV[layer][sensor]->Fill(clCoor2, clCoor1); //V, U
741  h_clEnergyUVSEnergyV[layer][sensor]->Fill(clEnergy2, clEnergy1); //V, U
742  }
743  if (side == 0 && side2 == 1) {
744  h_clCoorUVSCoorV[layer][sensor]->Fill(clCoor1, clCoor2);
745  h_clEnergyUVSEnergyV[layer][sensor]->Fill(clEnergy1, clEnergy2);
746  }
747  }
748 
749  nCl[layer][sensor][side]++;
750 
751 
752  h_clCharge[layer][sensor][side]->Fill(clCharge);
753  h_clEnergy[layer][sensor][side]->Fill(clEnergy);
754  h_clSeedMaxbin[layer][sensor][side]->Fill(seed_maxbin);
755  h_clEnergyVSMaxbin[layer][sensor][side]->Fill(clEnergy, seed_maxbin);
756  if (seed_maxbin < 2)
757  h_clEnergyVSSize_mb12[layer][sensor][side]->Fill(clEnergy, clSize);
758  else if (seed_maxbin == 5)
759  h_clEnergyVSSize_mb6[layer][sensor][side]->Fill(clEnergy, clSize);
760  else {
761  h_clEnergyVSSize_mb345[layer][sensor][side]->Fill(clEnergy, clSize);
762  nCl345[layer][sensor][side]++;
763  if (m_svdClusters[cl]->isUCluster())
764  h_clEnergyVSCoorU[layer][sensor][side]->Fill(clEnergy, clCoor);
765  else
766  h_clEnergyVSCoorV[layer][sensor][side]->Fill(clEnergy, clCoor);
767  }
768  h_clSize[layer][sensor][side]->Fill(clSize);
769  h_clSN[layer][sensor][side]->Fill(clSN);
770  h_clTime[layer][sensor][side]->Fill(clTime);
771 
772  h_clChargeVSSize[layer][sensor][side]->Fill(clCharge, clSize);
773  h_clSNVSSize[layer][sensor][side]->Fill(clSN, clSize);
774  h_clTimeVSSize[layer][sensor][side]->Fill(clTime, clSize);
775 
776  if (m_isSimulation) {
777  RelationVector<SVDTrueHit> svdTrueHits = DataStore::getRelationsWithObj<SVDTrueHit>(m_svdClusters[cl]);
778  if (svdTrueHits.size() > 0)
779  h_clTimeVSTrueTime[layer][sensor][side]->Fill(m_svdClusters[cl]->getClsTime(), svdTrueHits[0]->getGlobalTime());
780  }
781 
782  }
783 
784  for (int i = 0; i < m_nLayers; i ++) //loop on Layers
785  for (int j = 0; j < (int)sensorsOnLayer[i]; j ++) //loop on Sensors
786  for (int k = 0; k < m_nSides; k ++) { //loop on Sides
787  h_nShaper[i][j][k]->Fill(nShaperDigi[i][j][k]);
788  h_nReco[i][j][k]->Fill(nRecoDigi[i][j][k]);
789  h_nCl[i][j][k]->Fill(nCl[i][j][k]);
790  h_clNuVSNv[i][j]->Fill(nCl345[i][j][0], nCl345[i][j][1]);
791  h_nCltrk[i][j][k]->Fill(nCltrk[i][j][k]);
792  }
793 }
794 
795 
796 
798 {
799 
800  /*
801  B2RESULT(" number tracks = " << m_ntracks);
802  B2RESULT(" average number of cluster per layer:");
803  B2RESULT(" Layer 3, u = " << h_nCl_L3u->GetMean() << ", v = " << h_nCl_L3v->GetMean());
804  B2RESULT(" Layer 4, u = " << h_nCl_L4u->GetMean() << ", v = " << h_nCl_L4v->GetMean());
805  B2RESULT(" Layer 5, u = " << h_nCl_L5u->GetMean() << ", v = " << h_nCl_L5v->GetMean());
806  B2RESULT(" Layer 6, u = " << h_nCl_L6u->GetMean() << ", v = " << h_nCl_L6v->GetMean());
807  B2RESULT(" average cluster size per layer:");
808  B2RESULT(" Layer 3, u = " << h_clSize_L3u->GetMean() << ", v = " << h_clSize_L3v->GetMean());
809  B2RESULT(" Layer 4, u = " << h_clSize_L4u->GetMean() << ", v = " << h_clSize_L4v->GetMean());
810  */
811  if (m_rootFilePtr != nullptr) {
812  m_rootFilePtr->cd();
813 
814  TDirectory* oldDir = gDirectory;
815  TObject* obj;
816 
817  TDirectory* dir_track = oldDir->mkdir("tracks");
818  dir_track->cd();
819  TIter nextH_track(m_histoList_track);
820  while ((obj = nextH_track())) {
821  if (obj->InheritsFrom("TH1F"))((TH1F*)obj)->Scale(1. / m_nEvents);
822  obj->Write();
823  }
824 
825 
826  TDirectory* dir_shaper = oldDir->mkdir("shaper");
827  dir_shaper->cd();
828  for (int i = 0; i < m_nLayers; i++) {
829  TString layerName = "shaperL";
830  layerName += i + 3;
831  TDirectory* dir_layer = dir_shaper->mkdir(layerName.Data());
832  dir_layer->cd();
833  TIter nextH_shaper(m_histoList_shaper[i]);
834  while ((obj = nextH_shaper())) {
835  if (obj->InheritsFrom("TH1F"))((TH1F*)obj)->Scale(1. / m_nEvents);
836  obj->Write();
837  }
838  }
839 
840 
841  TDirectory* dir_reco = oldDir->mkdir("reco");
842  dir_reco->cd();
843  for (int i = 0; i < m_nLayers; i++) {
844  TString layerName = "recoL";
845  layerName += i + 3;
846  TDirectory* dir_layer = dir_reco->mkdir(layerName.Data());
847  dir_layer->cd();
848  TIter nextH_reco(m_histoList_reco[i]);
849  while ((obj = nextH_reco())) {
850  if (obj->InheritsFrom("TH1F"))((TH1F*)obj)->Scale(1. / m_nEvents);
851  obj->Write();
852  }
853  }
854 
855  TDirectory* dir_cluster = oldDir->mkdir("clusters");
856  dir_cluster->cd();
857  for (int i = 0; i < m_nLayers; i++) {
858  TString layerName = "clusterL";
859  layerName += i + 3;
860  TDirectory* dir_layer = dir_cluster->mkdir(layerName.Data());
861  dir_layer->cd();
862  TIter nextH_cluster(m_histoList_cluster[i]);
863  while ((obj = nextH_cluster())) {
864  if (obj->InheritsFrom("TH1F"))((TH1F*)obj)->Scale(1. / m_nEvents);
865  obj->Write();
866  }
867  }
868 
869  TDirectory* dir_clTRK = oldDir->mkdir("clustersTrk");
870  dir_clTRK->cd();
871  for (int i = 0; i < m_nLayers; i++) {
872  TString layerName = "clstrkL";
873  layerName += i + 3;
874  TDirectory* dir_layer = dir_clTRK->mkdir(layerName.Data());
875  dir_layer->cd();
876  TIter nextH_clTRK(m_histoList_clTRK[i]);
877  while ((obj = nextH_clTRK())) {
878  if (obj->InheritsFrom("TH1F"))((TH1F*)obj)->Scale(1. / m_nEvents);
879  obj->Write();
880  }
881  }
882 
883  oldDir->cd();
884  TIter nextH_corr(m_histoList_corr);
885  while ((obj = nextH_corr())) {
886  if (obj->InheritsFrom("TH1F"))
887  ((TH1F*)obj)->Scale(1. / m_nEvents);
888  obj->Write();
889  }
890 
891  m_rootFilePtr->Close();
892 
893 
894  }
895 
896 
897 
898 }
899 
900 
901 TH1F* SVDPerformanceModule::createHistogram1D(const char* name, const char* title,
902  Int_t nbins, Double_t min, Double_t max,
903  const char* xtitle, TList* histoList)
904 {
905 
906  TH1F* h = new TH1F(name, title, nbins, min, max);
907 
908  h->GetXaxis()->SetTitle(xtitle);
909 
910  if (histoList)
911  histoList->Add(h);
912 
913  return h;
914 }
915 
916 
917 TH2F* SVDPerformanceModule::createHistogram2D(const char* name, const char* title,
918  Int_t nbinsX, Double_t minX, Double_t maxX,
919  const char* titleX,
920  Int_t nbinsY, Double_t minY, Double_t maxY,
921  const char* titleY, TList* histoList)
922 {
923 
924  TH2F* h = new TH2F(name, title, nbinsX, minX, maxX, nbinsY, minY, maxY);
925 
926  h->GetXaxis()->SetTitle(titleX);
927  h->GetYaxis()->SetTitle(titleY);
928 
929  if (histoList)
930  histoList->Add(h);
931 
932  return h;
933 }
934 
935 
static const ChargedStable pion
charged pion particle
Definition: Const.h:652
static const ChargedStable electron
electron particle
Definition: Const.h:650
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
float weight(int index) const
Get weight with index.
Class to store SVD mode information.
Definition: SVDModeByte.h:69
baseType getTriggerBin() const
Get the triggerBin id.
Definition: SVDModeByte.h:140
uint8_t baseType
The base integer type for SVDModeByte.
Definition: SVDModeByte.h:72
float getNoiseInElectrons(const VxdID &sensorID, const bool &isU, const unsigned short &strip) const
This method provides the correct noise conversion into electrons, taking into account that the noise ...
std::string m_rootFileName
root file name
TH2F * h_cltrkTimeVSTrueTime[m_nLayers][m_nSensors][m_nSides]
time VS true time
float m_debugLowTime
cluster Time below this number will produce a printout
TH1F * h_cltrk_UU
U time vs U time.
TH1F * h_recoTime[m_nLayers][m_nSensors][m_nSides]
time
TH2F * h_cltrkChargeVSSize[m_nLayers][m_nSensors][m_nSides]
charge VS size
TH1F * createHistogram1D(const char *name, const char *title, Int_t nbins, Double_t min, Double_t max, const char *xtitle, TList *histoList=nullptr)
Function returning a TH1F.
TH2F * h_cltrkSNVSSize[m_nLayers][m_nSensors][m_nSides]
charge VS size
TH1F * h_clTime[m_nLayers][m_nSensors][m_nSides]
time
TList * m_histoList_reco[m_nLayers]
histo list reco digits
TList * m_histoList_corr
histo list correlations
TH2F * h_clEnergyVSSize_mb6[m_nLayers][m_nSensors][m_nSides]
energy VS size, max bin == 6
TH1F * h_clCoor1VSCoor2[m_nLayers][m_nSensors][m_nSides]
coor1 VS coor2
TH2F * h_clEnergyUVSEnergyV[m_nLayers][m_nSensors]
energy VS position
TH1F * h_cltrkEnergy[m_nLayers][m_nSensors][m_nSides]
energy
TH2F * h_clNuVSNv[m_nLayers][m_nSensors]
N U culsters VS N V clusters.
std::string m_ShaperDigitName
ShaperDigits Store Array name.
virtual void initialize() override
check StoreArrays & create rootfile
TH2F * h_clEnergyVSCoorV[m_nLayers][m_nSensors][m_nSides]
energy VS position V
StoreArray< SVDCluster > m_svdClusters
SVDCluster store array.
virtual void event() override
fill histograms
TH1F * h_clCharge[m_nLayers][m_nSensors][m_nSides]
charge
unsigned int sensorsOnLayer[4]
sensors on layer i
TH2F * h_clEnergyVSMaxbin[m_nLayers][m_nSensors][m_nSides]
energy VS maxbin seed
TH1F * h_nCltrk[m_nLayers][m_nSensors][m_nSides]
number per event
TH1F * h_cltrk_VV
V time vs V time.
SVDNoiseCalibrations m_NoiseCal
SVDNoise calibration db object.
virtual void endRun() override
write histogrmas
TH1F * h_cltrkCharge[m_nLayers][m_nSensors][m_nSides]
charge
TH1F * h_recoCharge[m_nLayers][m_nSensors][m_nSides]
charge
static const int m_nLayers
max number of layers
TH2F * h_cltrkTime_L4uL5u
L4U time VS L5U time.
TH1F * h_cltrkTime_TB3[m_nLayers][m_nSensors][m_nSides]
time
TH2F * h_cltrkTimeVSSize[m_nLayers][m_nSensors][m_nSides]
charge VS size
TH2F * h_clEnergyVSSize_mb12[m_nLayers][m_nSensors][m_nSides]
energy VS size, maxbin == 1,2
TH1F * h_2cltrkCharge[m_nLayers][m_nSensors][m_nSides]
charge
TH1F * h_nShaper[m_nLayers][m_nSensors][m_nSides]
number per event
static const int m_nSides
max number of sides
TH2F * h_cltrkTime_L5uL5v
L5U time VS L5V time.
TH1F * h_cltrkTime_TB4[m_nLayers][m_nSensors][m_nSides]
time
TH2F * h_clTimeVSTrueTime[m_nLayers][m_nSensors][m_nSides]
time VS true time
TH1F * h_1cltrkCharge[m_nLayers][m_nSensors][m_nSides]
charge
std::string m_TrackName
Track StoreArray name.
std::string m_RecoDigitName
SVDRecoDigits Store Array name.
TH2F * h_clEnergyVSSize_mb345[m_nLayers][m_nSensors][m_nSides]
energy VS size, maxbin == 3,4,5
virtual void beginRun() override
create histograms
TH1F * h_nCl[m_nLayers][m_nSensors][m_nSides]
number per event
TH2F * h_clEnergyVSCoorU[m_nLayers][m_nSensors][m_nSides]
energy VS position U
TH1F * h_1cltrkSN[m_nLayers][m_nSensors][m_nSides]
signal over noise
TH1F * h_clCellID1VSCellID2[m_nLayers][m_nSensors][m_nSides]
coor1 VS coor2
TH1F * h_2cltrkSN[m_nLayers][m_nSensors][m_nSides]
signal over noise
TH1F * h_cltrkTime_TB2[m_nLayers][m_nSensors][m_nSides]
time
std::string m_svdEventInfoName
Name of the SVDEventInfo object.
TList * m_histoList_track
histo list tracks
bool m_isSimulation
true if we analyze Simulated data
TH1F * h_cltrk_UV
U time vs V time.
std::string m_TrackFitResultName
TrackFitResult StoreArray name.
TList * m_histoList_clTRK[m_nLayers]
histo list clusters related to tracks
TH2F * h_clEnergy12VSdelta[m_nLayers][m_nSensors][m_nSides]
coor1 VS coor2
TH1F * m_nTracks
number of tracks
TH2F * h_clCoorUVSCoorV[m_nLayers][m_nSensors]
energy VS position
TH1F * h_clEnergy[m_nLayers][m_nSensors][m_nSides]
energy
TH1F * h_clSN[m_nLayers][m_nSensors][m_nSides]
signal over noise
static const int m_nSensors
max number of sensors
TList * m_histoList_shaper[m_nLayers]
histo list shaper digits
TH2F * h_clChargeVSSize[m_nLayers][m_nSensors][m_nSides]
charge VS size
std::string m_ClusterName
SVDCluster StoreArray name.
TH1F * h_cltrkSize[m_nLayers][m_nSensors][m_nSides]
size
TH1F * h_stripNoise[m_nLayers][m_nSensors][m_nSides]
strip noise
TH1F * h_clSeedMaxbin[m_nLayers][m_nSensors][m_nSides]
maxbin seed
TH1F * h_nReco[m_nLayers][m_nSensors][m_nSides]
number per event
StoreArray< SVDRecoDigit > m_svdRecos
SVDRecoDigits store array.
TH2F * createHistogram2D(const char *name, const char *title, Int_t nbinsX, Double_t minX, Double_t maxX, const char *titleX, Int_t nbinsY, Double_t minY, Double_t maxY, const char *titleY, TList *histoList=nullptr)
Function returning TH2F.
TH2F * h_clSNVSSize[m_nLayers][m_nSensors][m_nSides]
charge VS size
TH2F * h_clTimeVSSize[m_nLayers][m_nSensors][m_nSides]
charge VS size
StoreArray< Track > m_Tracks
Tracks store array.
TH1F * h_recoEnergy[m_nLayers][m_nSensors][m_nSides]
energy
StoreObjPtr< SVDEventInfo > m_storeSVDEvtInfo
Storage for SVDEventInfo object.
TFile * m_rootFilePtr
pointer at root file used for storing histograms
TH2F * h_cltrkTime_L4vL5v
L4V time VS L5V time.
int getSensor(int layer, int sensor, bool isTB)
get sensor number
bool m_is2017TBanalysis
true if we analyze 2017 TB data
TH1F * h_cltrkTime[m_nLayers][m_nSensors][m_nSides]
time
TList * m_histoList_cluster[m_nLayers]
histo list clusters
TH1F * h_clSize[m_nLayers][m_nSensors][m_nSides]
size
StoreArray< SVDShaperDigit > m_svdShapers
SVDShaperDigit store array.
TH1F * h_cltrkTime_TB1[m_nLayers][m_nSensors][m_nSides]
time
TH1F * h_cltrkSN[m_nLayers][m_nSensors][m_nSides]
signal over noise
std::array< APVFloatSampleType, c_nAPVSamples > APVFloatSamples
array of APVFloatSampleType objects
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
Values of the result of a track fit with a given particle hypothesis.
double getPValue() const
Getter for Chi2 Probability of the track fit.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
HitPatternVXD getHitPatternVXD() const
Getter for the hit pattern in the VXD;.
Class that bundles various TrackFitResults.
Definition: Track.h:25
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
unsigned short baseType
The base integer type for VxdID.
Definition: VxdID.h:36
baseType getLayerNumber() const
Get the layer id.
Definition: VxdID.h:96
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
Abstract base class for different kinds of events.