Belle II Software
release-08-01-10
caf_boundary_strategy.py
1
11
12
import
basf2
as
b2
13
14
import
sys
15
from
pathlib
import
Path
16
17
from
ROOT.Belle2
import
TestCalibrationAlgorithm
18
from
caf.framework
import
Calibration, CAF
19
from
caf.utils
import
IoV
20
from
caf.strategies
import
SequentialBoundaries
21
22
23
b2.set_log_level(b2.LogLevel.DEBUG)
24
25
26
def
main
(argv):
27
if
len(argv) == 1:
28
data_dir = argv[0]
29
else
:
30
print(
"Usage: basf2 caf_boundary_strategy.py <data directory>"
)
31
sys.exit(1)
32
33
37
input_files_test = []
38
input_files_test.append(Path(Path(data_dir).absolute(),
'*.root'
).as_posix())
39
40
42
alg_test = TestCalibrationAlgorithm()
# Getting a calibration algorithm instance
43
alg_test.setMinEntries(15000)
# This algorithm provides a setting to change when c_NotEnoughData is returned
44
alg_test.setAllowedMeanShift(0.1)
# This alters how often boundaries will be requested (smaller = more often)
45
46
# Create a single calibration from a collector module name + algorithm + input files
47
cal_test =
Calibration
(name=
"TestCalibration"
, collector=
"CaTest"
, algorithms=alg_test, input_files=input_files_test)
48
49
# The SequentialBoundaries strategy executes your algorithm over runs but only where you have defined a boundary
50
# for new payloads. In order to run this strategy your algorithm must define a "isBoundaryRequired" member function.
51
#
52
# You should only use granularity='run' for the collector when using this strategy.
53
54
cal_test.strategies = SequentialBoundaries
55
56
cal_test.algorithms[0].params[
"iov_coverage"
] = IoV(0, 0, -1, -1)
57
58
60
cal_fw = CAF()
61
cal_fw.add_calibration(cal_test)
62
cal_fw.run()
63
print(
"End of CAF processing."
)
64
65
66
if
__name__ ==
"__main__"
:
67
main
(sys.argv[1:])
Calibration
Definition:
Calibration.py:1
main
Definition:
main.py:1
main
int main(int argc, char **argv)
Run all tests.
Definition:
test_main.cc:91
calibration
examples
caf_boundary_strategy.py
Generated on Mon Sep 23 2024 14:00:48 for Belle II Software by
1.9.1