11 """ECL timing validations. Does both the bhabha self-consistency check and the hadronic event selection validation."""
13 from prompt
import CalibrationSettings
14 from reconstruction
import prepare_user_cdst_analysis
15 from caf.utils
import IoV
29 settings = CalibrationSettings(
30 name=
"ECL time validations - bhabha and hadronic selections",
31 expert_username=
"ehill",
33 input_data_formats=[
"cdst"],
34 input_data_names=[
"bhabha_all_calib",
"hadron_calib"],
67 def get_calibrations(input_data, **kwargs):
70 input_data (dict): Should contain every name from the 'input_data_names' variable as a key.
71 Each value is a dictionary with {"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful for
72 assigning to calibration.files_to_iov
74 **kwargs: Configuration options to be sent in. Since this may change we use kwargs as a way to help prevent
75 backwards compatibility problems. But you could use the correct arguments in b2caf-prompt-run for this
76 release explicitly if you want to.
78 Currently only kwargs["output_iov"] is used. This is the output IoV range that your payloads should
79 correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
82 list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
90 file_to_iov_bhabha = input_data[
"bhabha_all_calib"]
91 file_to_iov_hadron = input_data[
"hadron_calib"]
93 max_events_per_run = 3000
100 reduced_file_to_iov_bhabha = filter_by_max_events_per_run(file_to_iov_bhabha, max_events_per_run)
101 input_files_bhabha = list(reduced_file_to_iov_bhabha.keys())
102 basf2.B2INFO(f
"Total number of bhabha files actually used as input = {len(input_files_bhabha)}")
104 reduced_file_to_iov_hadron = filter_by_max_events_per_run(file_to_iov_hadron, max_events_per_run)
105 input_files_hadron = list(reduced_file_to_iov_hadron.keys())
106 basf2.B2INFO(f
"Total number of hadron files actually used as input = {len(input_files_hadron)}")
110 from basf2
import register_module, create_path
112 from ROOT
import Belle2
113 from ROOT.Belle2
import TestCalibrationAlgorithm
114 from caf.framework
import Collection
118 root_input = register_module(
'RootInput')
119 rec_path_bhabha = create_path()
120 rec_path_bhabha.add_module(root_input)
121 if 'Gearbox' not in rec_path_bhabha:
122 rec_path_bhabha.add_module(
'Gearbox')
123 if 'Geometry' not in rec_path_bhabha:
124 rec_path_bhabha.add_module(
'Geometry', useDB=
True)
126 prepare_user_cdst_analysis(rec_path_bhabha)
128 col_bhabha = register_module(
'eclBhabhaTimeCalibrationValidationCollector')
129 col_bhabha.param(
'timeAbsMax', 70)
130 col_bhabha.param(
'saveTree',
False)
133 input_files=input_files_bhabha,
134 pre_collector_path=rec_path_bhabha)
146 eclValTAlgBhabha.meanCleanRebinFactor = 3
147 eclValTAlgBhabha.meanCleanCutMinFactor = 0.4
148 eclValTAlgBhabha.debugFilenameBase =
"eclBhabhaTValidationAlgorithm"
153 from caf.framework
import Calibration
155 valid_cal_bhabha =
Calibration(
"ECLcrystalTimeCalValidation_bhabhaPhysics")
156 valid_cal_bhabha.add_collection(name=
"bhabha", collection=eclValTCol)
157 valid_cal_bhabha.algorithms = [eclValTAlgBhabha]
160 from caf.strategies
import SingleIOV
166 valid_cal_bhabha.strategies = SingleIOV
170 root_input = register_module(
'RootInput')
171 rec_path_hadron = create_path()
172 rec_path_hadron.add_module(root_input)
173 if 'Gearbox' not in rec_path_hadron:
174 rec_path_hadron.add_module(
'Gearbox')
175 if 'Geometry' not in rec_path_hadron:
176 rec_path_hadron.add_module(
'Geometry', useDB=
True)
178 prepare_user_cdst_analysis(rec_path_hadron)
180 col_hadron = register_module(
'eclHadronTimeCalibrationValidationCollector')
181 col_hadron.param(
'timeAbsMax', 70)
182 col_hadron.param(
'saveTree',
False)
185 input_files=input_files_hadron,
186 pre_collector_path=rec_path_hadron)
198 eclValTAlgHadronic.meanCleanRebinFactor = 3
199 eclValTAlgHadronic.meanCleanCutMinFactor = 0.4
200 eclValTAlgHadronic.debugFilenameBase =
"eclHadronTValidationAlgorithm"
205 from caf.framework
import Calibration
207 valid_cal_hadron =
Calibration(
"ECLcrystalTimeCalValidation_hadronPhysics")
208 valid_cal_hadron.add_collection(name=
"hadron", collection=eclValTCol)
209 valid_cal_hadron.algorithms = [eclValTAlgHadronic]
212 from caf.strategies
import SingleIOV
218 valid_cal_hadron.strategies = SingleIOV
224 return [valid_cal_bhabha, valid_cal_hadron]
Validate the ecl timing calibrations using a hadronic event selection.