Belle II Software  release-08-01-10
background_generator.py
1 #!/usr/bin/env python3
2 
3 
10 
11 
24 
25 import basf2 as b2
26 from background import get_background_files
27 from pxd.background_generator import inject_simulation, PXDBackgroundGenerator
28 from reconstruction import add_reconstruction
29 from mdst import add_mdst_output
30 
31 # create path
32 main = b2.create_path()
33 
34 # specify number of events to be generated
35 main.add_module('EventInfoSetter', evtNumList=[10])
36 
37 # print event numbers
38 main.add_module('EventInfoPrinter')
39 
40 # generate BBbar events
41 main.add_module('EvtGenInput')
42 
43 # list of background overlay files that are available on the system
44 files = get_background_files()
45 
46 # instantiate the PXD background generator module
47 generator_module = PXDBackgroundGenerator(model='resnet')
48 
49 # create a drop-in simulation function that incorporates the module
50 add_simulation = inject_simulation(generator_module)
51 
52 # detector and L1 trigger simulation with background overlay
53 add_simulation(main, bkgfiles=files)
54 
55 # reconstruction
56 add_reconstruction(main)
57 # or add_reconstruction(main, components) to run the reconstruction of a selection of detectors
58 
59 # full output
60 main.add_module('RootOutput', outputFileName='output.root')
61 
62 # mdst output
63 add_mdst_output(main)
64 
65 # cdst output (for calibration)
66 # add_cdst_output(main)
67 
68 # process events and print call statistics
69 b2.process(main)
70 print(b2.statistics)
basf2 (Belle II Analysis Software Framework) # Author: The Belle II Collaboration # # See git log for...
Definition: __init__.py:1