21 from basf2
import conditions
as b2conditions
24 import tracking
as trk
25 import simulation
as sim
27 from background
import get_background_files
28 import generators
as ge
30 from ROOT
import Belle2, TH1F, TH2F, TFile, TMath
34 parser = argparse.ArgumentParser(description=__doc__)
35 parser.add_argument(
"--seed", default=
"1",
37 parser.add_argument(
"--fileDir", default=
"./",
38 help=
"Output File Dir")
39 parser.add_argument(
"--fileTag", default=
"test",
40 help=
"Output File Tag")
41 parser.add_argument(
"--moduleName", default=
"SVDGroupingPerformance",
43 parser.add_argument(
"--isMC", action=
"store_true",
44 help=
"Use Simulation")
45 parser.add_argument(
"--isRawTime", action=
"store_true",
46 help=
"Compute Raw SVD Time")
47 parser.add_argument(
"--doSVDGrouping", action=
"store_true",
48 help=
"Perform grouping of SVD Clusters")
49 parser.add_argument(
"--signalLifetime", type=float, default=30,
50 help=
"Lifetime of Signal when computing exponential-weigth for sorting signal groups")
51 parser.add_argument(
"--numberOfSignalGroups", type=int, default=1,
52 help=
"Select only few signal groups")
53 parser.add_argument(
"--formSingleSignalGroup", action=
"store_true",
54 help=
"Assign groupId 0 to every signal groups")
55 parser.add_argument(
"--useSVDGroupInfo", action=
"store_true",
56 help=
"Use SVD Grouping info in SVDSpacePointCreator")
57 parser.add_argument(
"--CoG3TimeCalibration_bucket36", action=
"store_true",
58 help=
"SVD Time calibration")
59 parser.add_argument(
"--CoG3TimeCalibration_bucket32", action=
"store_true",
60 help=
"SVD Time calibration")
61 parser.add_argument(
"--is3sample", action=
"store_true",
62 help=
"Emulate SVD 3 samples")
63 parser.add_argument(
"--executionTime", action=
"store_true",
64 help=
"Store exection time tree")
65 parser.add_argument(
"--test", action=
"store_true",
66 help=
"Test with small numbers of events")
67 args = parser.parse_args()
68 b2.B2INFO(f
"Steering file args = {args}")
71 b2.set_log_level(b2.LogLevel.DEBUG)
72 b2.set_debug_level(21)
77 outputFileTag +=
"_MC"
79 outputFileTag +=
"_emulated3sample"
81 outputFileTag +=
"_RawTime"
82 if args.doSVDGrouping:
83 outputFileTag +=
"_Grouping"
84 outputFileTag +=
"_sigLifeTime" + str(int(args.signalLifetime))
85 outputFileTag +=
"_Signal" + str(int(args.numberOfSignalGroups))
86 if args.formSingleSignalGroup:
87 outputFileTag +=
"_SuperGroup"
88 if args.useSVDGroupInfo:
89 outputFileTag +=
"_UsedInSPs"
90 outputFileTag +=
"_" + str(args.fileTag)
110 ''' check cluster grouping'''
113 '''define histograms'''
120 timeBin = int(maxTime - minTime)
131 self.reso_TH2D_Histogram_Index = {}
132 self.reso_TH2D_Histograms = []
133 reso_TH2D_Histograms_Count = 0
135 self.outputFileName = str(args.fileDir) + str(args.moduleName) + outputFileTag
136 self.f = TFile(self.outputFileName +
".root",
"RECREATE")
141 self.TH1F_Store.append(TH1F(
"th1f_svdEventT0",
"SVD EventT0", 500, -50., 50.))
142 self.TH1F_Store[-1].GetXaxis().SetTitle(
"SVD EventT0 (ns)")
143 self.TH1F_Index[
"th1f_svdEventT0"] = TH1F_Store_Count
144 TH1F_Store_Count += 1
145 self.TH1F_Store.append(TH1F(
"th1f_svdEventT0_State",
"SVD EventT0 Availability", 2, -0.5, 1.5))
146 self.TH1F_Store[-1].GetXaxis().SetBinLabel(1,
"Not Available")
147 self.TH1F_Store[-1].GetXaxis().SetBinLabel(2,
"Available")
148 self.TH1F_Index[
"th1f_svdEventT0_State"] = TH1F_Store_Count
149 TH1F_Store_Count += 1
151 self.TH1F_Store.append(TH1F(
"th1f_cdcEventT0",
"CDC EventT0", 500, -50., 50.))
152 self.TH1F_Store[-1].GetXaxis().SetTitle(
"CDC EventT0 (ns)")
153 self.TH1F_Index[
"th1f_cdcEventT0"] = TH1F_Store_Count
154 TH1F_Store_Count += 1
155 self.TH1F_Store.append(TH1F(
"th1f_cdcEventT0_State",
"CDC EventT0 Availability", 2, -0.5, 1.5))
156 self.TH1F_Store[-1].GetXaxis().SetBinLabel(1,
"Not Available")
157 self.TH1F_Store[-1].GetXaxis().SetBinLabel(2,
"Available")
158 self.TH1F_Index[
"th1f_cdcEventT0_State"] = TH1F_Store_Count
159 TH1F_Store_Count += 1
163 self.TH1F_Store.append(TH1F(
"th1f_svdEventT0topRef",
"SVD EventT0 - TOP Online EventT0", 500, -20., 20.))
164 self.TH1F_Store[-1].GetXaxis().SetTitle(
"SVD EventT0 - TOP Online EventT0 (ns)")
165 self.TH1F_Index[
"th1f_svdEventT0topRef"] = TH1F_Store_Count
166 TH1F_Store_Count += 1
170 self.TH1F_Store.append(TH1F(
"th1f_clsTime_PreTracking",
"(PreTracking) Cluster Time", timeBin, minTime, maxTime))
171 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
172 self.TH1F_Store[-1].SetLineColor(1)
173 self.TH1F_Index[
"th1f_clsTime_PreTracking"] = TH1F_Store_Count
174 TH1F_Store_Count += 1
175 self.TH1F_Store.append(TH1F(
"th1f_bkgClsTime_PreTracking",
"(PreTracking) Bkg Cluster Time", timeBin, minTime, maxTime))
176 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
177 self.TH1F_Store[-1].SetLineColor(2)
178 self.TH1F_Index[
"th1f_bkgClsTime_PreTracking"] = TH1F_Store_Count
179 TH1F_Store_Count += 1
180 self.TH1F_Store.append(TH1F(
"th1f_sigClsTime_PreTracking",
"(PreTracking) Sig Cluster Time", timeBin, minTime, maxTime))
181 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
182 self.TH1F_Store[-1].SetLineColor(3)
183 self.TH1F_Index[
"th1f_sigClsTime_PreTracking"] = TH1F_Store_Count
184 TH1F_Store_Count += 1
186 self.TH1F_Store.append(TH1F(
"th1f_clsTime_PostTracking",
"(PostTracking) Cluster Time", timeBin, minTime, maxTime))
187 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
188 self.TH1F_Store[-1].SetLineColor(1)
189 self.TH1F_Index[
"th1f_clsTime_PostTracking"] = TH1F_Store_Count
190 TH1F_Store_Count += 1
191 self.TH1F_Store.append(TH1F(
"th1f_bkgClsTime_PostTracking",
"(PostTracking) Bkg Cluster Time", timeBin, minTime, maxTime))
192 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
193 self.TH1F_Store[-1].SetLineColor(2)
194 self.TH1F_Index[
"th1f_bkgClsTime_PostTracking"] = TH1F_Store_Count
195 TH1F_Store_Count += 1
196 self.TH1F_Store.append(TH1F(
"th1f_sigClsTime_PostTracking",
"(PostTracking) Sig Cluster Time", timeBin, minTime, maxTime))
197 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
198 self.TH1F_Store[-1].SetLineColor(3)
199 self.TH1F_Index[
"th1f_sigClsTime_PostTracking"] = TH1F_Store_Count
200 TH1F_Store_Count += 1
202 self.TH1F_Store.append(TH1F(
"th1f_trackTime",
"Track Time", timeBin * 10, minTime, maxTime))
203 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Track Time (ns)")
204 self.TH1F_Index[
"th1f_trackTime"] = TH1F_Store_Count
205 TH1F_Store_Count += 1
206 self.TH1F_Store.append(TH1F(
"th1f_trackTimeCDCRef",
"Track Time - CDC EventT0", 10000, -50, 50))
207 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Track Time - CDC EventT0 (ns)")
208 self.TH1F_Index[
"th1f_trackTimeCDCRef"] = TH1F_Store_Count
209 TH1F_Store_Count += 1
213 self.TH1F_Store.append(TH1F(
"th1f_clsTimeCdcRef_PreTracking",
"(PreTracking) Cluster Time - CDC EventT0",
214 timeBin * 2, minTime, maxTime))
215 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time - CDC EventT0 (ns)")
216 self.TH1F_Store[-1].SetLineColor(1)
217 self.TH1F_Index[
"th1f_clsTimeCdcRef_PreTracking"] = TH1F_Store_Count
218 TH1F_Store_Count += 1
220 self.TH1F_Store.append(TH1F(
"th1f_clsTimeCdcRef_PostTracking",
"(PostTracking) Cluster Time - CDC EventT0",
221 timeBin * 2, minTime, maxTime))
222 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time - CDC EventT0 (ns)")
223 self.TH1F_Store[-1].SetLineColor(1)
224 self.TH1F_Index[
"th1f_clsTimeCdcRef_PostTracking"] = TH1F_Store_Count
225 TH1F_Store_Count += 1
229 self.TH1F_Store.append(TH1F(
"th1f_eclTCEmax",
"ECL E_{max}^{TC}", 1250, 0.5, 1250.5))
230 self.TH1F_Store[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
231 self.TH1F_Index[
"th1f_eclTCEmax"] = TH1F_Store_Count
232 TH1F_Store_Count += 1
233 self.TH1F_Store.append(TH1F(
"th1f_eclTCEmax_State",
"ECL E_{max}^{TC} Availability", 2, -0.5, 1.5))
234 self.TH1F_Store[-1].GetXaxis().SetBinLabel(1,
"Not Available")
235 self.TH1F_Store[-1].GetXaxis().SetBinLabel(2,
"Available")
236 self.TH1F_Index[
"th1f_eclTCEmax_State"] = TH1F_Store_Count
237 TH1F_Store_Count += 1
239 self.TH2F_Store.append(TH2F(
"th2f_timeGr_vs_grAmp",
"Time Group vs Group Amplitude", 60, 0., 300, 21, -1.5, 19.5))
240 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Group Amplitude")
241 self.TH2F_Store[-1].GetYaxis().SetTitle(
"Time Group")
242 self.TH2F_Index[
"th2f_timeGr_vs_grAmp"] = TH2F_Store_Count
243 TH2F_Store_Count += 1
244 self.TH2F_Store.append(TH2F(
"th2f_timeGr_vs_grCenter",
"Time Group vs Group Center", 80, minTime, maxTime, 21, -1.5, 19.5))
245 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Group Center (ns)")
246 self.TH2F_Store[-1].GetYaxis().SetTitle(
"Time Group")
247 self.TH2F_Index[
"th2f_timeGr_vs_grCenter"] = TH2F_Store_Count
248 TH2F_Store_Count += 1
249 self.TH2F_Store.append(TH2F(
"th2f_timeGr_vs_grWidth",
"Time Group vs Group Width", 50, 1, 11, 21, -1.5, 19.5))
250 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Group Width (ns)")
251 self.TH2F_Store[-1].GetYaxis().SetTitle(
"Time Group")
252 self.TH2F_Index[
"th2f_timeGr_vs_grWidth"] = TH2F_Store_Count
253 TH2F_Store_Count += 1
254 self.TH2F_Store.append(TH2F(
"th2f_timeGr_vs_clsTime",
"Time Group vs Cluster Time",
255 timeBin, minTime, maxTime, 21, -1.5, 19.5))
256 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
257 self.TH2F_Store[-1].GetYaxis().SetTitle(
"Time Group")
258 self.TH2F_Index[
"th2f_timeGr_vs_clsTime"] = TH2F_Store_Count
259 TH2F_Store_Count += 1
260 self.TH2F_Store.append(TH2F(
"th2f_timeGr_vs_clsTime_PostTracking",
"(PostTracking) Time Group vs Cluster Time",
261 timeBin, minTime, maxTime, 21, -1.5, 19.5))
262 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
263 self.TH2F_Store[-1].GetYaxis().SetTitle(
"Time Group")
264 self.TH2F_Index[
"th2f_timeGr_vs_clsTime_PostTracking"] = TH2F_Store_Count
265 TH2F_Store_Count += 1
268 self.TH2F_Store.append(TH2F(
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0",
"Center of 'Group " +
269 str(i) +
"' vs CDC EventT0", 500, -50., 50., 500, -50., 50.))
270 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Center of 'Group " + str(i) +
"' (ns)")
271 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
272 self.TH2F_Index[
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0"] = TH2F_Store_Count
273 TH2F_Store_Count += 1
274 self.TH2F_Store.append(TH2F(
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0_rot45pos",
275 "Center of 'Group " + str(i) +
"' vs CDC EventT0 (Rotated 45)",
276 500, -50., 50., 500, -50., 50.))
277 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Center of 'Group " + str(i) +
"' (ns)")
278 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
279 self.TH2F_Index[
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0_rot45pos"] = TH2F_Store_Count
280 TH2F_Store_Count += 1
281 self.TH2F_Store.append(TH2F(
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0_rot45neg",
282 "Center of 'Group " + str(i) +
"' vs CDC EventT0 (Rotated -45)",
283 500, -50., 50., 500, -50., 50.))
284 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Center of 'Group " + str(i) +
"' (ns)")
285 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
286 self.TH2F_Index[
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0_rot45neg"] = TH2F_Store_Count
287 TH2F_Store_Count += 1
289 self.TH2F_Store.append(TH2F(
"th2f_aveClsTimeInTrk_vs_cdcEventT0",
290 "Track Time vs CDC EventT0", 500, -50., 50., 500, -50., 50.))
291 self.TH2F_Store[-1].GetXaxis().SetTitle(
"<Cluster Time> in Track (ns)")
292 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
293 self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_cdcEventT0"] = TH2F_Store_Count
294 TH2F_Store_Count += 1
295 self.TH2F_Store.append(TH2F(
"th2f_svdEventT0_vs_cdcEventT0",
"SVD EventT0 vs CDC EventT0",
296 500, -50., 50., 500, -50., 50.))
297 self.TH2F_Store[-1].GetXaxis().SetTitle(
"SVD EventT0 (ns)")
298 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
299 self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0"] = TH2F_Store_Count
300 TH2F_Store_Count += 1
301 self.TH2F_Store.append(TH2F(
"th2f_svdEventT0_vs_cdcEventT0_rot45pos",
302 "SVD EventT0 vs CDC EventT0 (Rotated 45)", 500, -50., 50., 500, -50., 50.))
303 self.TH2F_Store[-1].GetXaxis().SetTitle(
"SVD EventT0 (ns)")
304 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
305 self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0_rot45pos"] = TH2F_Store_Count
306 TH2F_Store_Count += 1
307 self.TH2F_Store.append(TH2F(
"th2f_svdEventT0_vs_cdcEventT0_rot45neg",
308 "SVD EventT0 vs CDC EventT0 (Rotated -45)", 500, -50., 50., 500, -50., 50.))
309 self.TH2F_Store[-1].GetXaxis().SetTitle(
"SVD EventT0 (ns)")
310 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
311 self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0_rot45neg"] = TH2F_Store_Count
312 TH2F_Store_Count += 1
314 self.TH2F_Store.append(TH2F(
"th2f_trkTime_vs_clsTime_inCDCEventT0",
"Track Time vs Cluster Time",
315 timeBin, minTime, maxTime, timeBin, minTime, maxTime))
316 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Track Time - Cluster Time (ns)")
317 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 - Track Time (ns)")
318 self.TH2F_Index[
"th2f_trkTime_vs_clsTime_inCDCEventT0"] = TH2F_Store_Count
319 TH2F_Store_Count += 1
320 self.TH2F_Store.append(TH2F(
"th2f_trkTime_vs_clsTime_inSVDEventT0",
"Track Time vs Cluster Time",
321 timeBin, minTime, maxTime, timeBin, minTime, maxTime))
322 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Track Time - Cluster Time (ns)")
323 self.TH2F_Store[-1].GetYaxis().SetTitle(
"SVD EventT0 - Track Time (ns)")
324 self.TH2F_Index[
"th2f_trkTime_vs_clsTime_inSVDEventT0"] = TH2F_Store_Count
325 TH2F_Store_Count += 1
327 self.TH2F_Store.append(TH2F(
"th2f_aveClsTimeInTrk_vs_clsTime_inCDCEventT0",
"<Cluster Time> in Track vs Cluster Time",
328 timeBin, minTime, maxTime, timeBin, minTime, maxTime))
329 self.TH2F_Store[-1].GetXaxis().SetTitle(
"<Cluster Time> in Track - Cluster Time (ns)")
330 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 - <Cluster Time> in Track (ns)")
331 self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_clsTime_inCDCEventT0"] = TH2F_Store_Count
332 TH2F_Store_Count += 1
333 self.TH2F_Store.append(TH2F(
"th2f_aveClsTimeInTrk_vs_clsTime_inSVDEventT0",
"<Cluster Time> in Track vs Cluster Time",
334 timeBin, minTime, maxTime, timeBin, minTime, maxTime))
335 self.TH2F_Store[-1].GetXaxis().SetTitle(
"<Cluster Time> in Track - Cluster Time (ns)")
336 self.TH2F_Store[-1].GetYaxis().SetTitle(
"SVD EventT0 - <Cluster Time> in Track (ns)")
337 self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_clsTime_inSVDEventT0"] = TH2F_Store_Count
338 TH2F_Store_Count += 1
342 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_clsTimeTopRef_PreTracking",
343 "(PreTracking) ECL E_{max}^{TC} vs Cluster Time - TOP Online EventT0",
344 usedBin1, eclMinVal, eclMaxVal, usedBin2, -50, 50.))
345 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
346 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"Cluster Time - TOP Online EventT0 (ns)")
347 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_clsTimeTopRef_PreTracking"] = reso_TH2D_Histograms_Count
348 reso_TH2D_Histograms_Count += 1
349 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_clsTimeTopRef_PostTracking",
350 "(PostTracking) ECL E_{max}^{TC} vs Cluster Time - TOP Online EventT0",
351 usedBin1, eclMinVal, eclMaxVal, usedBin2, -50, 50.))
352 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
353 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"Cluster Time - TOP Online EventT0 (ns)")
354 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_clsTimeTopRef_PostTracking"] = reso_TH2D_Histograms_Count
355 reso_TH2D_Histograms_Count += 1
357 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_svdEventT0TopRef",
358 "ECL E_{max}^{TC} vs SVD EventT0 - TOP Online EventT0",
359 usedBin1, eclMinVal, eclMaxVal, usedBin2, -50, 50.))
360 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
361 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"SVD EventT0 - TOP Online EventT0 (ns)")
362 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_svdEventT0TopRef"] = reso_TH2D_Histograms_Count
363 reso_TH2D_Histograms_Count += 1
365 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_totalTracks",
366 "ECL E_{max}^{TC} vs Total SVD Tracks",
367 usedBin1, eclMinVal, eclMaxVal, 36, -0.5, 35.5))
368 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
369 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"Total SVD Tracks")
370 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalTracks"] = reso_TH2D_Histograms_Count
371 reso_TH2D_Histograms_Count += 1
373 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_totalClusters_PreTracking",
374 "(PreTracking) ECL E_{max}^{TC} vs Total SVD Clusters",
375 usedBin1, eclMinVal, eclMaxVal, 1000, 0.5, 1000.5))
376 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
377 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"Total SVD Clusters")
378 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalClusters_PreTracking"] = reso_TH2D_Histograms_Count
379 reso_TH2D_Histograms_Count += 1
380 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_totalClusters_PostTracking",
381 "(PostTracking) ECL E_{max}^{TC} vs Total SVD Clusters",
382 usedBin1, eclMinVal, eclMaxVal, 1000, 0.5, 1000.5))
383 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
384 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"Total SVD Clusters")
385 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalClusters_PostTracking"] = reso_TH2D_Histograms_Count
386 reso_TH2D_Histograms_Count += 1
392 svdEventT0 = math.nan
393 cdcEventT0 = math.nan
397 if EventT0.hasTemporaryEventT0(svd):
398 tmp = EventT0.getTemporaryEventT0s(Belle2.Const.SVD)
399 svdEventT0 = tmp.back().eventT0
400 if EventT0.hasTemporaryEventT0(cdc):
401 tmp = EventT0.getTemporaryEventT0s(Belle2.Const.CDC)
402 cdcEventT0 = tmp.back().eventT0
404 if not math.isnan(svdEventT0):
405 self.TH1F_Store[self.TH1F_Index[
"th1f_svdEventT0"]].Fill(svdEventT0)
406 self.TH1F_Store[self.TH1F_Index[
"th1f_svdEventT0_State"]].Fill(1)
408 self.TH1F_Store[self.TH1F_Index[
"th1f_svdEventT0_State"]].Fill(0)
409 if not math.isnan(cdcEventT0):
410 self.TH1F_Store[self.TH1F_Index[
"th1f_cdcEventT0"]].Fill(cdcEventT0)
411 self.TH1F_Store[self.TH1F_Index[
"th1f_cdcEventT0_State"]].Fill(1)
413 self.TH1F_Store[self.TH1F_Index[
"th1f_cdcEventT0_State"]].Fill(0)
415 if not math.isnan(svdEventT0)
and not math.isnan(cdcEventT0):
416 self.TH2F_Store[self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0"]].Fill(svdEventT0, cdcEventT0)
417 self.TH2F_Store[self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0_rot45pos"]].Fill(
418 svdEventT0 * TMath.Cos(TMath.PiOver4()) + cdcEventT0 * TMath.Sin(TMath.PiOver4()),
419 - svdEventT0 * TMath.Sin(TMath.PiOver4()) + cdcEventT0 * TMath.Cos(TMath.PiOver4()))
420 self.TH2F_Store[self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0_rot45neg"]].Fill(
421 svdEventT0 * TMath.Cos(-TMath.PiOver4()) + cdcEventT0 * TMath.Sin(-TMath.PiOver4()),
422 - svdEventT0 * TMath.Sin(-TMath.PiOver4()) + cdcEventT0 * TMath.Cos(-TMath.PiOver4()))
427 topOnlineEventT0 = math.nan
428 for evt
in OnlineEventT0:
429 if evt.getOnlineEventT0Detector() == top:
430 topOnlineEventT0 = evt.getOnlineEventT0()
432 if not math.isnan(topOnlineEventT0)
and not math.isnan(svdEventT0):
433 self.TH1F_Store[self.TH1F_Index[
"th1f_svdEventT0topRef"]].Fill(svdEventT0 - topOnlineEventT0)
439 for trgHit
in TRGECLData:
440 hitWin = trgHit.getHitWin()
441 if hitWin != 3
and hitWin != 4:
443 if trgHit.getTCEnergy() > eclTCEmax:
444 eclTCEmax = trgHit.getTCEnergy()
447 self.TH1F_Store[self.TH1F_Index[
"th1f_eclTCEmax"]].Fill(eclTCEmax)
448 self.TH1F_Store[self.TH1F_Index[
"th1f_eclTCEmax_State"]].Fill(1)
449 if not math.isnan(topOnlineEventT0)
and not math.isnan(svdEventT0):
450 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_svdEventT0TopRef"]].Fill(
451 eclTCEmax, svdEventT0 - topOnlineEventT0)
453 self.TH1F_Store[self.TH1F_Index[
"th1f_eclTCEmax_State"]].Fill(0)
459 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalClusters_PreTracking"]].Fill(
460 eclTCEmax, len(clusterList))
462 for d
in clusterList:
463 clsTime = d.getClsTime()
465 self.TH1F_Store[self.TH1F_Index[
"th1f_clsTime_PreTracking"]].Fill(clsTime)
466 if not math.isnan(cdcEventT0):
467 self.TH1F_Store[self.TH1F_Index[
"th1f_clsTimeCdcRef_PreTracking"]].Fill(clsTime - cdcEventT0)
468 if not math.isnan(topOnlineEventT0)
and eclTCEmax:
469 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_clsTimeTopRef_PreTracking"]].Fill(
470 eclTCEmax, clsTime - topOnlineEventT0)
472 groupIds = d.getTimeGroupId()
473 groupInfo = d.getTimeGroupInfo()
479 for id
in range(len(groupIds)):
483 if len(groupInfo) > 0:
484 par0, par1, par2 = groupInfo[id]
486 if len(groupIds) == 0:
489 self.TH2F_Store[self.TH2F_Index[
"th2f_timeGr_vs_clsTime"]].Fill(clsTime, minId)
490 self.TH2F_Store[self.TH2F_Index[
"th2f_timeGr_vs_grAmp"]].Fill(par0, minId)
491 self.TH2F_Store[self.TH2F_Index[
"th2f_timeGr_vs_grCenter"]].Fill(par1, minId)
492 self.TH2F_Store[self.TH2F_Index[
"th2f_timeGr_vs_grWidth"]].Fill(par2, minId)
494 if fillOnce == minId
and fillOnce < 4:
495 if not math.isnan(cdcEventT0):
496 hname =
"th2f_sig" + str(fillOnce) +
"GrMean_vs_cdcEventT0"
497 self.TH2F_Store[self.TH2F_Index[hname]].Fill(par1, cdcEventT0)
498 hname =
"th2f_sig" + str(fillOnce) +
"GrMean_vs_cdcEventT0_rot45neg"
499 self.TH2F_Store[self.TH2F_Index[hname]].Fill(
500 par1 * TMath.Cos(-TMath.PiOver4()) + cdcEventT0 * TMath.Sin(-TMath.PiOver4()),
501 - par1 * TMath.Sin(-TMath.PiOver4()) + cdcEventT0 * TMath.Cos(-TMath.PiOver4()))
502 hname =
"th2f_sig" + str(fillOnce) +
"GrMean_vs_cdcEventT0_rot45pos"
503 self.TH2F_Store[self.TH2F_Index[hname]].Fill(
504 par1 * TMath.Cos(TMath.PiOver4()) + cdcEventT0 * TMath.Sin(TMath.PiOver4()),
505 - par1 * TMath.Sin(TMath.PiOver4()) + cdcEventT0 * TMath.Cos(TMath.PiOver4()))
509 self.TH1F_Store[self.TH1F_Index[
"th1f_sigClsTime_PreTracking"]].Fill(clsTime)
511 self.TH1F_Store[self.TH1F_Index[
"th1f_bkgClsTime_PreTracking"]].Fill(clsTime)
516 nTracks = len(recoTrackList)
518 for recoTrk
in recoTrackList:
519 if not recoTrk.wasFitSuccessful():
523 trackList = recoTrk.getRelationsFrom(
'Tracks')
524 if len(trackList) == 0:
527 trkTime0 = trackList[0].getTrackTime()
529 self.TH1F_Store[self.TH1F_Index[
"th1f_trackTime"]].Fill(trkTime0)
530 if not math.isnan(cdcEventT0):
531 self.TH1F_Store[self.TH1F_Index[
"th1f_trackTimeCDCRef"]].Fill(trkTime0 - cdcEventT0)
533 clusterList = recoTrk.getRelationsFrom(
"SVDClusters")
534 nClusters += len(clusterList)
535 if len(clusterList) == 0:
539 for d
in clusterList:
540 trkTime += d.getClsTime()
541 trkTime /= len(clusterList)
543 for d
in clusterList:
544 clsTime = d.getClsTime()
545 groupIds = d.getTimeGroupId()
546 groupInfo = d.getTimeGroupInfo()
548 if not math.isnan(svdEventT0):
549 self.TH2F_Store[self.TH2F_Index[
"th2f_trkTime_vs_clsTime_inSVDEventT0"]].Fill(
550 trkTime0 - clsTime, svdEventT0 - trkTime0)
551 if not math.isnan(cdcEventT0):
552 self.TH2F_Store[self.TH2F_Index[
"th2f_trkTime_vs_clsTime_inCDCEventT0"]].Fill(
553 trkTime0 - clsTime, cdcEventT0 - trkTime0)
554 self.TH2F_Store[self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_cdcEventT0"]].Fill(trkTime, cdcEventT0)
555 if not math.isnan(svdEventT0):
556 self.TH2F_Store[self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_clsTime_inSVDEventT0"]].Fill(
557 trkTime - clsTime, svdEventT0 - trkTime)
558 if not math.isnan(cdcEventT0):
559 self.TH2F_Store[self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_clsTime_inCDCEventT0"]].Fill(
560 trkTime - clsTime, cdcEventT0 - trkTime)
562 self.TH1F_Store[self.TH1F_Index[
"th1f_clsTime_PostTracking"]].Fill(clsTime)
563 if not math.isnan(cdcEventT0):
564 self.TH1F_Store[self.TH1F_Index[
"th1f_clsTimeCdcRef_PostTracking"]].Fill(clsTime - cdcEventT0)
565 if not math.isnan(topOnlineEventT0)
and eclTCEmax:
566 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_clsTimeTopRef_PostTracking"]].Fill(
567 eclTCEmax, clsTime - topOnlineEventT0)
573 if len(groupIds) == 0:
575 for id
in range(len(groupIds)):
579 if len(groupInfo) > 0:
580 par0, par1, par2 = groupInfo[id]
582 self.TH2F_Store[self.TH2F_Index[
"th2f_timeGr_vs_clsTime_PostTracking"]].Fill(clsTime, minId)
584 if par1 > sigMin
and par1 < sigMax:
585 self.TH1F_Store[self.TH1F_Index[
"th1f_sigClsTime_PostTracking"]].Fill(clsTime)
587 self.TH1F_Store[self.TH1F_Index[
"th1f_bkgClsTime_PostTracking"]].Fill(clsTime)
590 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalTracks"]].Fill(eclTCEmax, nTracks)
591 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalClusters_PostTracking"]].Fill(
592 eclTCEmax, nClusters)
597 self.f.mkdir(
"objects")
600 for hist
in self.TH1F_Store:
601 if "_State" in hist.GetName():
602 hist.Scale(1./hist.GetSumOfWeights())
605 for hist
in self.TH2F_Store:
608 for hist
in self.reso_TH2D_Histograms:
614 main = b2.create_path()
616 b2.set_random_seed(args.seed)
622 bkgFiles = get_background_files()
624 simulateJitter =
False
627 eventinfosetter = b2.register_module(
'EventInfoSetter')
628 eventinfosetter.param(
'expList', expList)
629 eventinfosetter.param(
'runList', [0])
630 eventinfosetter.param(
'evtNumList', [numEvents])
631 main.add_module(eventinfosetter)
632 ge.add_evtgen_generator(path=main, finalstate=
'mixed')
634 sim.add_simulation(main, bkgfiles=bkgFiles)
637 for m
in main.modules():
638 if m.name() ==
"SVDEventInfoSetter":
639 m.param(
"daqMode", 1)
640 m.param(
"relativeShift", 7)
641 m.param(
"useDB",
False)
647 b2conditions.override_globaltags()
648 b2conditions.globaltags = [
"online"]
649 b2conditions.prepend_globaltag(
"data_reprocessing_prompt")
650 b2conditions.prepend_globaltag(
"patch_main_release-07")
651 b2conditions.prepend_globaltag(
"patch_main_release-08")
652 if args.CoG3TimeCalibration_bucket36:
653 b2conditions.prepend_globaltag(
"svd_CoG3TimeCalibration_bucket36_withGrouping_pol3")
654 if args.CoG3TimeCalibration_bucket32:
655 b2conditions.prepend_globaltag(
"svd_CoG3TimeCalibration_bucket32_withGrouping_pol3")
660 main.add_module(
'RootInput', entrySequences=[
'0:100'])
662 main.add_module(
'RootInput')
664 main.add_module(
"Gearbox")
665 main.add_module(
'Geometry', useDB=
True)
667 raw.add_unpackers(main)
671 for moda
in main.modules():
672 if moda.name() ==
'SVDUnpacker':
673 moda.param(
"svdShaperDigitListName",
"SVDShaperDigits6Sample")
674 moda.param(
"SVDEventInfo",
"SVDEventInfo6Sample")
677 zsemulator = b2.register_module(
"SVD3SamplesEmulator")
678 zsemulator.param(
"outputSVDShaperDigits",
"SVDShaperDigits3SampleAll")
679 zsemulator.param(
"outputSVDEventInfo",
"SVDEventInfo")
680 zsemulator.param(
"chooseStartingSample",
False)
681 zsemulator.param(
"chooseRelativeShift",
True)
682 zsemulator.param(
"relativeShift", 7)
683 zsemulator.param(
"SVDShaperDigits",
"SVDShaperDigits6Sample")
684 zsemulator.param(
"SVDEventInfo",
"SVDEventInfo6Sample")
685 main.add_module(zsemulator)
687 zsonline = b2.register_module(
"SVDZeroSuppressionEmulator")
688 zsonline.param(
"ShaperDigits",
"SVDShaperDigits3SampleAll")
689 zsonline.param(
"ShaperDigitsIN",
"SVDShaperDigits")
690 main.add_module(zsonline)
694 trk.add_tracking_reconstruction(
696 mcTrackFinding=MCTracking,
697 append_full_grid_cdc_eventt0=
True)
701 for moda
in main.modules():
702 if moda.name() ==
'SVDClusterizer':
703 moda.param(
"returnClusterRawTime", args.isRawTime)
704 if moda.name() ==
'SVDTimeGrouping':
705 if args.doSVDGrouping:
706 moda.param(
"forceGroupingFromDB",
False)
707 moda.param(
"isEnabledIn6Samples",
True)
708 moda.param(
"isEnabledIn3Samples",
True)
709 moda.param(
"useParamFromDB",
False)
710 moda.param(
'tRangeLow', minTime)
711 moda.param(
'tRangeHigh', maxTime)
712 moda.param(
"expectedSignalTimeCenter", sigLoc)
713 moda.param(
'expectedSignalTimeMin', sigMin)
714 moda.param(
'expectedSignalTimeMax', sigMax)
715 moda.param(
"signalLifetime", args.signalLifetime)
716 if moda.name() ==
'SVDSpacePointCreator':
717 if args.useSVDGroupInfo:
718 moda.param(
"forceGroupingFromDB",
False)
719 moda.param(
"useSVDGroupInfoIn6Sample",
True)
720 moda.param(
"useSVDGroupInfoIn3Sample",
True)
721 moda.param(
"useParamFromDB",
False)
722 moda.param(
"numberOfSignalGroups", args.numberOfSignalGroups)
723 moda.param(
"formSingleSignalGroup", args.formSingleSignalGroup)
726 if args.executionTime:
727 executionFileName = str(args.fileDir) +
"SVDExecutionTime" + outputFileTag +
".root"
730 main.add_module(
'Progress')
The DetectorSet class for sets of detector IDs in the form of EDetector values.
A (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.