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