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