Belle II Software  release-06-01-15
produceGunEvents.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 # ####### Imports #######
13 import basf2 as b2
14 
15 import simulation
16 
17 # ######## Register modules ########
18 eventInfoSetterModule = b2.register_module('EventInfoSetter')
19 eventInfoSetterModule.param({'evtNumList': [10], 'runList': [1],
20  'expList': [0]})
21 
22 progressModule = b2.register_module('Progress')
23 
24 particleGunModule = b2.register_module('ParticleGun')
25 particleGunModule.param({
26  'pdgCodes': [13, -13],
27  'nTracks': 10,
28  'varyNTracks': False,
29  'momentumGeneration': 'uniform',
30  'momentumParams': [0.6, 1.4],
31  'thetaGeneration': 'uniform',
32  'thetaParams': [17., 150.],
33 })
34 
35 rootOutputModule = b2.register_module('RootOutput')
36 rootOutputModule.param({'outputFileName': 'mc_gun.root'})
37 
38 # ######## Create paths and add modules ########
39 main = b2.create_path()
40 
41 main.add_module(eventInfoSetterModule)
42 main.add_module(progressModule)
43 
44 main.add_module(particleGunModule)
45 
46 components = ['MagneticFieldConstant4LimitedRCDC', 'BeamPipe', 'PXD', 'SVD',
47  'CDC']
48 
49 simulation.add_simulation(main, components=components)
50 
51 main.add_module(rootOutputModule)
52 
53 b2.process(main)
54 
55 # Print call statistics
56 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)
Definition: simulation.py:135