Belle II Software  release-08-01-10
SpaceResol.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.INFO
21 b2.set_debug_level(200)
22 
23 d = datetime.datetime.today()
24 print(d.strftime('This Calculution is done at : %d-%m-%y %H:%M:%S\n'))
25 
26 # For file name
27 rootdir = None
28 param_dir = None
29 sigma_file = None
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'sigma_file', line):
38  sigma_file = line.split('"')[1]
39  sigmafile = param_dir + sigma_file
40 print(sigmafile)
41 rootfile = rootdir + "/output_*"
42 # rootfile="rootfile_finalMapper_newSigma/output_*"
43 
44 main = b2.create_path()
45 main.add_module('EventInfoSetter',
46  evtNumList=[1],
47  runList=[1])
48 main.add_module('Gearbox')
49 main.add_module('Geometry',
50  components=['CDC'])
51 
52 b2.process(main)
53 
55 fit.inputFileNames(rootfile)
56 fit.ProfileFileNames("sigma_profile.dat")
57 fit.useProfileFromInputSigma(False)
58 fit.setSigmaFileName(sigmafile)
59 fit.setStoreHisto(True)
60 fit.setDebug(False)
61 fit.setUseDB(False)
62 fit.setMinimumNDF(30)
63 fit.setBinWidth(0.05)
64 fit.setMinimumPval(0.001)
65 fit.execute()
Class for Space resolution calibration.