Belle II Software development
caf_simplest.py
1
12
13import basf2 as b2
14
15import os
16import sys
17
18from caf.framework import Calibration, CAF
19
20b2.set_log_level(b2.LogLevel.INFO)
21
22
23def main(argv):
24 if len(argv) == 1:
25 data_dir = argv[0]
26 else:
27 print("Usage: basf2 CAF_simplest.py <data directory>")
28 sys.exit(1)
29
30
35 input_files_test = []
36 input_files_test.append(os.path.join(os.path.abspath(data_dir), '*.root'))
37
38
40 from ROOT import Belle2 # noqa: make the Belle2 namespace available
41 from ROOT.Belle2 import TestCalibrationAlgorithm
42 alg_test = TestCalibrationAlgorithm() # Getting a calibration algorithm instance
43
44 # Create a single calibration from a collector module name + algorithm + input files
45 cal_test = Calibration(name="TestCalibration", collector="CaTest", algorithms=alg_test, input_files=input_files_test)
46
47
49 cal_fw = CAF()
50 cal_fw.add_calibration(cal_test)
51 cal_fw.run()
52 print("End of CAF processing.")
53
54
55if __name__ == "__main__":
56 main(sys.argv[1:])
Definition: main.py:1