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