Belle II Software  release-08-01-10
Phase2_RecoExample.py
1 #!/usr/bin/env python3
2 
3 
10 
11 
14 
15 import basf2 as b2
16 from simulation import add_simulation
17 from reconstruction import add_reconstruction
18 
19 # background (collision) files
20 # bg = glob.glob('./BG/*.root')
21 # on KEKCC: (choose one of the sets)
22 # bg = /group/belle2/BGFile/OfficialBKG/15thCampaign/phase2/set*/*.root
23 bg = None
24 
25 # number of events to generate, can be overriden with -n
26 num_events = 100
27 # output filename, can be overriden with -o
28 output_filename = "RootOutput_Phase2.root"
29 
30 # create path
31 main = b2.create_path()
32 
33 # specify number of events to be generated
34 # the experiment number for phase2 MC has to be 1002, otherwise the wrong payloads (for VXDTF2 the SectorMap) are loaded
35 main.add_module("EventInfoSetter", expList=1002, runList=1, evtNumList=num_events)
36 
37 # in case you need to fix seed of random numbers
38 # set_random_seed('some fixed value')
39 
40 # generate BBbar events
41 main.add_module('EvtGenInput')
42 
43 # detector and L1 trigger simulation
44 add_simulation(main, bkgfiles=bg)
45 
46 # reconstruction
47 add_reconstruction(main)
48 
49 # Finally add output
50 main.add_module("RootOutput", outputFileName=output_filename)
51 
52 # process events and print call statistics
53 b2.process(main)
54 print(b2.statistics)