12 from ROOT
import Belle2
19 """Returns 1 if current event contains at least one BEAST hit, 0 otherwise"""
22 """reimplementation of Module::initialize()."""
25 """reimplementation of Module::event()."""
31 if len(p.getRelationsTo(
'MicrotpcSimHits')) > 0 \
32 or len(p.getRelationsTo(
'He3tubeSimHits')) > 0 \
33 or len(p.getRelationsTo(
'PindiodeSimHits')) > 0 \
34 or len(p.getRelationsTo(
'BgoSimHits')) > 0 \
35 or len(p.getRelationsTo(
'CsiSimHits')) > 0:
42 d = datetime.datetime.today()
43 print(d.strftime(
'job start: %Y-%m-%d %H:%M:%S\n'))
54 print(
'./RunBGMC.py [(RBB,Touschek,Coulomb)_(HER,LER)(,_far)] [num]')
58 if name.find(
'LER') != -1:
60 elif name.find(
'HER') != -1:
63 print(
'name should include either of HER or LER')
73 if name.find(
'far') != -1:
79 inputfilename =
'forIgal/' + name +
'.root'
80 logfilename =
'log/' + name +
'_' + num +
'.log'
81 outputfilename =
'output/out_phase1_pos_TiN_' + name +
'_' + num +
'.root'
82 seed =
'1' + num + num +
'1'
96 if name ==
'Brems_LER':
98 elif name ==
'Touschek_LER':
101 elif name ==
'Coulomb_LER':
104 elif name ==
'Brems_HER':
107 elif name ==
'Touschek_HER':
110 elif name ==
'Coulomb_HER':
116 print(
'Unknown name!')
119 print(
'accring: ', accring,
'(0:LER, 1:HER)')
120 print(
'input: ', inputfilename)
121 print(
'log: ', logfilename)
122 print(
'output: ', outputfilename)
123 print(
'range: ', range)
124 print(
'seed: ', seed)
125 print(
'nevent: ', nevent)
126 print(
'readouttime:', readouttime)
167 b2.set_log_level(b2.LogLevel.WARNING)
170 b2.set_random_seed(int(seed))
176 eventinfosetter = b2.register_module(
'EventInfoSetter')
177 eventinfosetter.param({
'evtNumList': [nevent],
'runList': [1],
'expList': [1]})
181 touschekinput = b2.register_module(
'SADInput')
182 touschekinput.param(
'Filename', inputfilename)
188 touschekinput.param(
'ReadMode', readmode)
193 touschekinput.param(
'AccRing', accring)
198 touschekinput.param(
'ReadoutTime', readouttime)
202 touschekinput.param(
'Range', range)
210 gearbox = b2.register_module(
'Gearbox')
211 geometry = b2.register_module(
'Geometry')
212 gearbox.param(
'fileName',
'/geometry/Beast2_phase1.xml')
213 fullsim = b2.register_module(
'FullSim')
215 param_fullsim = {
'RegisterOptics': 1,
'PhotonFraction': 0.3}
216 fullsim.param(param_fullsim)
217 fullsim.param(
'PhysicsList',
'QGSP_BERT_HP')
218 fullsim.param(
'UICommandsAtIdle', [
'/process/inactivate nKiller'])
222 fullsim.param(
'StoreAllSecondaries',
True)
223 fullsim.param(
'SecondariesEnergyCut', 0.0)
228 progress = b2.register_module(
'Progress')
231 rootoutput = b2.register_module(
'RootOutput')
232 rootoutput.param(
'outputFileName', outputfilename)
233 rootoutput.param(
'updateFileCatalog',
False)
240 rootoutput.param(
'branchNames', [
'BgoSimHits',
'MicrotpcSimHits',
241 'PindiodeSimHits',
'He3tubeSimHits',
'CsiSimHits'])
244 main = b2.create_path()
245 main.add_module(eventinfosetter)
246 main.add_module(gearbox)
247 main.add_module(touschekinput)
248 main.add_module(geometry)
249 main.add_module(fullsim)
250 main.add_module(progress)
261 main.add_module(rootoutput)
273 print(
'Event Statistics:')
276 d = datetime.datetime.today()
277 print(d.strftime(
'job finish: %Y-%m-%d %H:%M:%S\n'))
A (simplified) python wrapper for StoreArray.