Belle II Software  release-08-01-10
ParticleGunMuons.py
1 #!/usr/bin/env python3
2 
3 
10 
11 # Particle gun muon events.
12 
13 import basf2
14 from simulation import add_simulation
15 from reconstruction import add_reconstruction
16 
17 basf2.set_log_level(basf2.LogLevel.WARNING)
18 
19 eventinfosetter = basf2.register_module('EventInfoSetter')
20 eventinfosetter.param('evtNumList', [1000])
21 eventinfosetter.param('runList', [1])
22 eventinfosetter.param('expList', [0])
23 
24 pGun = basf2.register_module('ParticleGun')
25 param_pGun = {
26  'pdgCodes': [13, -13],
27  'nTracks': 1,
28  'momentumGeneration': 'uniform',
29  'momentumParams': [1., 3.],
30  'thetaGeneration': 'uniform',
31  'thetaParams': [17., 150.],
32  'phiGeneration': 'uniform',
33  'phiParams': [0, 360],
34  'vertexGeneration': 'uniform',
35  'xVertexParams': [0.0, 0.0],
36  'yVertexParams': [0.0, 0.0],
37  'zVertexParams': [0.0, 0.0],
38 }
39 
40 pGun.param(param_pGun)
41 
42 output = basf2.register_module('RootOutput')
43 output.param('outputFileName', 'ParticleGunMuons.root')
44 
45 # Create path
46 main = basf2.create_path()
47 main.add_module(eventinfosetter)
48 main.add_module(pGun)
49 add_simulation(main)
50 add_reconstruction(main)
51 main.add_module(output)
52 main.add_module('Progress')
53 
54 basf2.process(main)
55 print(basf2.statistics)