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