Belle II Software development
evaluateSimulation.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12from basf2 import conditions as b2conditions
13from simulation import add_simulation
14
15numEvents = 2000
16svdOnlySimulation = False
17
18if svdOnlySimulation:
19 b2conditions.prepend_globaltag("svd_onlySVDinGeoConfiguration")
20
21main = b2.create_path()
22
23b2.set_random_seed(1)
24
25eventinfosetter = b2.register_module('EventInfoSetter')
26eventinfosetter.param('expList', [0])
27eventinfosetter.param('runList', [1])
28eventinfosetter.param('evtNumList', [numEvents])
29main.add_module(eventinfosetter)
30main.add_module('EventInfoPrinter')
31main.add_module('EvtGenInput')
32
33if not svdOnlySimulation:
34 # Belle2 Simulation
35 add_simulation(main, simulateT0jitter=True, usePXDDataReduction=False, forceSetPXDDataReduction=True)
36
37 for m in main.modules():
38 if m.name() == "SVDEventInfoSetter":
39 m.param("useDB", True)
40 m.param("daqMode", 3)
41 m.param("relativeShift", 9)
42 m.set_log_level(b2.LogLevel.DEBUG)
43 m.set_debug_level(25)
44 if m.name() == "SVDDigitizer":
45 m.set_log_level(b2.LogLevel.INFO)
46 m.set_debug_level(25)
47
48else:
49
50 # gearbox
51 main.add_module('Gearbox')
52
53 # detector geometry
54 geometry = b2.register_module('Geometry')
55 main.add_module(geometry)
56
57 # event T0 jitter simulation
58 eventt0 = b2.register_module('EventT0Generator')
59 eventt0.param('coreGaussWidth', 10.0) # 10 sigma of core gaussian [ns]
60 # eventt0.param('fixedT0', nan) If set, a fixed event t0 is used instead of simulating the bunch timing.
61 eventt0.param('tailGaussFraction', 0.0) # 0 fraction (by area) of tail gaussian
62 eventt0.param('tailGaussWidth', 20.0) # 20 sigma of tail gaussian [ns]
63 # main.add_module(eventt0)
64
65 # detector simulation
66 main.add_module('FullSim')
67
68 # including the timing module
69 # main.add_module("FullSimTiming", rootFile="EvtGenTiming.root", logLevel=LogLevel.INFO)
70
71 # from svd import add_svd_trgsummary
72 # add_svd_trgsummary(main)
73
74 # SVD simulation
75 svdevtinfoset = b2.register_module("SVDEventInfoSetter")
76 # svdevtinfoset.param("useDB",True)
77 svdevtinfoset.param("daqMode", 3)
78 svdevtinfoset.param("relativeShift", 9)
79 svdevtinfoset.set_log_level(b2.LogLevel.DEBUG)
80 svdevtinfoset.set_debug_level(25)
81
82 main.add_module(svdevtinfoset)
83
84 digitizer = b2.register_module('SVDDigitizer')
85 digitizer.param('statisticsFilename', "digitizer_test2021_1_hwclock.root")
86 digitizer.param('storeWaveforms', True)
87 digitizer.param('signalsList', "digitizer_test2021_1_hwclock.txt")
88 digitizer.set_log_level(b2.LogLevel.DEBUG)
89 digitizer.set_debug_level(30)
90 main.add_module(digitizer)
91
92main.add_module('RootOutput')
93main.add_module('Progress')
94
95b2.print_path(main)
96
97b2.process(main)
98
99print(b2.statistics)