Belle II Software  release-05-01-25
MuonGenSimNoBkg.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 """
5 <header>
6  <output>MuonGenSimNoBkg.root</output>
7  <contact>Software team b2soft@mail.desy.de</contact>
8  <cacheable/>
9  <description>This steering file produces 10000 events with one Muon each
10  and runs the detector simulation without mixing in background.</description>
11 </header>
12 """
13 
14 from basf2 import set_random_seed, create_path, process, statistics, \
15  register_module
16 from simulation import add_simulation
17 from beamparameters import add_beamparameters
18 from validation import statistics_plots, event_timing_plot
19 
20 set_random_seed(12345)
21 
22 main = create_path()
23 
24 # specify number of events to be generated
25 eventinfosetter = register_module('EventInfoSetter')
26 eventinfosetter.param('evtNumList', [10000])
27 eventinfosetter.param('runList', [1])
28 eventinfosetter.param('expList', [0])
29 main.add_module(eventinfosetter)
30 
31 # beam parameters
32 beamparameters = add_beamparameters(main, "Y4S")
33 
34 # generate Muon events
35 # Particle gun
36 particlegun = register_module('ParticleGun')
37 particlegun.param('nTracks', 1)
38 particlegun.param('pdgCodes', [13, -13])
39 particlegun.param('momentumGeneration', 'uniform')
40 particlegun.param('momentumParams', [0.1, 4])
41 main.add_module(particlegun)
42 
43 # detector simulation, no background files
44 add_simulation(main)
45 
46 # memory profile
47 main.add_module(register_module('Profile'))
48 
49 # output
50 output = register_module('RootOutput')
51 output.param('outputFileName', '../MuonGenSimNoBkg.root')
52 main.add_module(output)
53 
54 process(main)
55 
56 # Print call statistics
57 print(statistics)
58 
59 statistics_plots(
60  'MuonGenSimNoBkg_statistics.root',
61  contact='Software team b2soft@mail.desy.de',
62  job_desc='a standard simulation job with generic MuonGenSimNoBkg events',
63  prefix='MuonGenSimNoBkg'
64 )
65 event_timing_plot(
66  '../MuonGenSimNoBkg.root',
67  'MuonGenSimNoBkg_statistics.root',
68  contact='Software team b2soft@mail.desy.de',
69  job_desc='a standard simulation job with Muon events',
70  prefix='MuonGenSimNoBkg'
71 )