Belle II Software development
particleGun-noBF.py
1#!/usr/bin/env python3
2
3
10
11# -------------------------------------------------------------------------------------------------------
12# Example on how to simulate/reconstruct single particle events w/o intoducing bunch finder inefficiency.
13# Could be useful for AI training.
14#
15# usage: basf2 particleGunSimu-noBF.py -o <my_output_filename.root> -n <events_to_generate>
16# -------------------------------------------------------------------------------------------------------
17
18import basf2 as b2
19from simulation import add_simulation
20from reconstruction import add_reconstruction
21from mdst import add_mdst_output
22
23main = b2.create_path()
24main.add_module('EventInfoSetter')
25main.add_module('ParticleGun',
26 pdgCodes=[321, -321],
27 nTracks=1,
28 varyNTracks=False, # will generate single kaon per event
29 momentumGeneration='uniform',
30 momentumParams=[0.05, 5.0],
31 thetaGeneration='uniformCos', # this makes angular distribution uniform in the solid angle
32 phiGeneration='uniform')
33add_simulation(main, simulateT0jitter=False) # switch-off simulation of L1 trigger time jitter
34add_reconstruction(main)
35main = b2.remove_module(main, 'TOPBunchFinder') # remove bunch finder from the path
36
37# output to file: use -o option to specify file name
38add_mdst_output(main)
39
40main.add_module('Progress')
41b2.process(main)
42
43# Print call statistics
44print(b2.statistics)