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