12 Calibration of KLM time. It provides calibration constants for the KLMTimeCableDelay
13 and KLMTimeConstants database objects.
17 from prompt
import CalibrationSettings, INPUT_DATA_FILTERS
28 settings = CalibrationSettings(name=
'KLM time',
29 expert_username=
'seemac',
31 input_data_formats=[
'cdst'],
32 input_data_names=[
'hlt_mumu'],
34 'hlt_mumu': [INPUT_DATA_FILTERS[
'Run Type'][
'physics'],
35 INPUT_DATA_FILTERS[
'Data Tag'][
'mumutight_calib'],
36 INPUT_DATA_FILTERS[
'Data Quality Tag'][
'Good Or Recoverable']]
53 def get_calibrations(input_data, **kwargs):
56 input_data (dict): Should contain every name from the 'input_data_names' variable as a key.
57 Each value is a dictionary with {"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful for
58 assigning to calibration.files_to_iov
60 **kwargs: Configuration options to be sent in. Since this may change we use kwargs as a way to help prevent
61 backwards compatibility problems. But you could use the correct arguments in b2caf-prompt-run for this
62 release explicitly if you want to.
64 Currently only kwargs["requested_iov"] is used. This is the output IoV range that your payloads should
65 correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
68 list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
74 file_to_iov_cdst = input_data[
'hlt_mumu']
75 input_files_cdst = sorted(list(file_to_iov_cdst.keys()))
76 basf2.B2INFO(f
'Total number of \'hlt_mumu\' files actually used as input = {len(input_files_cdst)}')
78 if not input_files_cdst:
79 raise Exception(
'No valid input files found!')
83 requested_iov = kwargs[
'requested_iov']
85 from caf.utils
import IoV
87 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
92 from ROOT.Belle2
import KLMTimeAlgorithm
94 alg = KLMTimeAlgorithm()
99 from caf.framework
import Calibration, Collection
106 from klm_calibration_utils
import get_time_pre_collector_path
109 muon_list_name =
'klmTime'
110 coll_cdst = get_collector(input_data_name=
'hlt_mumu',
111 muon_list_name=muon_list_name)
112 rec_path_cdst = get_time_pre_collector_path(muon_list_name=muon_list_name)
114 collection_cdst =
Collection(collector=coll_cdst,
115 input_files=input_files_cdst,
116 pre_collector_path=rec_path_cdst)
118 cal_klm.add_collection(name=
'cdst', collection=collection_cdst)
123 cal_klm.algorithms = [alg]
125 from caf.strategies
import SequentialRunByRun
127 for algorithm
in cal_klm.algorithms:
128 algorithm.strategy = SequentialRunByRun
129 algorithm.params = {
'iov_coverage': output_iov}
137 def get_collector(input_data_name, muon_list_name):
139 Return the correct KLMTimeCollector module setup for each data type.
140 Placed here so it can be different for prompt compared to standard.
143 if input_data_name ==
'hlt_mumu':
144 return basf2.register_module(
'KLMTimeCollector',
145 inputParticleList=f
'mu+:{muon_list_name}')
146 raise Exception(
"Unknown input data name used when setting up collector")