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