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