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