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