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)}")
101 from basf2
import register_module, create_path
103 from ROOT
import Belle2
104 from ROOT.Belle2
import TestCalibrationAlgorithm
105 from caf.framework
import Collection
109 root_input = register_module(
'RootInput')
110 rec_path_bhabha = create_path()
111 rec_path_bhabha.add_module(root_input)
112 if 'Gearbox' not in rec_path_bhabha:
113 rec_path_bhabha.add_module(
'Gearbox')
114 if 'Geometry' not in rec_path_bhabha:
115 rec_path_bhabha.add_module(
'Geometry', useDB=
True)
117 prepare_cdst_analysis(rec_path_bhabha)
120 t0BiasCorrection = -0.9
123 col_bhabha = register_module(
'ECLBhabhaTCollector')
124 col_bhabha.param(
'timeAbsMax', 250)
125 col_bhabha.param(
'minCrystal', 1)
126 col_bhabha.param(
'maxCrystal', 8736)
127 col_bhabha.param(
'saveTree',
False)
128 col_bhabha.param(
'hadronEventT0_TO_bhabhaEventT0_correction', t0BiasCorrection)
131 input_files=input_files_physics,
132 pre_collector_path=rec_path_bhabha)
142 eclTAlgCrystals.crateIDLo = 3
143 eclTAlgCrystals.crateIDHi = 2
144 eclTAlgCrystals.debugOutput =
True
145 eclTAlgCrystals.meanCleanRebinFactor = 3
146 eclTAlgCrystals.meanCleanCutMinFactor = 0.3
147 eclTAlgCrystals.debugFilenameBase =
"eclBhabhaTAlgorithm"
152 from caf.framework
import Calibration
154 cal_crystals =
Calibration(
"ECLcrystalTimeCalibration_physics")
155 cal_crystals.add_collection(name=
"bhabha", collection=eclTCol)
156 cal_crystals.algorithms = [eclTAlgCrystals]
159 from caf.strategies
import SingleIOV
165 cal_crystals.strategies = SingleIOV
176 cal_ecl_merge =
Calibration(name=
"ecl_t_merge", collector=
"DummyCollector", algorithms=[merging_alg],
177 input_files=input_files_physics[:1])
180 cal_ecl_merge.depends_on(cal_crystals)
183 ecl_merge_pre_path = basf2.create_path()
184 prepare_cdst_analysis(ecl_merge_pre_path, components=[
'ECL'])
185 ecl_merge_pre_path.pre_collector_path = ecl_merge_pre_path
189 intermediate_iov = IoV(0, 0, -1, -1)
190 requested_iov = kwargs.get(
"requested_iov",
None)
191 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
192 for algorithm
in cal_crystals.algorithms:
193 algorithm.params = {
"apply_iov": intermediate_iov}
194 for algorithm
in cal_ecl_merge.algorithms:
195 algorithm.params = {
"apply_iov": output_iov}
199 return [cal_crystals, cal_ecl_merge]
Calibrate ecl crystals using bhabha events.
Calibrate ecl crystals using previously created payloads.