18from ROOT.Belle2
import TestCalibrationAlgorithm
20from caf.framework
import Calibration, CAF
21from caf
import backends
23b2.set_log_level(b2.LogLevel.INFO)
30 print(
"Usage: python3 caf_multiple_options.py <data directory>")
37 input_files_test = [os.path.join(os.path.abspath(data_dir),
'*.root')]
43 def pre_alg_test(algorithm, iteration):
45 Just to show that the function is correctly applied
47 b2.set_log_level(b2.LogLevel.DEBUG)
48 b2.B2INFO(f"Running Test Algorithm Setup For Iteration {iteration}")
49 b2.B2INFO(f
"Can access the {algorithm.__cppname__} class from Calibration().pre_algorithms.")
54 col_test = b2.register_module(
'CaTest')
55 col_test.set_name(f
'Test{i}')
57 col_test.param(
'granularity',
'all')
59 col_test.param(
'spread', 15)
61 alg_test = TestCalibrationAlgorithm()
65 alg_test.setPrefix(f
'Test{i}')
66 alg_test.setDebugHisto(
True)
71 input_files=input_files_test)
72 cal_test.pre_algorithms = pre_alg_test
74 cal_test.max_files_per_collector_job = 1
75 cal_test.max_iterations = 5
80 calibrations.append(cal_test)
88 calibrations[1].depends_on(calibrations[0])
89 calibrations[2].depends_on(calibrations[0])
90 calibrations[3].depends_on(calibrations[2])
91 calibrations[3].depends_on(calibrations[1])
97 for cal
in calibrations:
98 cal_fw.add_calibration(cal)
103 cal_fw.backend = backends.Local(max_processes=4)
104 cal_fw.output_dir =
'cal_test_results'
107 print(
"End of CAF processing.")
110if __name__ ==
"__main__":