11 """ECL waveform template calibration"""
13 from prompt
import CalibrationSettings, INPUT_DATA_FILTERS
14 from caf
import strategies
18 settings = CalibrationSettings(
19 name=
"ecl_WaveformTemplateShapeCalibration",
20 expert_username=
"longos",
22 input_data_formats=[
"cdst"],
23 input_data_names=[
"gamma_gamma_calib"],
25 "gamma_gamma_calib": [
26 INPUT_DATA_FILTERS[
"Data Tag"][
"gamma_gamma_calib"],
27 INPUT_DATA_FILTERS[
"Data Quality Tag"][
"Good Or Recoverable"],
28 INPUT_DATA_FILTERS[
"Run Type"][
"physics"],
29 INPUT_DATA_FILTERS[
"Magnet"][
"On"]]},
38 def get_calibrations(input_data, **kwargs):
40 from ROOT
import Belle2
41 from caf.utils
import IoV
42 from caf.framework
import Calibration
48 file_to_iov_gamma_gamma = input_data[
"gamma_gamma_calib"]
49 input_files = list(file_to_iov_gamma_gamma.keys())
55 collector_C1 = basf2.register_module(
"eclWaveformTemplateCalibrationC1Collector")
59 collector=collector_C1,
61 input_files=input_files,
62 max_files_per_collector_job=4)
63 cal_ecl_Wave_C1.strategies = strategies.SequentialRunByRun
66 gamma_gamma_pre_path = basf2.create_path()
67 gamma_gamma_pre_path.add_module(
"RootInput", inputFileNames=
"", branchNames=[
"EventMetaData",
"RawECLs"])
68 gamma_gamma_pre_path.add_module(
'ECLUnpacker')
70 cal_ecl_Wave_C1.pre_collector_path = gamma_gamma_pre_path
77 algos_C2.setFirstCellID(LowLimit)
78 algos_C2.setLastCellID(UpperLimit)
81 algos_C3.setFirstCellID(LowLimit)
82 algos_C3.setLastCellID(UpperLimit)
84 collectors_C2 = basf2.register_module(
"eclWaveformTemplateCalibrationC2Collector")
85 collectors_C2.pre_collector_path = gamma_gamma_pre_path
86 collectors_C2.param(
'MinCellID', LowLimit)
87 collectors_C2.param(
'MaxCellID', UpperLimit)
94 collector=collectors_C2,
98 input_files=input_files,
99 max_files_per_collector_job=4)
100 calibrations_C2.pre_collector_path = gamma_gamma_pre_path
101 calibrations_C2.depends_on(cal_ecl_Wave_C1)
102 calibrations_C2.strategies = strategies.SequentialRunByRun
106 algo_C4.setFirstCellID(LowLimit)
107 algo_C4.setLastCellID(UpperLimit)
111 collector=
"DummyCollector",
112 algorithms=[algo_C4],
113 input_files=input_files[:1],
115 cal_ecl_Wave_C4.strategies = strategies.SequentialRunByRun
117 cal_ecl_Wave_C4.depends_on(cal_ecl_Wave_C1)
118 cal_ecl_Wave_C4.depends_on(calibrations_C2)
122 requested_iov = kwargs.get(
"requested_iov",
None)
123 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
124 for algorithm
in cal_ecl_Wave_C1.algorithms:
125 algorithm.params = {
"apply_iov": output_iov}
126 for algorithm
in calibrations_C2.algorithms:
127 algorithm.params = {
"apply_iov": output_iov}
128 for algorithm
in cal_ecl_Wave_C4.algorithms:
129 algorithm.params = {
"apply_iov": output_iov}
133 calList = [cal_ecl_Wave_C1, calibrations_C2, cal_ecl_Wave_C4]