Belle II Software development
SVDValidationClusterPerformance.py
1# !/usr/bin/env python3
2
3
10
11"""
12<header>
13 <input>SVDValidationTTreeTrueHit.root</input>
14 <input>SVDValidationTTreeCluster.root</input>
15 <output>SVDClusterPerformance.root</output>
16 <description>
17 Validation plots related to cluster performance.
18 </description>
19 <contact>
20 SVD Software Group, svd-software@belle2.org
21 </contact>
22</header>
23"""
24
25import ROOT as R
26
27import plotUtils as pu
28
29inputTH = R.TFile.Open("../SVDValidationTTreeTrueHit.root")
30inputC = R.TFile.Open("../SVDValidationTTreeCluster.root")
31
32treeTH = inputTH.Get("tree")
33treeC = inputC.Get("tree")
34
35histsCP = R.TFile.Open("SVDClusterPerformance.root", "recreate")
36
37
38pu.plotter(
39 name='ClusterTime',
40 title='Cluster time',
41 nbins=200,
42 xmin=-100,
43 xmax=100,
44 x_label='Cluster time (ns)',
45 y_label='counts',
46 granules=pu.gD,
47 tree=treeC,
48 expr='cluster_clsTime',
49 cut=pu.cut_matched,
50 descr='Reconstructed time of the cluster for all clusters related to at least one TrueHit.\
51 Distribution for signal clusters.',
52 check='Distribution peak around 0.',
53 isShifter=True)
54
55
56pu.plotter(
57 name='PositionResidual',
58 title='Cluster position residual',
59 nbins=100,
60 xmin=-0.01,
61 xmax=0.01,
62 x_label='Cluster position residual (cm)',
63 y_label='counts',
64 granules=pu.gD,
65 tree=treeC,
66 expr='cluster_position - truehit_position',
67 cut=pu.cut_matched,
68 descr='Definition: (reconstructed position of the cluster) - (position of the best TrueHit).\
69 Distribution for signal clusters.',
70 check='Distribution peak around 0.',
71 isShifter=False)
72
73
74pu.plotter(
75 name='PositionResidual_size1',
76 title='Cluster position residual for one strip',
77 nbins=100,
78 xmin=-0.01,
79 xmax=0.01,
80 x_label='Cluster position residual (cm)',
81 y_label='counts',
82 granules=pu.gD,
83 tree=treeC,
84 expr='cluster_position - truehit_position',
85 cut=pu.cut_size1 + pu.cut_matched,
86 descr='Definition: (reconstructed position of the cluster) - (position of the best TrueHit).\
87 Distribution for signal clusters.',
88 check='Distribution peak around 0.',
89 isShifter=False)
90
91
92pu.plotter(
93 name='PositionResidual_size2',
94 title='Cluster position residual for two strips',
95 nbins=100,
96 xmin=-0.01,
97 xmax=0.01,
98 x_label='Cluster position residual (cm)',
99 y_label='counts',
100 granules=pu.gD,
101 tree=treeC,
102 expr='cluster_position - truehit_position',
103 cut=pu.cut_size2 + pu.cut_matched,
104 descr='Definition: (reconstructed position of the cluster) - (position of the best TrueHit).\
105 Distribution for signal clusters.',
106 check='Distribution peak around 0.',
107 isShifter=False)
108
109
110pu.plotter(
111 name='PositionResidual_size3plus',
112 title='Cluster position residual for 3 or more strips',
113 nbins=100,
114 xmin=-0.01,
115 xmax=0.01,
116 x_label='Cluster position residual (cm)',
117 y_label='counts',
118 granules=pu.gD,
119 tree=treeC,
120 expr='cluster_position - truehit_position',
121 cut=pu.cut_size3plus + pu.cut_matched,
122 descr='Definition: (reconstructed position of the cluster) - (position of the best TrueHit).\
123 Distribution for signal clusters.',
124 check='Distribution peak around 0.',
125 isShifter=False)
126
127
128pu.plotter(
129 name='PositionPull',
130 title='Cluster position pull',
131 nbins=100,
132 xmin=-5,
133 xmax=5,
134 x_label='Cluster position pull',
135 y_label='counts',
136 granules=pu.gD,
137 tree=treeC,
138 expr='(cluster_position - truehit_position)/cluster_positionSigma',
139 cut=pu.cut_matched,
140 descr='Definition: (cluster_position - truehit_position)/cluster_positionSigma.\
141 Distribution for signal clusters.',
142 check='Distribution peaks around 0 with RMS less than 2.0.',
143 isShifter=True)
144
145
146pu.plotter(
147 name='PositionPull_size1',
148 title='Cluster position pull for one strip',
149 nbins=100,
150 xmin=-5,
151 xmax=5,
152 x_label='Cluster position pull',
153 y_label='counts',
154 granules=pu.gD,
155 tree=treeC,
156 expr='(cluster_position - truehit_position)/cluster_positionSigma',
157 cut=pu.cut_size1 + pu.cut_matched,
158 descr='Definition: (cluster_position - truehit_position)/cluster_positionSigma.\
159 Distribution for signal clusters.',
160 check='Distribution peaks around 0 with RMS less than 2.0.',
161 isShifter=False)
162
163
164pu.plotter(
165 name='PositionPull_size2',
166 title='Cluster position pull for two strip',
167 nbins=100,
168 xmin=-5,
169 xmax=5,
170 x_label='Cluster position pull',
171 y_label='counts',
172 granules=pu.gD,
173 tree=treeC,
174 expr='(cluster_position - truehit_position)/cluster_positionSigma',
175 cut=pu.cut_size2 + pu.cut_matched,
176 descr='Definition: (cluster_position - truehit_position)/cluster_positionSigma.\
177 Distribution for signal clusters.',
178 check='Distribution peaks around 0 with RMS less than 2.0.',
179 isShifter=False)
180
181
182pu.plotter(
183 name='PositionPull_size3plus',
184 title='Cluster position pull for 3 or more strips',
185 nbins=100,
186 xmin=-5,
187 xmax=5,
188 x_label='Cluster position pull',
189 y_label='counts',
190 granules=pu.gD,
191 tree=treeC,
192 expr='(cluster_position - truehit_position)/cluster_positionSigma',
193 cut=pu.cut_size3plus + pu.cut_matched,
194 descr='Definition: (cluster_position - truehit_position)/cluster_positionSigma.\
195 Distribution for signal clusters.',
196 check='Distribution peaks around 0 with RMS less than 2.0.',
197 isShifter=False)
198
199
200pu.plotter(
201 name='TimeResolution',
202 title='Cluster time resolution',
203 nbins=200,
204 xmin=-100,
205 xmax=100,
206 x_label='Cluster time resolution (ns)',
207 y_label='counts',
208 granules=pu.gD,
209 tree=treeC,
210 expr='cluster_clsTime - truehit_time',
211 cut=pu.cut_matched,
212 descr='Definition: (reconstructed time of the cluster) - (time of the best TrueHit)\
213 for all signal clusters.',
214 check='Distribution peak around 0.',
215 isShifter=False)
216
217
218pu.plotter(
219 name='ClusterCharge',
220 title='Cluster charge',
221 nbins=50,
222 xmin=0,
223 xmax=120000,
224 x_label='Cluster charge (# of electrons)',
225 y_label='counts',
226 granules=pu.gD,
227 tree=treeC,
228 expr='cluster_charge',
229 cut=pu.cut_matched,
230 descr='Reconstructed charge of the cluster related to at least one TrueHit.\
231 Distribution for signal clusters.',
232 check='Distribution peaks around 20-40 ke.',
233 isShifter=True)
234
235pu.plotter(
236 name='ClusterSN',
237 title='Cluster Signal/Noise ratio',
238 nbins=121,
239 xmin=-0.5,
240 xmax=120.5,
241 x_label='cluster SNR',
242 y_label='counts',
243 granules=pu.gD,
244 tree=treeC,
245 expr='cluster_snr',
246 cut=pu.cut_matched,
247 descr='Signal/Noise ratio of the clusters related to at least one TrueHit.',
248 check='Distribution peaks around 20.',
249 isShifter=True)
250
251pu.plotter(
252 name='InterstripPosition',
253 title='Interstrip position',
254 nbins=50,
255 xmin=0.0,
256 xmax=1.0,
257 x_label='Interstrip Position',
258 y_label='counts',
259 granules=pu.gD,
260 tree=treeC,
261 expr='cluster_interstripPosition',
262 cut=pu.cut_matched,
263 descr='Definition: (cluster_position % strip_pitch / strip_pitch).\
264 Distribution for signal clusters.',
265 check='',
266 isShifter=False)
267
268pu.plotter(
269 name='ClusterSize',
270 title='Cluster size',
271 nbins=9,
272 xmin=0.5,
273 xmax=9.5,
274 x_label='Cluster size (# of strips in cluster)',
275 y_label='counts',
276 granules=pu.gD,
277 tree=treeC,
278 expr='cluster_size',
279 cut=pu.cut_matched,
280 descr='Number of strips in the Cluster related to at least one TrueHit.',
281 check='Distribution peaks in range 2-3.',
282 isShifter=False)
283
284pu.plotRegions(
285 name='ClusterizationEfficiency_U',
286 title='Efficiency of clusterization for U side',
287 x_label='SVD regions',
288 y_label='Efficiency',
289 granules=pu.granulesLayersTypes,
290 tree=treeTH,
291 expr='strip_dir',
292 cutALL=pu.cut_notV,
293 cut=pu.cut_notV + pu.cut_reco,
294 descr='Definition: (number of clusters related to at least one TrueHit) / (number of best TrueHits)',
295 check='Efficiency should be close to 1 in all bins. Note that only one TrueHit (the best one, \
296 i.e. the one with the largest energy deposit) is counted\
297 in case one cluster is related to more than one TrueHit (e.g. in case of delta rays).',
298 isShifter=True)
299
300
301pu.plotRegions(
302 name='ClusterizationEfficiency_V',
303 title='Efficiency of clusterization for V side',
304 x_label='SVD regions',
305 y_label='Efficiency',
306 granules=pu.granulesLayersTypes,
307 tree=treeTH,
308 expr='strip_dir',
309 cutALL=pu.cut_notU,
310 cut=pu.cut_notU + pu.cut_reco,
311 descr='Definition: (number of clusters related to at least one TrueHit) / (number of best TrueHits)',
312 check='Efficiency should be close to 1 in all bins. Note that only one TrueHit (the best one, \
313 i.e. the one with the largest energy deposit) is counted\
314 in case one cluster is related to more than one TrueHit (e.g. in case of delta rays).',
315 isShifter=True)
316
317
318pu.plotRegions(
319 name='ClusterizationPurity_U',
320 title='Fraction of U-side signal clusters (purity)',
321 x_label='SVD regions',
322 y_label='Purity',
323 granules=pu.granulesLayersTypes,
324 tree=treeC,
325 expr='strip_dir',
326 cutALL=pu.cut_U,
327 cut=pu.cut_U + pu.cut_matched,
328 descr='(number of clusters related to at least one TrueHit) / (number of clusters).\
329 Evaluates the fraction of signal cluster over the total number of signal and background clusters.',
330 check='Purity should be above 0 in all bins.',
331 isShifter=True)
332
333
334pu.plotRegions(
335 name='ClusterizationPurity_V',
336 title='Fraction of V-side signal clusters (purity)',
337 x_label='SVD regions',
338 y_label='Purity',
339 granules=pu.granulesLayersTypes,
340 tree=treeC,
341 expr='strip_dir',
342 cutALL=pu.cut_V,
343 cut=pu.cut_V + pu.cut_matched,
344 descr='(number of clusters related to at least one TrueHit) / (number of clusters).\
345 Evaluates the fraction of signal cluster over the total number of signal and background clusters.',
346 check='Purity should be above 0 in all bins.',
347 isShifter=True)