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