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