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, input_data_filters
18 settings = CalibrationSettings(name=
'KLM strip efficiency',
19 expert_username=
'depietro',
21 input_data_formats=[
'cdst'],
22 input_data_names=[
'hlt_mumu'],
24 'hlt_mumu': [input_data_filters[
'Run Type'][
'physics'],
25 input_data_filters[
'Data Tag'][
'mumutight_calib'],
26 input_data_filters[
'Data Quality Tag'][
'Good Or Recoverable']]
43 def get_calibrations(input_data, **kwargs):
46 input_data (dict): Should contain every name from the 'input_data_names' variable as a key.
47 Each value is a dictionary with {"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful for
48 assigning to calibration.files_to_iov
50 **kwargs: Configuration options to be sent in. Since this may change we use kwargs as a way to help prevent
51 backwards compatibility problems. But you could use the correct arguments in b2caf-prompt-run for this
52 release explicitly if you want to.
54 Currently only kwargs["requested_iov"] is used. This is the output IoV range that your payloads should
55 correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
58 list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
64 file_to_iov_cdst = input_data[
'hlt_mumu']
74 min_events_per_file = 1
82 input_files_cdst = sorted(list(file_to_iov_cdst.keys()))
83 basf2.B2INFO(f
'Total number of \'hlt_mumu\' files actually used as input = {len(input_files_cdst)}')
85 if not input_files_cdst:
86 raise Exception(
'No valid input files found!')
90 requested_iov = kwargs[
'requested_iov']
92 from caf.utils
import IoV
94 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
99 from ROOT.Belle2
import KLMStripEfficiencyAlgorithm
101 alg = KLMStripEfficiencyAlgorithm()
106 from caf.framework
import Calibration, Collection
113 from klm_calibration_utils
import get_strip_efficiency_pre_collector_path
116 coll_cdst = get_collector(
'hlt_mumu')
117 rec_path_cdst = get_strip_efficiency_pre_collector_path()
119 collection_cdst =
Collection(collector=coll_cdst,
120 input_files=input_files_cdst,
121 pre_collector_path=rec_path_cdst)
123 cal_klm.add_collection(name=
'cdst', collection=collection_cdst)
128 cal_klm.algorithms = [alg]
130 from klm_strip_efficiency
import KLMStripEfficiency
132 for algorithm
in cal_klm.algorithms:
133 algorithm.strategy = KLMStripEfficiency
134 algorithm.params = {
'iov_coverage': output_iov}
142 def get_collector(input_data_name):
144 Return the correct KLMStripEfficiencyCollector module setup for each data type.
145 Placed here so it can be different for prompt compared to standard.
148 if input_data_name ==
'hlt_mumu':
149 return basf2.register_module(
'KLMStripEfficiencyCollector',
150 MuonListName=
'mu+:klmStripEfficiency',
151 MinimalMatchingDigits=14,
152 MinimalMatchingDigitsOuterLayers=4,
153 MinimalMomentumNoOuterLayers=4.0)
154 raise Exception(
"Unknown input data name used when setting up collector")