10Calibration of KLM time. It provides calibration constants for the KLMTimeCableDelay
11and KLMTimeConstants database objects.
15from prompt
import CalibrationSettings, INPUT_DATA_FILTERS
26settings = CalibrationSettings(name=
'KLM time',
27 expert_username=
'amubarak',
29 input_data_formats=[
'cdst'],
30 input_data_names=[
'hlt_mumu'],
32 'hlt_mumu': [INPUT_DATA_FILTERS[
'Run Type'][
'physics'],
33 INPUT_DATA_FILTERS[
'Data Tag'][
'mumu_tight_or_highm_calib'],
34 INPUT_DATA_FILTERS[
'Data Quality Tag'][
'Good Or Recoverable']]
51def 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[
"requested_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
72 file_to_iov_cdst = input_data[
'hlt_mumu']
73 input_files_cdst = sorted(list(file_to_iov_cdst.keys()))
74 basf2.B2INFO(f
'Total number of \'hlt_mumu\' files actually used as input = {len(input_files_cdst)}')
76 if not input_files_cdst:
77 raise Exception(
'No valid input files found!')
81 requested_iov = kwargs[
'requested_iov']
83 from caf.utils
import IoV
85 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
89 from ROOT
import Belle2
90 from ROOT.Belle2
import KLMTimeAlgorithm
92 alg = KLMTimeAlgorithm()
97 from caf.framework
import Calibration, Collection
104 from klm_calibration_utils
import get_time_pre_collector_path
107 muon_list_name =
'klmTime'
108 coll_cdst = get_collector(input_data_name=
'hlt_mumu',
109 muon_list_name=muon_list_name)
110 rec_path_cdst = get_time_pre_collector_path(muon_list_name=muon_list_name)
112 collection_cdst =
Collection(collector=coll_cdst,
113 input_files=input_files_cdst,
114 pre_collector_path=rec_path_cdst)
116 cal_klm.add_collection(name=
'cdst', collection=collection_cdst)
121 cal_klm.algorithms = [alg]
123 from caf.strategies
import SequentialRunByRun
125 for algorithm
in cal_klm.algorithms:
126 algorithm.strategy = SequentialRunByRun
127 algorithm.params = {
'iov_coverage': output_iov}
135def get_collector(input_data_name, muon_list_name):
137 Return the correct KLMTimeCollector module setup for each data type.
138 Placed here so it can be different
for prompt compared to standard.
141 if input_data_name ==
'hlt_mumu':
142 return basf2.register_module(
'KLMTimeCollector',
143 inputParticleList=f
'mu+:{muon_list_name}')
144 raise Exception(
"Unknown input data name used when setting up collector")