Belle II Software development
KLongGenSimNoBkg.py
1#!/usr/bin/env python3
2
3
10
11"""
12<header>
13 <output>KLongGenSimNoBkg.root</output>
14 <contact>arul.prakash@physik.uni-muenchen.de</contact>
15 <cacheable/>
16 <description>This steering file produces 1000 events with one KLong 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", [1000])
39eventinfosetter.param("runList", [1])
40eventinfosetter.param("expList", [0])
41main.add_module(eventinfosetter)
42
43# beam parameters
44beamparameters = add_beamparameters(main, "Y4S")
45# beamparameters.param("smearVertex", False)
46
47# generate Klong events
48# Particle gun
49particlegun = register_module("ParticleGun")
50particlegun.param("nTracks", 1)
51particlegun.param("pdgCodes", [130])
52particlegun.param("momentumGeneration", "uniform")
53particlegun.param("momentumParams", [1, 1])
54particlegun.param("thetaGeneration", "uniform")
55particlegun.param("thetaParams", [30, 30])
56particlegun.param("phiGeneration", "uniform")
57particlegun.param("phiParams", [0, 360])
58main.add_module(particlegun)
59
60# detector simulation, no background files
61add_simulation(main)
62
63# memory profile
64main.add_module(register_module("Profile"))
65
66# output
67output = register_module("RootOutput")
68output.param("outputFileName", "../KLongGenSimNoBkg.root")
69main.add_module(output)
70
71main.add_module('Progress')
72process(main)
73
74# Print call statistics
75print(statistics)
76
77statistics_plots(
78 "KLongGenSimNoBkg_statistics.root",
79 contact="arul.prakash@physik.uni-muenchen.de",
80 job_desc="a standard simulation job with generic KLongGenSimNoBkg events",
81 prefix="KLongGenSimNoBkg",
82)
83event_timing_plot(
84 "../KLongGenSimNoBkg.root",
85 "KLongGenSimNoBkg_statistics.root",
86 contact="arul.prakash@physik.uni-muenchen.de",
87 job_desc="a standard simulation job with Klong events",
88 prefix="KLongGenSimNoBkg",
89)