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