9"""Common functions for KLM calibration strategies."""
12from caf.utils
import ExpRun
15def calibration_result_string(result):
17 Convert calibration result to text message.
19 result (int): Calibration result.
24 res =
'iteration is necessary'
26 res =
'not enough data'
34def get_lowest_exprun(number_of_experiments, experiment_index, run_list,
37 Get lowest experiment and run numbers.
39 number_of_experiments (int): Number of experiments.
40 experiment_index (int): 1-based experiment index.
41 run_list (list[ExpRun]): List of runs
for the selected experiment.
42 iov_coverage (IoV): IOV coverage.
44 if iov_coverage
and experiment_index == 1:
45 lowest_exprun = ExpRun(iov_coverage.exp_low, iov_coverage.run_low)
46 if lowest_exprun > run_list[0]:
47 basf2.B2WARNING(f
'The lowest run {run_list[0]} of input data is '
48 f
'smaller than the lowest run {lowest_exprun} of '
49 'the requested IOV coverage. The IOV coverage is '
51 lowest_exprun = run_list[0]
53 lowest_exprun = run_list[0]
55 if (experiment_index > 1):
56 lowest_exprun = ExpRun(lowest_exprun.exp, 0)
60def get_highest_exprun(number_of_experiments, experiment_index, run_list,
63 Get highest experiment and run numbers.
65 number_of_experiments (int): Number of experiments.
66 experiment_index (int): 1-based experiment index.
67 run_list (list[ExpRun]): List of runs
for the selected experiment.
68 iov_coverage (IoV): IOV coverage.
70 if iov_coverage
and experiment_index == number_of_experiments:
71 highest_exprun = ExpRun(iov_coverage.exp_high, iov_coverage.run_high)
72 if (highest_exprun < run_list[-1]
and
73 not ((iov_coverage.exp_high == -1)
or
74 (iov_coverage.exp_high == run_list[-1].exp
and
75 iov_coverage.run_high == -1))):
76 basf2.B2WARNING(f
'The highest run {run_list[-1]} of input data is '
77 f
'larger than the highest run {highest_exprun} of '
78 'the requested IOV coverage. The IOV coverage is '
80 highest_exprun = run_list[-1]
82 highest_exprun = run_list[-1]
84 if (experiment_index < number_of_experiments):
85 highest_exprun = ExpRun(highest_exprun.exp, -1)