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