Belle II Software  release-08-01-10
test_dec_table.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 # Descriptor: script to test decay tables
13 
14 import basf2 as b2
15 from simulation import add_simulation
16 from reconstruction import add_reconstruction
17 from mdst import add_mdst_output
18 import glob
19 import sys
20 
21 event_type = str(sys.argv[1])
22 b2.set_random_seed(12345)
23 
24 # background (collision) files
25 bg = glob.glob('./BG/[A-Z]*.root')
26 
27 # create path
28 main = b2.create_path()
29 
30 # specify number of events to be generated
31 eventinfosetter = b2.register_module('EventInfoSetter')
32 eventinfosetter.param('evtNumList', [1000])
33 eventinfosetter.param('runList', [1])
34 eventinfosetter.param('expList', [1])
35 main.add_module(eventinfosetter)
36 
37 # generate BBbar events
38 evtgeninput = b2.register_module('EvtGenInput')
39 evtgeninput.param('userDECFile', b2.find_file(f'decfiles/dec/{event_type}.dec'))
40 main.add_module(evtgeninput)
41 
42 # detector simulation
43 # add_simulation(main, bkgfiles=bg)
44 add_simulation(main)
45 
46 # reconstruction
47 add_reconstruction(main)
48 
49 # Finally add mdst output
50 output_filename = "test.dst.root"
51 add_mdst_output(main, filename=output_filename)
52 
53 # process events and print call statistics
54 b2.process(main)
55 print(b2.statistics)