Belle II Software  release-08-01-10
produceGunEvents.py
1 #!/usr/bin/env python3
2 
3 
10 
11 # ####### Imports #######
12 import basf2 as b2
13 
14 import simulation
15 
16 # ######## Register modules ########
17 eventInfoSetterModule = b2.register_module('EventInfoSetter')
18 eventInfoSetterModule.param({'evtNumList': [10], 'runList': [1],
19  'expList': [0]})
20 
21 progressModule = b2.register_module('Progress')
22 
23 particleGunModule = b2.register_module('ParticleGun')
24 particleGunModule.param({
25  'pdgCodes': [13, -13],
26  'nTracks': 10,
27  'varyNTracks': False,
28  'momentumGeneration': 'uniform',
29  'momentumParams': [0.6, 1.4],
30  'thetaGeneration': 'uniform',
31  'thetaParams': [17., 150.],
32 })
33 
34 rootOutputModule = b2.register_module('RootOutput')
35 rootOutputModule.param({'outputFileName': 'mc_gun.root'})
36 
37 # ######## Create paths and add modules ########
38 main = b2.create_path()
39 
40 main.add_module(eventInfoSetterModule)
41 main.add_module(progressModule)
42 
43 main.add_module(particleGunModule)
44 
45 components = ['MagneticFieldConstant4LimitedRCDC', 'BeamPipe', 'PXD', 'SVD',
46  'CDC']
47 
48 simulation.add_simulation(main, components=components)
49 
50 main.add_module(rootOutputModule)
51 
52 b2.process(main)
53 
54 # Print call statistics
55 print(b2.statistics)
def add_simulation(path, components=None, bkgfiles=None, bkgOverlay=True, forceSetPXDDataReduction=False, usePXDDataReduction=True, cleanupPXDDataReduction=True, generate_2nd_cdc_hits=False, simulateT0jitter=True, isCosmics=False, FilterEvents=False, usePXDGatedMode=False, skipExperimentCheckForBG=False, save_slow_pions_in_mc=False)
Definition: simulation.py:121