Belle II Software  release-08-01-10
BabayagaNLOBhabhaSimRec.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 <header>
14  <output>BabayagaNLOBhabhaSimRec.root</output>
15  <cacheable/>
16  <contact>Software team b2soft@mail.desy.de</contact>
17  <description>
18  This steering file produces 1000 radiative Bhabha events with
19  Babayaga.NLO, runs the detector simulation with mixed in background, and
20  performs the standard reconstruction.
21  </description>
22 </header>
23 """
24 
25 from basf2 import set_random_seed, create_path, process, statistics
26 from simulation import add_simulation
27 from reconstruction import add_reconstruction
28 from validation import statistics_plots, event_timing_plot
29 from background import get_background_files
30 
31 set_random_seed(12345)
32 
33 main = create_path()
34 emptypath = create_path()
35 
36 # specify number of events to be generated
37 main.add_module("EventInfoSetter", evtNumList=[1000], runList=[1], expList=[0])
38 
39 # generate Bhabha events
40 main.add_module("BabayagaNLOInput")
41 
42 # register the preselection module
43 generatorpreselection = main.add_module("GeneratorPreselection")
44 generatorpreselection.param(
45  {
46  "nChargedMin": 1,
47  "MinChargedP": 0.5,
48  "MinChargedPt": 0.1,
49  "MinChargedTheta": 16.5,
50  "MaxChargedTheta": 150.5,
51  "nPhotonMin": 1,
52  "MinPhotonEnergy": 0.5,
53  "MinPhotonTheta": 12.0,
54  "MaxPhotonTheta": 156.0,
55  }
56 )
57 generatorpreselection.if_value("<1", emptypath)
58 
59 # detector simulation
60 add_simulation(main, bkgfiles=get_background_files())
61 
62 # reconstruction
63 add_reconstruction(main)
64 
65 # memory profile
66 main.add_module("Profile")
67 
68 # output
69 main.add_module("RootOutput", outputFileName="../BabayagaNLOBhabhaSimRec.root")
70 
71 main.add_module('Progress')
72 process(main)
73 
74 # Print call statistics
75 print(statistics)
76 
77 statistics_plots(
78  "BabayagaNLOBhabhaSimRec_statistics.root",
79  contact="Software team b2soft@mail.desy.de",
80  job_desc="a standard simulation and reconstruction job with radiative "
81  "Bhabha events using Babayaga.NLO",
82  prefix="BabayagaNLOBhabhaSimRec",
83 )
84 event_timing_plot(
85  "../BabayagaNLOBhabhaSimRec.root",
86  "BabayagaNLOBhabhaSimRec_statistics.root",
87  contact="Software team b2soft@mail.desy.de",
88  job_desc="a standard simulation and reconstruction job with radiative "
89  "Bhabha events using Babayaga.NLO",
90  prefix="BabayagaNLOBhabhaSimRec",
91 )