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