Belle II Software  release-08-01-10
example.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 
21 
22 import basf2 as b2
23 from simulation import add_simulation
24 from reconstruction import add_reconstruction
25 from mdst import add_mdst_output
26 
27 # create path
28 main = b2.create_path()
29 
30 # specify number of events to be generated
31 main.add_module('EventInfoSetter', evtNumList=[10])
32 
33 # print event numbers
34 main.add_module('EventInfoPrinter')
35 
36 # generate BBbar events
37 main.add_module('EvtGenInput')
38 
39 # detector and L1 trigger simulation
40 add_simulation(main)
41 # or add_simulation(main, components) to simulate a selection of detectors and triggr
42 
43 # reconstruction
44 add_reconstruction(main)
45 # or add_reconstruction(main, components) to run the reconstruction of a selection of detectors
46 
47 # full output
48 main.add_module('RootOutput', outputFileName='output.root')
49 
50 # mdst output
51 add_mdst_output(main)
52 
53 # cdst output (for calibration)
54 # add_cdst_output(main)
55 
56 # process events and print call statistics
57 b2.process(main)
58 print(b2.statistics)