Belle II Software  release-08-01-10
caf_simplest_iov.py
1 
12 
13 import basf2 as b2
14 
15 import os
16 import sys
17 
18 from ROOT.Belle2 import TestCalibrationAlgorithm
19 from caf.framework import Calibration, CAF
20 from caf.utils import IoV
21 
22 b2.set_log_level(b2.LogLevel.INFO)
23 # add time stamp to all INFO messages
24 # currentInfo = logging.get_info(LogLevel.INFO)
25 # logging.set_info(LogLevel.INFO, currentInfo | LogInfo.TIMESTAMP)
26 
27 
28 def main(argv):
29  if len(argv) == 1:
30  data_dir = argv[0]
31  else:
32  print("Usage: basf2 CAF_simplest.py <data directory>")
33  sys.exit(1)
34 
35 
40  input_files_test = []
41  input_files_test.append(os.path.join(os.path.abspath(data_dir), '*.root'))
42 
43 
45  alg_test = TestCalibrationAlgorithm() # Getting a calibration algorithm instance
46 
47  # Create a single calibration from a collector module name + algorithm + input files
48  cal_test = Calibration(name="TestCalibration", collector="CaTest", algorithms=alg_test, input_files=input_files_test)
49 
50 
52  cal_fw = CAF()
53  cal_fw.add_calibration(cal_test)
54 
55  # Let's only calibrate a subset of the data
56  iov_to_calibrate = IoV(exp_low=0, run_low=2, exp_high=0, run_high=3)
57  cal_fw.run(iov=iov_to_calibrate)
58  print("End of CAF processing.")
59 
60 
61 if __name__ == "__main__":
62  main(sys.argv[1:])
Definition: main.py:1
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:91