Belle II Software development
phase2_simulate.py
1#!/usr/bin/env python3
2
3
10
11
15import sys
16import basf2 as b2
17from generators import add_evtgen_generator
18
19print('***')
20print('*** Used steering script:')
21with open(sys.argv[0]) as fin:
22 print(fin.read(), end="")
23print('*** end of the script.')
24print('***')
25
26fileOUT = sys.argv[1]
27
28dec_file = None
29final_state = 'mixed'
30
31# main path
32main = b2.create_path()
33
34# event info setter
35main.add_module("EventInfoSetter", expList=1002, runList=0, evtNumList=100)
36
37# create geometry from xml file
38gearbox = b2.register_module('Gearbox')
39geomfile = '/geometry/Beast2_phase2.xml'
40if geomfile != 'None':
41 gearbox.param('fileName', geomfile)
42
43main.add_module(gearbox)
44geometry = b2.register_module('Geometry')
45geometry.param('useDB', False)
46geometry.param('components', ['SVD'])
47main.add_module(geometry)
48
49# EvtGen
50add_evtgen_generator(path=main, finalstate=final_state, signaldecfile=dec_file)
51
52# Simulation
53main.add_module('FullSim', StoreAllSecondaries=True)
54
55# Digitizer
56main.add_module('SVDDigitizer')
57
58main.add_module("Progress")
59main.add_module('RootOutput', outputFileName=fileOUT)
60
61# generate events
62b2.process(main)
63
64# show call statistics
65print(b2.statistics)