13 <contact>software-tracking@belle2.org</contact>
14 <input>EvtGenSim.root</input>
15 <output>TrackingInputValidationBkg.root</output>
17 This module checks the number of input hits
for tracking.
22from tracking.validation.plot import ValidationPlot
23from ROOT import Belle2
27from svd import add_svd_reconstruction
28from pxd import add_pxd_reconstruction
29NAME = 'Tracking Input Validation'
30CONTACT =
'software-tracking@belle2.org'
31INPUT_FILE =
'../EvtGenSim.root'
32OUTPUT_FILE =
'TrackingInputValidationBkg.root'
40 Check the number of hits that are the input for tracking.
42 class TrackingInputValidation(basf2.Module):
44 Module to collect information about the number of
58 output_file_name=None,
64 self.validation_name = NAME
66 self.contact = CONTACT
68 self.output_file_name = OUTPUT_FILE
71 """Receive signal at the start of event processing"""
91 self.nPXDDigits = collections.deque()
93 self.nPXDClusters = collections.deque()
95 self.nPXDSpacePoints = collections.deque()
98 self.nSVDShaperDigits = collections.deque()
100 self.nSVDClusters = collections.deque()
102 self.nSVDSpacePoints = collections.deque()
105 self.nCDCHits = collections.deque()
110 self.nPXDDigits.append(self.PXDDigits.getEntries())
111 self.nPXDClusters.append(self.PXDClusters.getEntries())
112 self.nPXDSpacePoints.append(self.PXDSpacePoints.getEntries())
113 self.nSVDShaperDigits.append(self.SVDShaperDigits.getEntries())
114 self.nSVDClusters.append(self.SVDClusters.getEntries())
115 self.nSVDSpacePoints.append(self.SVDSpacePoints.getEntries())
116 self.nCDCHits.append(self.CDCHits.getEntries())
119 """Receive signal at the end of event processing"""
122 output_tfile = ROOT.TFile(self.output_file_name,
'recreate')
124 h_nPXDDigits = ValidationPlot(
'h_nPXDDigits')
125 h_nPXDDigits.hist(self.nPXDDigits, bins=100, lower_bound=0, upper_bound=2000)
126 h_nPXDDigits.contact = self.contact
127 h_nPXDDigits.check =
'Average of 500 +/- 100 is expected.'
128 h_nPXDDigits.description =
'Number of PXDDigits after ROI filtering'
129 h_nPXDDigits.title =
'Number of selected PXDDigits per event'
130 h_nPXDDigits.xlabel =
'Number of PXDDigits'
131 h_nPXDDigits.ylabel =
''
132 h_nPXDDigits.write(output_tfile)
134 h_nPXDClusters = ValidationPlot(
'h_nPXDClusters')
135 h_nPXDClusters.hist(self.nPXDClusters, bins=100, lower_bound=0, upper_bound=500)
136 h_nPXDClusters.contact = self.contact
137 h_nPXDClusters.check =
'Average of 150 +/- 30 is expected'
138 h_nPXDClusters.description =
'Number of PXDClusters after ROI filtering.'
139 h_nPXDClusters.title =
'Number of PXDClusters per event'
140 h_nPXDClusters.xlabel =
'Number of PXDClusters'
141 h_nPXDClusters.ylabel =
''
142 h_nPXDClusters.write(output_tfile)
144 h_nPXDSpacePoints = ValidationPlot(
'h_nPXDSpacePoints')
145 h_nPXDSpacePoints.hist(self.nPXDSpacePoints, bins=100, lower_bound=0, upper_bound=500)
146 h_nPXDSpacePoints.contact = self.contact
147 h_nPXDSpacePoints.check =
'Average of 150 +/- 30 is expected'
148 h_nPXDSpacePoints.description =
'Number of PXDSpacePoints after ROI filtering. \
149 Should be the same as the number of PXDClusters.'
150 h_nPXDSpacePoints.title =
'Number of PXDSpacePoints per event'
151 h_nPXDSpacePoints.xlabel =
'Number of PXDSpacePoints'
152 h_nPXDSpacePoints.ylabel =
''
153 h_nPXDSpacePoints.write(output_tfile)
155 h_nSVDShaperDigits = ValidationPlot(
'h_nSVDShaperDigits')
156 h_nSVDShaperDigits.hist(self.nSVDShaperDigits, bins=100, lower_bound=0, upper_bound=10000)
157 h_nSVDShaperDigits.contact = self.contact
158 h_nSVDShaperDigits.check =
'First peak at about 5500 +/- 200 is expected.'
159 h_nSVDShaperDigits.description =
'Number of SVDDigits'
160 h_nSVDShaperDigits.title =
'Number of SVDDigits per event'
161 h_nSVDShaperDigits.xlabel =
'Number of SVDDigits'
162 h_nSVDShaperDigits.ylabel =
''
163 h_nSVDShaperDigits.write(output_tfile)
165 h_nSVDClusters = ValidationPlot(
'h_nSVDClusters')
166 h_nSVDClusters.hist(self.nSVDClusters, bins=100, lower_bound=0, upper_bound=2000)
167 h_nSVDClusters.contact = self.contact
168 h_nSVDClusters.check =
'Average of 1100 +/- 100 is expected.'
169 h_nSVDClusters.description =
'Number of SVDClusters'
170 h_nSVDClusters.title =
'Number of SVDClusters per event'
171 h_nSVDClusters.xlabel =
'Number of SVDClusters'
172 h_nSVDClusters.ylabel =
''
173 h_nSVDClusters.write(output_tfile)
175 h_nSVDSpacePoints = ValidationPlot(
'h_nSVDSpacePoints')
176 h_nSVDSpacePoints.hist(self.nSVDSpacePoints, bins=100, lower_bound=0, upper_bound=2000)
177 h_nSVDSpacePoints.contact = self.contact
178 h_nSVDSpacePoints.check =
'Average of 200 +/- 50 is expected.'
179 h_nSVDSpacePoints.description =
'Number of SVDSpacePoints'
180 h_nSVDSpacePoints.title =
'Number of SVDSpacePoints per event'
181 h_nSVDSpacePoints.xlabel =
'Number of SVDSpacePoints'
182 h_nSVDSpacePoints.ylabel =
''
183 h_nSVDSpacePoints.write(output_tfile)
185 h_nCDCHits = ValidationPlot(
'h_nCDCHits')
186 h_nCDCHits.hist(self.nCDCHits, bins=100, lower_bound=0, upper_bound=6000)
187 h_nCDCHits.contact = self.contact
188 h_nCDCHits.check =
'Average of 3500 +/- 200 is expected.'
189 h_nCDCHits.description =
'Number of CDCHits'
190 h_nCDCHits.title =
'Number of CDCHits per event'
191 h_nCDCHits.xlabel =
'Number of CDCHits'
192 h_nCDCHits.ylabel =
''
193 h_nCDCHits.write(output_tfile)
198 basf2.set_random_seed(1509)
200 path = basf2.create_path()
202 path.add_module(
'RootInput', inputFileName=INPUT_FILE)
203 path.add_module(
'Gearbox')
204 path.add_module(
'Geometry')
205 add_svd_reconstruction(path, isROIsimulation=
False)
206 add_pxd_reconstruction(path)
208 path.add_module(TrackingInputValidation())
210 path.add_module(
'Progress')
214 print(basf2.statistics)
217if __name__ ==
'__main__':
221 print(
"This validation deactivated and thus basf2 is not executed.\n"
222 "If you want to run this validation, please set the 'ACTIVE' flag above to 'True'.\n"
A (simplified) python wrapper for StoreArray.