Belle II Software  release-05-01-25
caf_simplest_iov.py
1 # This steering file shows pretty much the most minimal setup for
2 # running the CAF. You will need to have data already from running
3 # calibration/examples/1_create_sample_DSTs.sh or just make your own
4 # and change the input data below.
5 
6 import basf2 as b2
7 
8 import os
9 import sys
10 
11 from ROOT.Belle2 import TestCalibrationAlgorithm
12 from caf.framework import Calibration, CAF
13 from caf.utils import IoV
14 
15 b2.set_log_level(b2.LogLevel.INFO)
16 # add time stamp to all INFO messages
17 # currentInfo = logging.get_info(LogLevel.INFO)
18 # logging.set_info(LogLevel.INFO, currentInfo | LogInfo.TIMESTAMP)
19 
20 
21 def main(argv):
22  if len(argv) == 1:
23  data_dir = argv[0]
24  else:
25  print("Usage: basf2 CAF_simplest.py <data directory>")
26  sys.exit(1)
27 
28 
33  input_files_test = []
34  input_files_test.append(os.path.join(os.path.abspath(data_dir), '*.root'))
35 
36 
38  alg_test = TestCalibrationAlgorithm() # Getting a calibration algorithm instance
39 
40  # Create a single calibration from a collector module name + algorithm + input files
41  cal_test = Calibration(name="TestCalibration", collector="CaTest", algorithms=alg_test, input_files=input_files_test)
42 
43 
45  cal_fw = CAF()
46  cal_fw.add_calibration(cal_test)
47 
48  # Let's only calibrate a subset of the data
49  iov_to_calibrate = IoV(exp_low=0, run_low=2, exp_high=0, run_high=3)
50  cal_fw.run(iov=iov_to_calibrate)
51  print("End of CAF processing.")
52 
53 
54 if __name__ == "__main__":
55  main(sys.argv[1:])
main
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:77
Calibration
Definition: Calibration.py:1