3 """ECL timing calibration that performs the crystal calibrations, one for the whole set of runs."""
5 from prompt
import CalibrationSettings
6 from reconstruction
import *
7 from caf.utils
import IoV
21 settings = CalibrationSettings(
22 name=
"ECL crystal time calibrations",
23 expert_username=
"ehill",
25 input_data_formats=[
"cdst"],
26 input_data_names=[
"bhabha_all_calib"],
51 def get_calibrations(input_data, **kwargs):
54 input_data (dict): Should contain every name from the 'input_data_names' variable as a key.
55 Each value is a dictionary with {"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful for
56 assigning to calibration.files_to_iov
58 **kwargs: Configuration options to be sent in. Since this may change we use kwargs as a way to help prevent
59 backwards compatibility problems. But you could use the correct arguments in b2caf-prompt-run for this
60 release explicitly if you want to.
62 Currently only kwargs["output_iov"] is used. This is the output IoV range that your payloads should
63 correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
66 list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
74 file_to_iov_physics = input_data[
"bhabha_all_calib"]
80 max_files_per_run = 2600
87 reduced_file_to_iov_physics = filter_by_max_files_per_run(file_to_iov_physics, max_files_per_run)
88 input_files_physics = list(reduced_file_to_iov_physics.keys())
89 basf2.B2INFO(f
"Total number of files actually used as input = {len(input_files_physics)}")
93 from basf2
import register_module, create_path
95 from ROOT
import Belle2
96 from ROOT.Belle2
import TestCalibrationAlgorithm
97 from caf.framework
import Collection
101 root_input = register_module(
'RootInput')
102 rec_path_bhabha = create_path()
103 rec_path_bhabha.add_module(root_input)
104 if 'Gearbox' not in rec_path_bhabha:
105 rec_path_bhabha.add_module(
'Gearbox')
106 if 'Geometry' not in rec_path_bhabha:
107 rec_path_bhabha.add_module(
'Geometry', useDB=
True)
109 prepare_cdst_analysis(rec_path_bhabha)
112 t0BiasCorrection = -0.9
115 col_bhabha = register_module(
'ECLBhabhaTCollector')
116 col_bhabha.param(
'timeAbsMax', 250)
117 col_bhabha.param(
'minCrystal', 1)
118 col_bhabha.param(
'maxCrystal', 8736)
119 col_bhabha.param(
'saveTree',
False)
120 col_bhabha.param(
'hadronEventT0_TO_bhabhaEventT0_correction', t0BiasCorrection)
123 input_files=input_files_physics,
124 pre_collector_path=rec_path_bhabha)
134 eclTAlgCrystals.crateIDLo = 3
135 eclTAlgCrystals.crateIDHi = 2
136 eclTAlgCrystals.debugOutput =
True
137 eclTAlgCrystals.meanCleanRebinFactor = 3
138 eclTAlgCrystals.meanCleanCutMinFactor = 0.3
139 eclTAlgCrystals.debugFilenameBase =
"eclBhabhaTAlgorithm"
144 from caf.framework
import Calibration
146 cal_crystals =
Calibration(
"ECLcrystalTimeCalibration_physics")
147 cal_crystals.add_collection(name=
"bhabha", collection=eclTCol)
148 cal_crystals.algorithms = [eclTAlgCrystals]
151 from caf.strategies
import SingleIOV
157 cal_crystals.strategies = SingleIOV
168 cal_ecl_merge =
Calibration(name=
"ecl_t_merge", collector=
"DummyCollector", algorithms=[merging_alg],
169 input_files=input_files_physics[:1])
172 cal_ecl_merge.depends_on(cal_crystals)
175 ecl_merge_pre_path = basf2.create_path()
176 prepare_cdst_analysis(ecl_merge_pre_path, components=[
'ECL'])
177 ecl_merge_pre_path.pre_collector_path = ecl_merge_pre_path
181 intermediate_iov = IoV(0, 0, -1, -1)
182 requested_iov = kwargs.get(
"requested_iov",
None)
183 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
184 for algorithm
in cal_crystals.algorithms:
185 algorithm.params = {
"apply_iov": intermediate_iov}
186 for algorithm
in cal_ecl_merge.algorithms:
187 algorithm.params = {
"apply_iov": output_iov}
191 return [cal_crystals, cal_ecl_merge]