Belle II Software development
TimeWalk.py
1
8import datetime
9import re
10import basf2 as b2
11from ROOT import Belle2
12from ROOT import gSystem
13gSystem.Load('libcdc')
14# gSystem.SetBatch(1);
15
16b2.reset_database()
17b2.use_database_chain()
18b2.use_central_database("Calibration_Offline_Development", b2.LogLevel.INFO)
19
20b2.logging.log_level = b2.LogLevel.ERROR
21b2.set_debug_level(200)
22d = datetime.datetime.today()
23print(d.strftime('This Calculution is done at : %d-%m-%y %H:%M:%S\n'))
24
25
26rootdir = None
27param_dir = None
28tw_file = None
29
30with open('location') as file:
31 lines = file.readlines()
32 for line in lines:
33 if re.match(r'dir_root', line):
34 rootdir = line.split('"')[1]
35 if re.match(r'dir_params', line):
36 param_dir = line.split('"')[1]
37 if re.match(r'tw_file', line):
38 tw_file = line.split('"')[1]
39 twfile = param_dir + tw_file
40print(twfile)
41main = b2.create_path()
42main.add_module('EventInfoSetter',
43 evtNumList=[1],
44 runList=[1])
45main.add_module('Gearbox')
46main.add_module('Geometry',
47 components=['CDC'])
48
49b2.process(main)
50
52tw.InputFileNames(rootdir + "/output_*")
53tw.InputTWFileName(twfile)
54tw.OutputTWFileName("tw.dat")
55tw.setStoreHisto(True)
56tw.setDebug(True)
57tw.setUseDB(False)
58tw.setMinimumNDF(10)
59tw.setMinimumPval(0.001)
60# tw.setBinWidth(0.025)
61tw.execute()
Class for Time walk calibration.