Belle II Software  release-08-01-10
thscan.py
1 #!/usr/bin/env python3
2 
3 
10 
11 
17 
18 import basf2 as b2
19 import os
20 from optparse import OptionParser
21 
22 from basf2 import conditions
23 conditions.override_globaltags()
24 conditions.append_globaltag('online')
25 conditions.append_globaltag('ARICH_phase3_test')
26 
27 
28 # Set the log level to show only error and fatal messages
29 b2.set_log_level(b2.LogLevel.INFO)
30 # parameters
31 parser = OptionParser()
32 parser.add_option('-i', '--inputpath', dest='path', default='')
33 (options, args) = parser.parse_args()
34 
35 input = b2.register_module('SeqRootInput')
36 file_list = [options.path + f for f in os.listdir(options.path) if f.endswith('.sroot')]
37 
38 input.param('inputFileNames', file_list)
39 
40 histo = b2.register_module('HistoManager')
41 
42 cal = b2.register_module('ARICHRateCal')
43 cal.param("nrun", 100)
44 cal.param("nevents", 1000)
45 cal.param("dth", 0.0096) # can be ignored when internal = True
46 cal.param("th0", -0.48) # can be ignored when internal = True
47 cal.param("internal", True)
48 
49 unpack = b2.register_module('ARICHUnpacker')
50 # unpack.param('RawUnpackerMode', 1)
51 # unpack.param('DisableUnpackerMode', 1)
52 
53 convert = b2.register_module('Convert2RawDet')
54 output = b2.register_module('RootOutput')
55 progress = b2.register_module('Progress')
56 
57 # Create main path
58 main = b2.create_path()
59 
60 # Add modules to main path
61 main.add_module(input)
62 main.add_module(histo)
63 main.add_module(convert)
64 main.add_module(unpack)
65 main.add_module(cal)
66 main.add_module(progress)
67 
68 # Process all events
69 b2.process(main)