Belle II Software  release-08-01-10
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 
16 import basf2 as b2
17 
18 import os
19 
20 from ROOT.Belle2 import TestDBAccessAlgorithm
21 from caf.framework import Calibration, CAF
22 from caf.utils import IoV
23 from caf.strategies import SequentialRunByRun
24 
25 b2.set_log_level(b2.LogLevel.DEBUG)
26 b2.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)
30 data_dir = "../../../examples/test_data"
31 
32 
37 input_files_test = []
38 input_files_test.append(os.path.join(os.path.abspath(data_dir), '*.root'))
39 
40 
42 alg_test = TestDBAccessAlgorithm() # Getting a calibration algorithm instance
43 # alg_test.setMinEntries(15000)
44 
45 col = b2.register_module("CaTest")
46 # col.param("granularity", "all")
47 
48 # Create a single calibration from a collector module name + algorithm + input files
49 cal_test = Calibration(name="TestCalibration", collector="CaTest", algorithms=alg_test, input_files=input_files_test)
50 cal_test.strategies = SequentialRunByRun
51 
53 cal_fw = CAF()
54 cal_fw.add_calibration(cal_test)
55 
56 # Let's only calibrate a subset of the data
57 iov_to_calibrate = IoV(exp_low=0, run_low=1, exp_high=0, run_high=4)
58 # cal_fw.run(iov=iov_to_calibrate)
59 cal_fw.run()
60 print("End of CAF processing.")