Belle II Software development
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 import Belle2 # noqa: make the Belle2 namespace available
21from ROOT.Belle2 import TestDBAccessAlgorithm
22from caf.framework import Calibration, CAF
23from caf.utils import IoV
24from caf.strategies import SequentialRunByRun
25
26b2.set_log_level(b2.LogLevel.DEBUG)
27b2.set_debug_level(100)
28# add time stamp to all INFO messages
29# currentInfo = logging.get_info(LogLevel.INFO)
30# logging.set_info(LogLevel.INFO, currentInfo | LogInfo.TIMESTAMP)
31data_dir = "../../../examples/test_data"
32
33
38input_files_test = []
39input_files_test.append(os.path.join(os.path.abspath(data_dir), '*.root'))
40
41
43alg_test = TestDBAccessAlgorithm() # Getting a calibration algorithm instance
44# alg_test.setMinEntries(15000)
45
46col = b2.register_module("CaTest")
47# col.param("granularity", "all")
48
49# Create a single calibration from a collector module name + algorithm + input files
50cal_test = Calibration(name="TestCalibration", collector="CaTest", algorithms=alg_test, input_files=input_files_test)
51cal_test.strategies = SequentialRunByRun
52
54cal_fw = CAF()
55cal_fw.add_calibration(cal_test)
56
57# Let's only calibrate a subset of the data
58iov_to_calibrate = IoV(exp_low=0, run_low=1, exp_high=0, run_high=4)
59# cal_fw.run(iov=iov_to_calibrate)
60cal_fw.run()
61print("End of CAF processing.")