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