3 """A simple example calibration that takes one input data list from raw data and performs
4 a single calibration."""
6 from prompt
import CalibrationSettings, input_data_filters
9 settings = CalibrationSettings(
10 name=
"ARICH channel masks",
11 expert_username=
"luka",
13 input_data_formats=[
"raw"],
14 input_data_names=[
"bhabha_all_calib"],
17 input_data_filters[
"Data Tag"][
"bhabha_all_calib"],
18 input_data_filters[
"Run Type"][
"physics"],
19 input_data_filters[
"Data Quality Tag"][
"Good Or Recoverable"]]},
25 def get_calibrations(input_data, **kwargs):
28 input_data (dict): Should contain every name from the 'input_data_names' variable as a key.
29 Each value is a dictionary with {"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful for
30 assigning to calibration.files_to_iov
32 **kwargs: Configuration options to be sent in. Since this may change we use kwargs as a way to help prevent
33 backwards compatibility problems. But you could use the correct arguments in b2caf-prompt-run for this
34 release explicitly if you want to.
36 Currently only kwargs["output_iov"] is used. This is the output IoV range that your payloads should
37 correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
40 list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
47 file_to_iov_physics = input_data[
"bhabha_all_calib"]
52 max_files_per_run = 100
58 reduced_file_to_iov_physics = filter_by_max_files_per_run(file_to_iov_physics, max_files_per_run)
59 input_files_physics = list(reduced_file_to_iov_physics.keys())
60 basf2.B2INFO(f
"Total number of files actually used as input = {len(input_files_physics)}")
64 requested_iov = kwargs.get(
"requested_iov",
None)
66 from caf.utils
import IoV
68 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
73 from basf2
import create_path
74 from ROOT.Belle2
import ARICHChannelMaskMaker
76 alg_arich = ARICHChannelMaskMaker()
81 from caf.framework
import Calibration
82 from caf.strategies
import SequentialRunByRun
85 rec_path_1 = create_path()
86 rec_path_1.add_module(
'ARICHUnpacker')
89 collector=
"ARICHChannelMask",
90 algorithms=[alg_arich],
91 input_files=input_files_physics,
92 pre_collector_path=rec_path_1
95 cal_test.strategies = SequentialRunByRun
99 for algorithm
in cal_test.algorithms:
100 algorithm.params = {
"iov_coverage": output_iov}