Belle II Software  release-05-02-19
algorithm_only.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 from ROOT import Belle2
5 
7 # Set the prefix manually if you want to use the algorithm for a specific collector
8 # algo.setPrefix("CaTest")
9 algo.setDebugHisto(True)
10 
11 # Can use a Python list of input files/wildcards. It will resolve the existing files
12 inputFileNames = ["CollectorOutput.root"]
13 algo.setInputFileNames(inputFileNames)
14 # Python list object of files returned
15 d = algo.getInputFileNames()
16 for name in d:
17  print("Resolved input file to algorithm:", name)
18 
19 # Can use python lists/tuples to define the runs whose data you want to use [(exp,run), ...]
20 # IoV of the payloads will be calculated from this input list
21 print("Result of calibration =", algo.execute([(1, 1), (1, 2)]))
22 output_json_string = algo.dumpOutputJson()
23 print(f"Output JSON was {output_json_string}")
24 # localdb isn't updated until you call this
25 # algo.commit()
26 
27 # Can run over all collected data and auto define the IoV of the payloads
28 print("Result of calibration =", algo.execute())
29 output_json_string = algo.dumpOutputJson()
30 print(f"Output JSON was {output_json_string}")
31 # Can commit multiple times in one process since the payloads are cleared at the start
32 # of each execution
33 # algo.commit()
34 
35 # Can set the input JSON from a previous execution's output JSON
36 algo.loadInputJson(output_json_string)
37 # Could also define an IoV for your calibrations at the start of execution
39 print("Result of calibration =", algo.execute([], 0, iov))
40 output_json_string = algo.dumpOutputJson()
41 print(f"Output JSON was {output_json_string}")
42 # IoV is applied to payloads during execution and gets used during commit
43 algo.commit()
Belle2::IntervalOfValidity::always
static IntervalOfValidity always()
Function that returns an interval of validity that is always valid, c.f.
Definition: IntervalOfValidity.h:72
Belle2::TestCalibrationAlgorithm
Test class implementing calibration algorithm.
Definition: TestCalibrationAlgorithm.h:31