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