20from basf2
import conditions
as b2conditions
24import simulation
as sim
26from background
import get_background_files
27import generators
as ge
29from ROOT
import Belle2, TH1F, TH2F, TFile, TMath
33parser = argparse.ArgumentParser(description=__doc__)
34parser.add_argument(
"--seed", default=
"1",
36parser.add_argument(
"--fileDir", default=
"./",
37 help=
"Output File Dir")
38parser.add_argument(
"--fileTag", default=
"test",
39 help=
"Output File Tag")
40parser.add_argument(
"--moduleName", default=
"SVDGroupingPerformance",
42parser.add_argument(
"--isMC", action=
"store_true",
43 help=
"Use Simulation")
44parser.add_argument(
"--isRawTime", action=
"store_true",
45 help=
"Compute Raw SVD Time")
46parser.add_argument(
"--doSVDGrouping", action=
"store_true",
47 help=
"Perform grouping of SVD Clusters")
48parser.add_argument(
"--signalLifetime", type=float, default=30,
49 help=
"Lifetime of Signal when computing exponential-weigth for sorting signal groups")
50parser.add_argument(
"--numberOfSignalGroups", type=int, default=1,
51 help=
"Select only few signal groups")
52parser.add_argument(
"--formSingleSignalGroup", action=
"store_true",
53 help=
"Assign groupId 0 to every signal groups")
54parser.add_argument(
"--useSVDGroupInfo", action=
"store_true",
55 help=
"Use SVD Grouping info in SVDSpacePointCreator")
56parser.add_argument(
"--CoG3TimeCalibration_bucket36", action=
"store_true",
57 help=
"SVD Time calibration")
58parser.add_argument(
"--CoG3TimeCalibration_bucket32", action=
"store_true",
59 help=
"SVD Time calibration")
60parser.add_argument(
"--is3sample", action=
"store_true",
61 help=
"Emulate SVD 3 samples")
62parser.add_argument(
"--executionTime", action=
"store_true",
63 help=
"Store exection time tree")
64parser.add_argument(
"--test", action=
"store_true",
65 help=
"Test with small numbers of events")
66args = parser.parse_args()
67b2.B2INFO(f
"Steering file args = {args}")
70 b2.set_log_level(b2.LogLevel.DEBUG)
71 b2.set_debug_level(21)
76 outputFileTag +=
"_MC"
78 outputFileTag +=
"_emulated3sample"
80 outputFileTag +=
"_RawTime"
82 outputFileTag +=
"_Grouping"
83 outputFileTag +=
"_sigLifeTime" + str(int(args.signalLifetime))
84 outputFileTag +=
"_Signal" + str(int(args.numberOfSignalGroups))
85 if args.formSingleSignalGroup:
86 outputFileTag +=
"_SuperGroup"
87 if args.useSVDGroupInfo:
88 outputFileTag +=
"_UsedInSPs"
89outputFileTag +=
"_" + str(args.fileTag)
109 ''' check cluster grouping'''
112 '''define histograms'''
119 timeBin = int(maxTime - minTime)
130 self.reso_TH2D_Histogram_Index = {}
131 self.reso_TH2D_Histograms = []
132 reso_TH2D_Histograms_Count = 0
134 self.outputFileName = str(args.fileDir) + str(args.moduleName) + outputFileTag
135 self.f = TFile(self.outputFileName +
".root",
"RECREATE")
140 self.TH1F_Store.append(TH1F(
"th1f_svdEventT0",
"SVD EventT0", 500, -50., 50.))
141 self.TH1F_Store[-1].GetXaxis().SetTitle(
"SVD EventT0 (ns)")
142 self.TH1F_Index[
"th1f_svdEventT0"] = TH1F_Store_Count
143 TH1F_Store_Count += 1
144 self.TH1F_Store.append(TH1F(
"th1f_svdEventT0_State",
"SVD EventT0 Availability", 2, -0.5, 1.5))
145 self.TH1F_Store[-1].GetXaxis().SetBinLabel(1,
"Not Available")
146 self.TH1F_Store[-1].GetXaxis().SetBinLabel(2,
"Available")
147 self.TH1F_Index[
"th1f_svdEventT0_State"] = TH1F_Store_Count
148 TH1F_Store_Count += 1
150 self.TH1F_Store.append(TH1F(
"th1f_cdcEventT0",
"CDC EventT0", 500, -50., 50.))
151 self.TH1F_Store[-1].GetXaxis().SetTitle(
"CDC EventT0 (ns)")
152 self.TH1F_Index[
"th1f_cdcEventT0"] = TH1F_Store_Count
153 TH1F_Store_Count += 1
154 self.TH1F_Store.append(TH1F(
"th1f_cdcEventT0_State",
"CDC EventT0 Availability", 2, -0.5, 1.5))
155 self.TH1F_Store[-1].GetXaxis().SetBinLabel(1,
"Not Available")
156 self.TH1F_Store[-1].GetXaxis().SetBinLabel(2,
"Available")
157 self.TH1F_Index[
"th1f_cdcEventT0_State"] = TH1F_Store_Count
158 TH1F_Store_Count += 1
162 self.TH1F_Store.append(TH1F(
"th1f_svdEventT0topRef",
"SVD EventT0 - TOP Online EventT0", 500, -20., 20.))
163 self.TH1F_Store[-1].GetXaxis().SetTitle(
"SVD EventT0 - TOP Online EventT0 (ns)")
164 self.TH1F_Index[
"th1f_svdEventT0topRef"] = TH1F_Store_Count
165 TH1F_Store_Count += 1
169 self.TH1F_Store.append(TH1F(
"th1f_clsTime_PreTracking",
"(PreTracking) Cluster Time", timeBin, minTime, maxTime))
170 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
171 self.TH1F_Store[-1].SetLineColor(1)
172 self.TH1F_Index[
"th1f_clsTime_PreTracking"] = TH1F_Store_Count
173 TH1F_Store_Count += 1
174 self.TH1F_Store.append(TH1F(
"th1f_bkgClsTime_PreTracking",
"(PreTracking) Bkg Cluster Time", timeBin, minTime, maxTime))
175 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
176 self.TH1F_Store[-1].SetLineColor(2)
177 self.TH1F_Index[
"th1f_bkgClsTime_PreTracking"] = TH1F_Store_Count
178 TH1F_Store_Count += 1
179 self.TH1F_Store.append(TH1F(
"th1f_sigClsTime_PreTracking",
"(PreTracking) Sig Cluster Time", timeBin, minTime, maxTime))
180 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
181 self.TH1F_Store[-1].SetLineColor(3)
182 self.TH1F_Index[
"th1f_sigClsTime_PreTracking"] = TH1F_Store_Count
183 TH1F_Store_Count += 1
185 self.TH1F_Store.append(TH1F(
"th1f_clsTime_PostTracking",
"(PostTracking) Cluster Time", timeBin, minTime, maxTime))
186 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
187 self.TH1F_Store[-1].SetLineColor(1)
188 self.TH1F_Index[
"th1f_clsTime_PostTracking"] = TH1F_Store_Count
189 TH1F_Store_Count += 1
190 self.TH1F_Store.append(TH1F(
"th1f_bkgClsTime_PostTracking",
"(PostTracking) Bkg Cluster Time", timeBin, minTime, maxTime))
191 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
192 self.TH1F_Store[-1].SetLineColor(2)
193 self.TH1F_Index[
"th1f_bkgClsTime_PostTracking"] = TH1F_Store_Count
194 TH1F_Store_Count += 1
195 self.TH1F_Store.append(TH1F(
"th1f_sigClsTime_PostTracking",
"(PostTracking) Sig Cluster Time", timeBin, minTime, maxTime))
196 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
197 self.TH1F_Store[-1].SetLineColor(3)
198 self.TH1F_Index[
"th1f_sigClsTime_PostTracking"] = TH1F_Store_Count
199 TH1F_Store_Count += 1
201 self.TH1F_Store.append(TH1F(
"th1f_trackTime",
"Track Time", timeBin * 10, minTime, maxTime))
202 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Track Time (ns)")
203 self.TH1F_Index[
"th1f_trackTime"] = TH1F_Store_Count
204 TH1F_Store_Count += 1
205 self.TH1F_Store.append(TH1F(
"th1f_trackTimeCDCRef",
"Track Time - CDC EventT0", 10000, -50, 50))
206 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Track Time - CDC EventT0 (ns)")
207 self.TH1F_Index[
"th1f_trackTimeCDCRef"] = TH1F_Store_Count
208 TH1F_Store_Count += 1
212 self.TH1F_Store.append(TH1F(
"th1f_clsTimeCdcRef_PreTracking",
"(PreTracking) Cluster Time - CDC EventT0",
213 timeBin * 2, minTime, maxTime))
214 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time - CDC EventT0 (ns)")
215 self.TH1F_Store[-1].SetLineColor(1)
216 self.TH1F_Index[
"th1f_clsTimeCdcRef_PreTracking"] = TH1F_Store_Count
217 TH1F_Store_Count += 1
219 self.TH1F_Store.append(TH1F(
"th1f_clsTimeCdcRef_PostTracking",
"(PostTracking) Cluster Time - CDC EventT0",
220 timeBin * 2, minTime, maxTime))
221 self.TH1F_Store[-1].GetXaxis().SetTitle(
"Cluster Time - CDC EventT0 (ns)")
222 self.TH1F_Store[-1].SetLineColor(1)
223 self.TH1F_Index[
"th1f_clsTimeCdcRef_PostTracking"] = TH1F_Store_Count
224 TH1F_Store_Count += 1
228 self.TH1F_Store.append(TH1F(
"th1f_eclTCEmax",
"ECL E_{max}^{TC}", 1250, 0.5, 1250.5))
229 self.TH1F_Store[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
230 self.TH1F_Index[
"th1f_eclTCEmax"] = TH1F_Store_Count
231 TH1F_Store_Count += 1
232 self.TH1F_Store.append(TH1F(
"th1f_eclTCEmax_State",
"ECL E_{max}^{TC} Availability", 2, -0.5, 1.5))
233 self.TH1F_Store[-1].GetXaxis().SetBinLabel(1,
"Not Available")
234 self.TH1F_Store[-1].GetXaxis().SetBinLabel(2,
"Available")
235 self.TH1F_Index[
"th1f_eclTCEmax_State"] = TH1F_Store_Count
236 TH1F_Store_Count += 1
238 self.TH2F_Store.append(TH2F(
"th2f_timeGr_vs_grAmp",
"Time Group vs Group Amplitude", 60, 0., 300, 21, -1.5, 19.5))
239 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Group Amplitude")
240 self.TH2F_Store[-1].GetYaxis().SetTitle(
"Time Group")
241 self.TH2F_Index[
"th2f_timeGr_vs_grAmp"] = TH2F_Store_Count
242 TH2F_Store_Count += 1
243 self.TH2F_Store.append(TH2F(
"th2f_timeGr_vs_grCenter",
"Time Group vs Group Center", 80, minTime, maxTime, 21, -1.5, 19.5))
244 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Group Center (ns)")
245 self.TH2F_Store[-1].GetYaxis().SetTitle(
"Time Group")
246 self.TH2F_Index[
"th2f_timeGr_vs_grCenter"] = TH2F_Store_Count
247 TH2F_Store_Count += 1
248 self.TH2F_Store.append(TH2F(
"th2f_timeGr_vs_grWidth",
"Time Group vs Group Width", 50, 1, 11, 21, -1.5, 19.5))
249 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Group Width (ns)")
250 self.TH2F_Store[-1].GetYaxis().SetTitle(
"Time Group")
251 self.TH2F_Index[
"th2f_timeGr_vs_grWidth"] = TH2F_Store_Count
252 TH2F_Store_Count += 1
253 self.TH2F_Store.append(TH2F(
"th2f_timeGr_vs_clsTime",
"Time Group vs Cluster Time",
254 timeBin, minTime, maxTime, 21, -1.5, 19.5))
255 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
256 self.TH2F_Store[-1].GetYaxis().SetTitle(
"Time Group")
257 self.TH2F_Index[
"th2f_timeGr_vs_clsTime"] = TH2F_Store_Count
258 TH2F_Store_Count += 1
259 self.TH2F_Store.append(TH2F(
"th2f_timeGr_vs_clsTime_PostTracking",
"(PostTracking) Time Group vs Cluster Time",
260 timeBin, minTime, maxTime, 21, -1.5, 19.5))
261 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Cluster Time (ns)")
262 self.TH2F_Store[-1].GetYaxis().SetTitle(
"Time Group")
263 self.TH2F_Index[
"th2f_timeGr_vs_clsTime_PostTracking"] = TH2F_Store_Count
264 TH2F_Store_Count += 1
267 self.TH2F_Store.append(TH2F(
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0",
"Center of 'Group " +
268 str(i) +
"' vs CDC EventT0", 500, -50., 50., 500, -50., 50.))
269 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Center of 'Group " + str(i) +
"' (ns)")
270 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
271 self.TH2F_Index[
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0"] = TH2F_Store_Count
272 TH2F_Store_Count += 1
273 self.TH2F_Store.append(TH2F(
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0_rot45pos",
274 "Center of 'Group " + str(i) +
"' vs CDC EventT0 (Rotated 45)",
275 500, -50., 50., 500, -50., 50.))
276 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Center of 'Group " + str(i) +
"' (ns)")
277 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
278 self.TH2F_Index[
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0_rot45pos"] = TH2F_Store_Count
279 TH2F_Store_Count += 1
280 self.TH2F_Store.append(TH2F(
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0_rot45neg",
281 "Center of 'Group " + str(i) +
"' vs CDC EventT0 (Rotated -45)",
282 500, -50., 50., 500, -50., 50.))
283 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Center of 'Group " + str(i) +
"' (ns)")
284 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
285 self.TH2F_Index[
"th2f_sig" + str(i) +
"GrMean_vs_cdcEventT0_rot45neg"] = TH2F_Store_Count
286 TH2F_Store_Count += 1
288 self.TH2F_Store.append(TH2F(
"th2f_aveClsTimeInTrk_vs_cdcEventT0",
289 "Track Time vs CDC EventT0", 500, -50., 50., 500, -50., 50.))
290 self.TH2F_Store[-1].GetXaxis().SetTitle(
"<Cluster Time> in Track (ns)")
291 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
292 self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_cdcEventT0"] = TH2F_Store_Count
293 TH2F_Store_Count += 1
294 self.TH2F_Store.append(TH2F(
"th2f_svdEventT0_vs_cdcEventT0",
"SVD EventT0 vs CDC EventT0",
295 500, -50., 50., 500, -50., 50.))
296 self.TH2F_Store[-1].GetXaxis().SetTitle(
"SVD EventT0 (ns)")
297 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
298 self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0"] = TH2F_Store_Count
299 TH2F_Store_Count += 1
300 self.TH2F_Store.append(TH2F(
"th2f_svdEventT0_vs_cdcEventT0_rot45pos",
301 "SVD EventT0 vs CDC EventT0 (Rotated 45)", 500, -50., 50., 500, -50., 50.))
302 self.TH2F_Store[-1].GetXaxis().SetTitle(
"SVD EventT0 (ns)")
303 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
304 self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0_rot45pos"] = TH2F_Store_Count
305 TH2F_Store_Count += 1
306 self.TH2F_Store.append(TH2F(
"th2f_svdEventT0_vs_cdcEventT0_rot45neg",
307 "SVD EventT0 vs CDC EventT0 (Rotated -45)", 500, -50., 50., 500, -50., 50.))
308 self.TH2F_Store[-1].GetXaxis().SetTitle(
"SVD EventT0 (ns)")
309 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 (ns)")
310 self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0_rot45neg"] = TH2F_Store_Count
311 TH2F_Store_Count += 1
313 self.TH2F_Store.append(TH2F(
"th2f_trkTime_vs_clsTime_inCDCEventT0",
"Track Time vs Cluster Time",
314 timeBin, minTime, maxTime, timeBin, minTime, maxTime))
315 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Track Time - Cluster Time (ns)")
316 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 - Track Time (ns)")
317 self.TH2F_Index[
"th2f_trkTime_vs_clsTime_inCDCEventT0"] = TH2F_Store_Count
318 TH2F_Store_Count += 1
319 self.TH2F_Store.append(TH2F(
"th2f_trkTime_vs_clsTime_inSVDEventT0",
"Track Time vs Cluster Time",
320 timeBin, minTime, maxTime, timeBin, minTime, maxTime))
321 self.TH2F_Store[-1].GetXaxis().SetTitle(
"Track Time - Cluster Time (ns)")
322 self.TH2F_Store[-1].GetYaxis().SetTitle(
"SVD EventT0 - Track Time (ns)")
323 self.TH2F_Index[
"th2f_trkTime_vs_clsTime_inSVDEventT0"] = TH2F_Store_Count
324 TH2F_Store_Count += 1
326 self.TH2F_Store.append(TH2F(
"th2f_aveClsTimeInTrk_vs_clsTime_inCDCEventT0",
"<Cluster Time> in Track vs Cluster Time",
327 timeBin, minTime, maxTime, timeBin, minTime, maxTime))
328 self.TH2F_Store[-1].GetXaxis().SetTitle(
"<Cluster Time> in Track - Cluster Time (ns)")
329 self.TH2F_Store[-1].GetYaxis().SetTitle(
"CDC EventT0 - <Cluster Time> in Track (ns)")
330 self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_clsTime_inCDCEventT0"] = TH2F_Store_Count
331 TH2F_Store_Count += 1
332 self.TH2F_Store.append(TH2F(
"th2f_aveClsTimeInTrk_vs_clsTime_inSVDEventT0",
"<Cluster Time> in Track vs Cluster Time",
333 timeBin, minTime, maxTime, timeBin, minTime, maxTime))
334 self.TH2F_Store[-1].GetXaxis().SetTitle(
"<Cluster Time> in Track - Cluster Time (ns)")
335 self.TH2F_Store[-1].GetYaxis().SetTitle(
"SVD EventT0 - <Cluster Time> in Track (ns)")
336 self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_clsTime_inSVDEventT0"] = TH2F_Store_Count
337 TH2F_Store_Count += 1
341 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_clsTimeTopRef_PreTracking",
342 "(PreTracking) ECL E_{max}^{TC} vs Cluster Time - TOP Online EventT0",
343 usedBin1, eclMinVal, eclMaxVal, usedBin2, -50, 50.))
344 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
345 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"Cluster Time - TOP Online EventT0 (ns)")
346 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_clsTimeTopRef_PreTracking"] = reso_TH2D_Histograms_Count
347 reso_TH2D_Histograms_Count += 1
348 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_clsTimeTopRef_PostTracking",
349 "(PostTracking) ECL E_{max}^{TC} vs Cluster Time - TOP Online EventT0",
350 usedBin1, eclMinVal, eclMaxVal, usedBin2, -50, 50.))
351 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
352 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"Cluster Time - TOP Online EventT0 (ns)")
353 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_clsTimeTopRef_PostTracking"] = reso_TH2D_Histograms_Count
354 reso_TH2D_Histograms_Count += 1
356 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_svdEventT0TopRef",
357 "ECL E_{max}^{TC} vs SVD EventT0 - TOP Online EventT0",
358 usedBin1, eclMinVal, eclMaxVal, usedBin2, -50, 50.))
359 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
360 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"SVD EventT0 - TOP Online EventT0 (ns)")
361 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_svdEventT0TopRef"] = reso_TH2D_Histograms_Count
362 reso_TH2D_Histograms_Count += 1
364 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_totalTracks",
365 "ECL E_{max}^{TC} vs Total SVD Tracks",
366 usedBin1, eclMinVal, eclMaxVal, 36, -0.5, 35.5))
367 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
368 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"Total SVD Tracks")
369 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalTracks"] = reso_TH2D_Histograms_Count
370 reso_TH2D_Histograms_Count += 1
372 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_totalClusters_PreTracking",
373 "(PreTracking) ECL E_{max}^{TC} vs Total SVD Clusters",
374 usedBin1, eclMinVal, eclMaxVal, 1000, 0.5, 1000.5))
375 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
376 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"Total SVD Clusters")
377 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalClusters_PreTracking"] = reso_TH2D_Histograms_Count
378 reso_TH2D_Histograms_Count += 1
379 self.reso_TH2D_Histograms.append(TH2F(
"reso_eclTCEmax_vs_totalClusters_PostTracking",
380 "(PostTracking) ECL E_{max}^{TC} vs Total SVD Clusters",
381 usedBin1, eclMinVal, eclMaxVal, 1000, 0.5, 1000.5))
382 self.reso_TH2D_Histograms[-1].GetXaxis().SetTitle(
"ECL E_{max}^{TC} (ADC)")
383 self.reso_TH2D_Histograms[-1].GetYaxis().SetTitle(
"Total SVD Clusters")
384 self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalClusters_PostTracking"] = reso_TH2D_Histograms_Count
385 reso_TH2D_Histograms_Count += 1
391 svdEventT0 = math.nan
392 cdcEventT0 = math.nan
396 if EventT0.hasTemporaryEventT0(svd):
397 tmp = EventT0.getTemporaryEventT0s(Belle2.Const.SVD)
398 svdEventT0 = tmp.back().eventT0
399 if EventT0.hasTemporaryEventT0(cdc):
400 tmp = EventT0.getTemporaryEventT0s(Belle2.Const.CDC)
401 cdcEventT0 = tmp.back().eventT0
403 if not math.isnan(svdEventT0):
404 self.TH1F_Store[self.TH1F_Index[
"th1f_svdEventT0"]].Fill(svdEventT0)
405 self.TH1F_Store[self.TH1F_Index[
"th1f_svdEventT0_State"]].Fill(1)
407 self.TH1F_Store[self.TH1F_Index[
"th1f_svdEventT0_State"]].Fill(0)
408 if not math.isnan(cdcEventT0):
409 self.TH1F_Store[self.TH1F_Index[
"th1f_cdcEventT0"]].Fill(cdcEventT0)
410 self.TH1F_Store[self.TH1F_Index[
"th1f_cdcEventT0_State"]].Fill(1)
412 self.TH1F_Store[self.TH1F_Index[
"th1f_cdcEventT0_State"]].Fill(0)
414 if not math.isnan(svdEventT0)
and not math.isnan(cdcEventT0):
415 self.TH2F_Store[self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0"]].Fill(svdEventT0, cdcEventT0)
416 self.TH2F_Store[self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0_rot45pos"]].Fill(
417 svdEventT0 * TMath.Cos(TMath.PiOver4()) + cdcEventT0 * TMath.Sin(TMath.PiOver4()),
418 - svdEventT0 * TMath.Sin(TMath.PiOver4()) + cdcEventT0 * TMath.Cos(TMath.PiOver4()))
419 self.TH2F_Store[self.TH2F_Index[
"th2f_svdEventT0_vs_cdcEventT0_rot45neg"]].Fill(
420 svdEventT0 * TMath.Cos(-TMath.PiOver4()) + cdcEventT0 * TMath.Sin(-TMath.PiOver4()),
421 - svdEventT0 * TMath.Sin(-TMath.PiOver4()) + cdcEventT0 * TMath.Cos(-TMath.PiOver4()))
426 topOnlineEventT0 = math.nan
427 for evt
in OnlineEventT0:
428 if evt.getOnlineEventT0Detector() == top:
429 topOnlineEventT0 = evt.getOnlineEventT0()
431 if not math.isnan(topOnlineEventT0)
and not math.isnan(svdEventT0):
432 self.TH1F_Store[self.TH1F_Index[
"th1f_svdEventT0topRef"]].Fill(svdEventT0 - topOnlineEventT0)
438 for trgHit
in TRGECLData:
439 hitWin = trgHit.getHitWin()
440 if hitWin != 3
and hitWin != 4:
442 if trgHit.getTCEnergy() > eclTCEmax:
443 eclTCEmax = trgHit.getTCEnergy()
446 self.TH1F_Store[self.TH1F_Index[
"th1f_eclTCEmax"]].Fill(eclTCEmax)
447 self.TH1F_Store[self.TH1F_Index[
"th1f_eclTCEmax_State"]].Fill(1)
448 if not math.isnan(topOnlineEventT0)
and not math.isnan(svdEventT0):
449 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_svdEventT0TopRef"]].Fill(
450 eclTCEmax, svdEventT0 - topOnlineEventT0)
452 self.TH1F_Store[self.TH1F_Index[
"th1f_eclTCEmax_State"]].Fill(0)
458 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalClusters_PreTracking"]].Fill(
459 eclTCEmax, len(clusterList))
461 for d
in clusterList:
462 clsTime = d.getClsTime()
464 self.TH1F_Store[self.TH1F_Index[
"th1f_clsTime_PreTracking"]].Fill(clsTime)
465 if not math.isnan(cdcEventT0):
466 self.TH1F_Store[self.TH1F_Index[
"th1f_clsTimeCdcRef_PreTracking"]].Fill(clsTime - cdcEventT0)
467 if not math.isnan(topOnlineEventT0)
and eclTCEmax:
468 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_clsTimeTopRef_PreTracking"]].Fill(
469 eclTCEmax, clsTime - topOnlineEventT0)
471 groupIds = d.getTimeGroupId()
472 groupInfo = d.getTimeGroupInfo()
478 for id
in range(len(groupIds)):
482 if len(groupInfo) > 0:
483 par0, par1, par2 = groupInfo[id]
485 if len(groupIds) == 0:
488 self.TH2F_Store[self.TH2F_Index[
"th2f_timeGr_vs_clsTime"]].Fill(clsTime, minId)
489 self.TH2F_Store[self.TH2F_Index[
"th2f_timeGr_vs_grAmp"]].Fill(par0, minId)
490 self.TH2F_Store[self.TH2F_Index[
"th2f_timeGr_vs_grCenter"]].Fill(par1, minId)
491 self.TH2F_Store[self.TH2F_Index[
"th2f_timeGr_vs_grWidth"]].Fill(par2, minId)
493 if fillOnce == minId
and fillOnce < 4:
494 if not math.isnan(cdcEventT0):
495 hname =
"th2f_sig" + str(fillOnce) +
"GrMean_vs_cdcEventT0"
496 self.TH2F_Store[self.TH2F_Index[hname]].Fill(par1, cdcEventT0)
497 hname =
"th2f_sig" + str(fillOnce) +
"GrMean_vs_cdcEventT0_rot45neg"
498 self.TH2F_Store[self.TH2F_Index[hname]].Fill(
499 par1 * TMath.Cos(-TMath.PiOver4()) + cdcEventT0 * TMath.Sin(-TMath.PiOver4()),
500 - par1 * TMath.Sin(-TMath.PiOver4()) + cdcEventT0 * TMath.Cos(-TMath.PiOver4()))
501 hname =
"th2f_sig" + str(fillOnce) +
"GrMean_vs_cdcEventT0_rot45pos"
502 self.TH2F_Store[self.TH2F_Index[hname]].Fill(
503 par1 * TMath.Cos(TMath.PiOver4()) + cdcEventT0 * TMath.Sin(TMath.PiOver4()),
504 - par1 * TMath.Sin(TMath.PiOver4()) + cdcEventT0 * TMath.Cos(TMath.PiOver4()))
508 self.TH1F_Store[self.TH1F_Index[
"th1f_sigClsTime_PreTracking"]].Fill(clsTime)
510 self.TH1F_Store[self.TH1F_Index[
"th1f_bkgClsTime_PreTracking"]].Fill(clsTime)
515 nTracks = len(recoTrackList)
517 for recoTrk
in recoTrackList:
518 if not recoTrk.wasFitSuccessful():
522 trackList = recoTrk.getRelationsFrom(
'Tracks')
523 if len(trackList) == 0:
526 trkTime0 = trackList[0].getTrackTime()
528 self.TH1F_Store[self.TH1F_Index[
"th1f_trackTime"]].Fill(trkTime0)
529 if not math.isnan(cdcEventT0):
530 self.TH1F_Store[self.TH1F_Index[
"th1f_trackTimeCDCRef"]].Fill(trkTime0 - cdcEventT0)
532 clusterList = recoTrk.getRelationsFrom(
"SVDClusters")
533 nClusters += len(clusterList)
534 if len(clusterList) == 0:
538 for d
in clusterList:
539 trkTime += d.getClsTime()
540 trkTime /= len(clusterList)
542 for d
in clusterList:
543 clsTime = d.getClsTime()
544 groupIds = d.getTimeGroupId()
545 groupInfo = d.getTimeGroupInfo()
547 if not math.isnan(svdEventT0):
548 self.TH2F_Store[self.TH2F_Index[
"th2f_trkTime_vs_clsTime_inSVDEventT0"]].Fill(
549 trkTime0 - clsTime, svdEventT0 - trkTime0)
550 if not math.isnan(cdcEventT0):
551 self.TH2F_Store[self.TH2F_Index[
"th2f_trkTime_vs_clsTime_inCDCEventT0"]].Fill(
552 trkTime0 - clsTime, cdcEventT0 - trkTime0)
553 self.TH2F_Store[self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_cdcEventT0"]].Fill(trkTime, cdcEventT0)
554 if not math.isnan(svdEventT0):
555 self.TH2F_Store[self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_clsTime_inSVDEventT0"]].Fill(
556 trkTime - clsTime, svdEventT0 - trkTime)
557 if not math.isnan(cdcEventT0):
558 self.TH2F_Store[self.TH2F_Index[
"th2f_aveClsTimeInTrk_vs_clsTime_inCDCEventT0"]].Fill(
559 trkTime - clsTime, cdcEventT0 - trkTime)
561 self.TH1F_Store[self.TH1F_Index[
"th1f_clsTime_PostTracking"]].Fill(clsTime)
562 if not math.isnan(cdcEventT0):
563 self.TH1F_Store[self.TH1F_Index[
"th1f_clsTimeCdcRef_PostTracking"]].Fill(clsTime - cdcEventT0)
564 if not math.isnan(topOnlineEventT0)
and eclTCEmax:
565 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_clsTimeTopRef_PostTracking"]].Fill(
566 eclTCEmax, clsTime - topOnlineEventT0)
572 if len(groupIds) == 0:
574 for id
in range(len(groupIds)):
578 if len(groupInfo) > 0:
579 par0, par1, par2 = groupInfo[id]
581 self.TH2F_Store[self.TH2F_Index[
"th2f_timeGr_vs_clsTime_PostTracking"]].Fill(clsTime, minId)
583 if par1 > sigMin
and par1 < sigMax:
584 self.TH1F_Store[self.TH1F_Index[
"th1f_sigClsTime_PostTracking"]].Fill(clsTime)
586 self.TH1F_Store[self.TH1F_Index[
"th1f_bkgClsTime_PostTracking"]].Fill(clsTime)
589 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalTracks"]].Fill(eclTCEmax, nTracks)
590 self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index[
"reso_eclTCEmax_vs_totalClusters_PostTracking"]].Fill(
591 eclTCEmax, nClusters)
596 self.f.mkdir(
"objects")
599 for hist
in self.TH1F_Store:
600 if "_State" in hist.GetName():
601 hist.Scale(1./hist.GetSumOfWeights())
604 for hist
in self.TH2F_Store:
607 for hist
in self.reso_TH2D_Histograms:
613main = b2.create_path()
615b2.set_random_seed(args.seed)
621 bkgFiles = get_background_files()
623 simulateJitter =
False
626 eventinfosetter = b2.register_module(
'EventInfoSetter')
627 eventinfosetter.param(
'expList', expList)
628 eventinfosetter.param(
'runList', [0])
629 eventinfosetter.param(
'evtNumList', [numEvents])
630 main.add_module(eventinfosetter)
631 ge.add_evtgen_generator(path=main, finalstate=
'mixed')
633 sim.add_simulation(main, bkgfiles=bkgFiles)
636 for m
in main.modules():
637 if m.name() ==
"SVDEventInfoSetter":
638 m.param(
"daqMode", 1)
639 m.param(
"relativeShift", 7)
640 m.param(
"useDB",
False)
646 b2conditions.override_globaltags()
647 b2conditions.globaltags = [
"online"]
648 b2conditions.prepend_globaltag(
"data_reprocessing_prompt")
649 b2conditions.prepend_globaltag(
"patch_main_release-07")
650 b2conditions.prepend_globaltag(
"patch_main_release-08")
651 if args.CoG3TimeCalibration_bucket36:
652 b2conditions.prepend_globaltag(
"svd_CoG3TimeCalibration_bucket36_withGrouping_pol3")
653 if args.CoG3TimeCalibration_bucket32:
654 b2conditions.prepend_globaltag(
"svd_CoG3TimeCalibration_bucket32_withGrouping_pol3")
659 main.add_module(
'RootInput', entrySequences=[
'0:100'])
661 main.add_module(
'RootInput')
663 main.add_module(
"Gearbox")
664 main.add_module(
'Geometry', useDB=
True)
666 raw.add_unpackers(main)
670 for moda
in main.modules():
671 if moda.name() ==
'SVDUnpacker':
672 moda.param(
"svdShaperDigitListName",
"SVDShaperDigits6Sample")
673 moda.param(
"SVDEventInfo",
"SVDEventInfo6Sample")
676 zsemulator = b2.register_module(
"SVD3SamplesEmulator")
677 zsemulator.param(
"outputSVDShaperDigits",
"SVDShaperDigits3SampleAll")
678 zsemulator.param(
"outputSVDEventInfo",
"SVDEventInfo")
679 zsemulator.param(
"chooseStartingSample",
False)
680 zsemulator.param(
"chooseRelativeShift",
True)
681 zsemulator.param(
"relativeShift", 7)
682 zsemulator.param(
"SVDShaperDigits",
"SVDShaperDigits6Sample")
683 zsemulator.param(
"SVDEventInfo",
"SVDEventInfo6Sample")
684 main.add_module(zsemulator)
686 zsonline = b2.register_module(
"SVDZeroSuppressionEmulator")
687 zsonline.param(
"ShaperDigits",
"SVDShaperDigits3SampleAll")
688 zsonline.param(
"ShaperDigitsIN",
"SVDShaperDigits")
689 main.add_module(zsonline)
693trk.add_tracking_reconstruction(
695 mcTrackFinding=MCTracking,
696 append_full_grid_cdc_eventt0=
True,
697 skip_full_grid_cdc_eventt0_if_svd_time_present=
False)
701for 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)
726if args.executionTime:
727 executionFileName = str(args.fileDir) +
"SVDExecutionTime" + outputFileTag +
".root"
730main.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.