11 """ECL timing calibration that performs the crystal calibrations, one for the whole set of runs."""
13 from prompt
import CalibrationSettings
14 from reconstruction
import prepare_cdst_analysis
15 from caf.utils
import IoV
29 settings = CalibrationSettings(
30 name=
"ECL crystal time calibrations",
31 expert_username=
"ehill",
33 input_data_formats=[
"cdst"],
34 input_data_names=[
"bhabha_all_calib"],
59 def get_calibrations(input_data, **kwargs):
62 input_data (dict): Should contain every name from the 'input_data_names' variable as a key.
63 Each value is a dictionary with {"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful for
64 assigning to calibration.files_to_iov
66 **kwargs: Configuration options to be sent in. Since this may change we use kwargs as a way to help prevent
67 backwards compatibility problems. But you could use the correct arguments in b2caf-prompt-run for this
68 release explicitly if you want to.
70 Currently only kwargs["output_iov"] is used. This is the output IoV range that your payloads should
71 correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
74 list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
82 file_to_iov_physics = input_data[
"bhabha_all_calib"]
88 max_files_per_run = 2600
95 reduced_file_to_iov_physics = filter_by_max_files_per_run(file_to_iov_physics, max_files_per_run)
96 input_files_physics = list(reduced_file_to_iov_physics.keys())
97 basf2.B2INFO(f
"Total number of files actually used as input = {len(input_files_physics)}")
100 from basf2
import register_module, create_path
101 from ROOT
import Belle2
102 from caf.framework
import Collection
106 root_input = register_module(
'RootInput')
107 rec_path_bhabha = create_path()
108 rec_path_bhabha.add_module(root_input)
109 if 'Gearbox' not in rec_path_bhabha:
110 rec_path_bhabha.add_module(
'Gearbox')
111 if 'Geometry' not in rec_path_bhabha:
112 rec_path_bhabha.add_module(
'Geometry', useDB=
True)
114 prepare_cdst_analysis(rec_path_bhabha)
117 t0BiasCorrection = -0.9
120 col_bhabha = register_module(
'ECLBhabhaTCollector')
121 col_bhabha.param(
'timeAbsMax', 250)
122 col_bhabha.param(
'minCrystal', 1)
123 col_bhabha.param(
'maxCrystal', 8736)
124 col_bhabha.param(
'saveTree',
False)
125 col_bhabha.param(
'hadronEventT0_TO_bhabhaEventT0_correction', t0BiasCorrection)
128 input_files=input_files_physics,
129 pre_collector_path=rec_path_bhabha)
139 eclTAlgCrystals.crateIDLo = 3
140 eclTAlgCrystals.crateIDHi = 2
141 eclTAlgCrystals.debugOutput =
True
142 eclTAlgCrystals.meanCleanRebinFactor = 3
143 eclTAlgCrystals.meanCleanCutMinFactor = 0.3
144 eclTAlgCrystals.debugFilenameBase =
"eclBhabhaTAlgorithm"
149 from caf.framework
import Calibration
151 cal_crystals =
Calibration(
"ECLcrystalTimeCalibration_physics")
152 cal_crystals.add_collection(name=
"bhabha", collection=eclTCol)
153 cal_crystals.algorithms = [eclTAlgCrystals]
156 from caf.strategies
import SingleIOV
162 cal_crystals.strategies = SingleIOV
173 cal_ecl_merge =
Calibration(name=
"ecl_t_merge", collector=
"DummyCollector", algorithms=[merging_alg],
174 input_files=input_files_physics[:1])
177 cal_ecl_merge.depends_on(cal_crystals)
180 ecl_merge_pre_path = basf2.create_path()
181 prepare_cdst_analysis(ecl_merge_pre_path, components=[
'ECL'])
182 ecl_merge_pre_path.pre_collector_path = ecl_merge_pre_path
186 intermediate_iov = IoV(0, 0, -1, -1)
187 requested_iov = kwargs.get(
"requested_iov",
None)
188 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
189 for algorithm
in cal_crystals.algorithms:
190 algorithm.params = {
"apply_iov": intermediate_iov}
191 for algorithm
in cal_ecl_merge.algorithms:
192 algorithm.params = {
"apply_iov": output_iov}
196 return [cal_crystals, cal_ecl_merge]
Calibrate ecl crystals using bhabha events.
Calibrate ecl crystals using previously created payloads.