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