3 """A simple example calibration that takes one input data list from raw data and performs
4 a single calibration."""
7 from prompt
import CalibrationSettings
18 settings = CalibrationSettings(name=
'KLM strip efficiency',
19 expert_username=
'depietro',
21 input_data_formats=[
'cdst'],
22 input_data_names=[
'hlt_mumu'],
38 def get_calibrations(input_data, **kwargs):
41 input_data (dict): Should contain every name from the 'input_data_names' variable as a key.
42 Each value is a dictionary with {"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful for
43 assigning to calibration.files_to_iov
45 **kwargs: Configuration options to be sent in. Since this may change we use kwargs as a way to help prevent
46 backwards compatibility problems. But you could use the correct arguments in b2caf-prompt-run for this
47 release explicitly if you want to.
49 Currently only kwargs["requested_iov"] is used. This is the output IoV range that your payloads should
50 correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
53 list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
59 file_to_iov_cdst = input_data[
'hlt_mumu']
69 min_events_per_file = 1
77 input_files_cdst = sorted(list(file_to_iov_cdst.keys()))
78 basf2.B2INFO(f
'Total number of \'hlt_mumu\' files actually used as input = {len(input_files_cdst)}')
80 if not input_files_cdst:
81 raise Exception(
'No valid input files found!')
85 requested_iov = kwargs[
'requested_iov']
87 from caf.utils
import IoV
89 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
94 from ROOT.Belle2
import KLMStripEfficiencyAlgorithm
96 alg = KLMStripEfficiencyAlgorithm()
101 from caf.framework
import Calibration, Collection
108 from klm_calibration_utils
import get_strip_efficiency_pre_collector_path
111 coll_cdst = get_collector(
'hlt_mumu')
112 rec_path_cdst = get_strip_efficiency_pre_collector_path()
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 klm_strip_efficiency
import KLMStripEfficiency
127 for algorithm
in cal_klm.algorithms:
128 algorithm.strategy = KLMStripEfficiency
129 algorithm.params = {
'iov_coverage': output_iov}
137 def get_collector(input_data_name):
139 Return the correct KLMStripEfficiencyCollector 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(
'KLMStripEfficiencyCollector',
145 MuonListName=
'mu+:klmStripEfficiency',
146 MinimalMatchingDigits=14,
147 MinimalMatchingDigitsOuterLayers=4,
148 MinimalMomentumNoOuterLayers=4.0)
149 raise Exception(
"Unknown input data name used when setting up collector")