Belle II Software release-09-00-00
caf_test.py
1#!/usr/bin/env python3
2
3
10
11# This steering file shows pretty much the most minimal setup for
12# running the CAF. You will need to have data already from running
13# calibration/examples/1_create_sample_DSTs.sh or just make your own
14# and change the input data below.
15
16import basf2 as b2
17
18import os
19
20from ROOT.Belle2 import TestDBAccessAlgorithm
21from caf.framework import Calibration, CAF
22from caf.utils import IoV
23from caf.strategies import SequentialRunByRun
24
25b2.set_log_level(b2.LogLevel.DEBUG)
26b2.set_debug_level(100)
27# add time stamp to all INFO messages
28# currentInfo = logging.get_info(LogLevel.INFO)
29# logging.set_info(LogLevel.INFO, currentInfo | LogInfo.TIMESTAMP)
30data_dir = "../../../examples/test_data"
31
32
37input_files_test = []
38input_files_test.append(os.path.join(os.path.abspath(data_dir), '*.root'))
39
40
42alg_test = TestDBAccessAlgorithm() # Getting a calibration algorithm instance
43# alg_test.setMinEntries(15000)
44
45col = b2.register_module("CaTest")
46# col.param("granularity", "all")
47
48# Create a single calibration from a collector module name + algorithm + input files
49cal_test = Calibration(name="TestCalibration", collector="CaTest", algorithms=alg_test, input_files=input_files_test)
50cal_test.strategies = SequentialRunByRun
51
53cal_fw = CAF()
54cal_fw.add_calibration(cal_test)
55
56# Let's only calibrate a subset of the data
57iov_to_calibrate = IoV(exp_low=0, run_low=1, exp_high=0, run_high=4)
58# cal_fw.run(iov=iov_to_calibrate)
59cal_fw.run()
60print("End of CAF processing.")