18from caf.framework
import Calibration, CAF
19from caf
import backends
21b2.set_log_level(b2.LogLevel.INFO)
28 print(
"Usage: python3 caf_multiple_options.py <data directory>")
35 input_files_test = [os.path.join(os.path.abspath(data_dir),
'*.root')]
41 def pre_alg_test(algorithm, iteration):
43 Just to show that the function is correctly applied
45 b2.set_log_level(b2.LogLevel.DEBUG)
46 b2.B2INFO(f"Running Test Algorithm Setup For Iteration {iteration}")
47 b2.B2INFO(f
"Can access the {algorithm.__cppname__} class from Calibration().pre_algorithms.")
49 from ROOT
import Belle2
50 from ROOT.Belle2
import TestCalibrationAlgorithm
55 col_test = b2.register_module(
'CaTest')
56 col_test.set_name(f
'Test{i}')
58 col_test.param(
'granularity',
'all')
60 col_test.param(
'spread', 15)
62 alg_test = TestCalibrationAlgorithm()
66 alg_test.setPrefix(f
'Test{i}')
67 alg_test.setDebugHisto(
True)
72 input_files=input_files_test)
73 cal_test.pre_algorithms = pre_alg_test
75 cal_test.max_files_per_collector_job = 1
76 cal_test.max_iterations = 5
81 calibrations.append(cal_test)
89 calibrations[1].depends_on(calibrations[0])
90 calibrations[2].depends_on(calibrations[0])
91 calibrations[3].depends_on(calibrations[2])
92 calibrations[3].depends_on(calibrations[1])
98 for cal
in calibrations:
99 cal_fw.add_calibration(cal)
104 cal_fw.backend = backends.Local(max_processes=4)
105 cal_fw.output_dir =
'cal_test_results'
108 print(
"End of CAF processing.")
111if __name__ ==
"__main__":