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