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