10Calibration of KLM strip efficiency. It provides calibration constants for the KLMSripEfficiency
15from prompt
import CalibrationSettings, INPUT_DATA_FILTERS
26settings = CalibrationSettings(
27 name=
'KLM strip efficiency',
28 expert_username=
'nbrenny',
30 input_data_formats=[
'cdst'],
31 input_data_names=[
'hlt_mumu'],
33 'hlt_mumu': [INPUT_DATA_FILTERS[
'Run Type'][
'physics'],
34 INPUT_DATA_FILTERS[
'Data Tag'][
'mumu_tight_or_highm_calib'],
35 INPUT_DATA_FILTERS[
'Data Quality Tag'][
'Good Or Recoverable']]
52def get_calibrations(input_data, **kwargs):
55 input_data (dict): Should contain every name from the
'input_data_names' variable
as a key.
56 Each value
is a dictionary
with {
"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful
for
57 assigning to calibration.files_to_iov
59 **kwargs: Configuration options to be sent
in. Since this may change we use kwargs
as a way to help prevent
60 backwards compatibility problems. But you could use the correct arguments
in b2caf-prompt-run
for this
61 release explicitly
if you want to.
63 Currently only kwargs[
"requested_iov"]
is used. This
is the output IoV range that your payloads should
64 correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
67 list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
73 file_to_iov_cdst = input_data[
'hlt_mumu']
91 input_files_cdst = sorted(list(file_to_iov_cdst.keys()))
92 basf2.B2INFO(f
'Total number of \'hlt_mumu\' files actually used as input = {len(input_files_cdst)}')
94 if not input_files_cdst:
95 raise Exception(
'No valid input files found!')
99 requested_iov = kwargs[
'requested_iov']
101 from caf.utils
import IoV
103 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
107 from ROOT
import Belle2
108 from ROOT.Belle2
import KLMStripEfficiencyAlgorithm
110 alg = KLMStripEfficiencyAlgorithm()
115 from caf.framework
import Calibration, Collection
122 from klm_calibration_utils
import get_strip_efficiency_pre_collector_path
125 muon_list_name =
'klmStripEfficiency'
126 coll_cdst = get_collector(input_data_name=
'hlt_mumu',
127 muon_list_name=muon_list_name)
128 rec_path_cdst = get_strip_efficiency_pre_collector_path(muon_list_name=muon_list_name)
130 collection_cdst =
Collection(collector=coll_cdst,
131 input_files=input_files_cdst,
132 pre_collector_path=rec_path_cdst)
134 cal_klm.add_collection(name=
'cdst', collection=collection_cdst)
139 cal_klm.algorithms = [alg]
141 from klm_strip_efficiency
import KLMStripEfficiency
143 for algorithm
in cal_klm.algorithms:
144 algorithm.strategy = KLMStripEfficiency
145 algorithm.params = {
'iov_coverage': output_iov}
153def get_collector(input_data_name, muon_list_name):
155 Return the correct KLMStripEfficiencyCollector module setup for each data type.
156 Placed here so it can be different
for prompt compared to standard.
159 if input_data_name ==
'hlt_mumu':
160 return basf2.register_module(
'KLMStripEfficiencyCollector',
161 MuonListName=f
'mu+:{muon_list_name}',
162 MinimalMatchingDigits=14,
163 MinimalMatchingDigitsOuterLayers=4,
164 MinimalMomentumNoOuterLayers=4.0)
165 raise Exception(
"Unknown input data name used when setting up collector")