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