9"""A simple example calibration that takes one input data list from raw data and performs
10a single calibration."""
12from prompt
import CalibrationSettings, INPUT_DATA_FILTERS
15settings = CalibrationSettings(
16 name=
"ARICH channel masks",
17 expert_username=
"luka",
19 input_data_formats=[
"raw"],
20 input_data_names=[
"bhabha_all_calib"],
23 INPUT_DATA_FILTERS[
"Data Tag"][
"bhabha_all_calib"],
24 INPUT_DATA_FILTERS[
"Run Type"][
"physics"],
25 INPUT_DATA_FILTERS[
"Data Quality Tag"][
"Good Or Recoverable"]]},
31def get_calibrations(input_data, **kwargs):
34 input_data (dict): Should contain every name from the
'input_data_names' variable
as a key.
35 Each value
is a dictionary
with {
"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful
for
36 assigning to calibration.files_to_iov
38 **kwargs: Configuration options to be sent
in. Since this may change we use kwargs
as a way to help prevent
39 backwards compatibility problems. But you could use the correct arguments
in b2caf-prompt-run
for this
40 release explicitly
if you want to.
42 Currently only kwargs[
"output_iov"]
is used. This
is the output IoV range that your payloads should
43 correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
46 list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
53 file_to_iov_physics = input_data[
"bhabha_all_calib"]
58 max_files_per_run = 100
64 reduced_file_to_iov_physics = filter_by_max_files_per_run(file_to_iov_physics, max_files_per_run)
65 input_files_physics = list(reduced_file_to_iov_physics.keys())
66 basf2.B2INFO(f
"Total number of files actually used as input = {len(input_files_physics)}")
70 requested_iov = kwargs.get(
"requested_iov",
None)
72 from caf.utils
import IoV
74 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
79 from basf2
import create_path
80 from ROOT
import Belle2
81 from ROOT.Belle2
import ARICHChannelMaskMaker
83 alg_arich = ARICHChannelMaskMaker()
88 from caf.framework
import Calibration
89 from caf.strategies
import SequentialRunByRun
92 rec_path_1 = create_path()
93 rec_path_1.add_module(
'ARICHUnpacker')
96 collector=
"ARICHChannelMask",
97 algorithms=[alg_arich],
98 input_files=input_files_physics,
99 pre_collector_path=rec_path_1
102 cal_test.strategies = SequentialRunByRun
106 for algorithm
in cal_test.algorithms:
107 algorithm.params = {
"iov_coverage": output_iov}