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