18 from ROOT.Belle2
import TestCalibrationAlgorithm
20 from caf.framework
import Calibration, CAF
21 from caf
import backends
23 b2.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(
"Running Test Algorithm Setup For Iteration {}".format(iteration))
49 b2.B2INFO(
"Can access the {} class from Calibration().pre_algorithms.".format(algorithm.__cppname__))
54 col_test = b2.register_module(
'CaTest')
55 col_test.set_name(
'Test{}'.format(i))
57 col_test.param(
'granularity',
'all')
59 col_test.param(
'spread', 15)
61 alg_test = TestCalibrationAlgorithm()
65 alg_test.setPrefix(
'Test{}'.format(i))
66 alg_test.setDebugHisto(
True)
68 cal_test =
Calibration(name=
'TestCalibration{}'.format(i),
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.")
110 if __name__ ==
"__main__":
int main(int argc, char **argv)
Run all tests.