Belle II Software  release-08-01-10
caf_simplest.py
1 
12 
13 import basf2 as b2
14 
15 import os
16 import sys
17 
18 from ROOT.Belle2 import TestCalibrationAlgorithm
19 from caf.framework import Calibration, CAF
20 
21 b2.set_log_level(b2.LogLevel.INFO)
22 
23 
24 def main(argv):
25  if len(argv) == 1:
26  data_dir = argv[0]
27  else:
28  print("Usage: basf2 CAF_simplest.py <data directory>")
29  sys.exit(1)
30 
31 
36  input_files_test = []
37  input_files_test.append(os.path.join(os.path.abspath(data_dir), '*.root'))
38 
39 
41  alg_test = TestCalibrationAlgorithm() # Getting a calibration algorithm instance
42 
43  # Create a single calibration from a collector module name + algorithm + input files
44  cal_test = Calibration(name="TestCalibration", collector="CaTest", algorithms=alg_test, input_files=input_files_test)
45 
46 
48  cal_fw = CAF()
49  cal_fw.add_calibration(cal_test)
50  cal_fw.run()
51  print("End of CAF processing.")
52 
53 
54 if __name__ == "__main__":
55  main(sys.argv[1:])
Definition: main.py:1
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:91