14from caf.framework
import Calibration
15from prompt
import CalibrationSettings
16from caf
import strategies
17from caf.utils
import IoV
21b2.set_log_level(b2.LogLevel.INFO)
22now = datetime.datetime.now()
24settings = CalibrationSettings(name=
"SVDCoGTimeCalibrationPrompt",
25 expert_username=
"gdujany",
27 input_data_formats=[
"cdst"],
28 input_data_names=[
"hlt_hadron"],
34def get_calibrations(input_data, **kwargs):
36 from ROOT
import Belle2
37 from ROOT.Belle2
import SVDCoGTimeCalibrationAlgorithm
40 path = b2.create_path()
42 path.add_module(
"Gearbox")
43 path.add_module(
"Geometry", useDB=
True)
51 for moda
in path.modules():
52 if moda.name() ==
'SVDCoGTimeEstimator':
53 moda.param(
"ShaperDigits",
'SVDShaperDigitsFromTracks')
54 moda.param(
"RecoDigits",
'SVDRecoDigitsFromTracks')
55 moda.param(
"CalibrationWithEventT0",
False)
56 if moda.name() ==
'SVDSimpleClusterizer':
57 moda.param(
"Clusters",
'SVDClustersFromTracks')
58 moda.param(
"RecoDigits",
'SVDRecoDigitsFromTracks')
59 if moda.name() ==
'SVDSpacePointCreator':
60 moda.param(
"SVDClusters",
'SVDClustersFromTracks')
62 path = b2.remove_module(path,
'SVDMissingAPVsClusterCreator')
64 file_to_iov_physics = input_data[
"hlt_hadron"]
71 reduced_file_to_iov_physics = filter_by_max_files_per_run(file_to_iov_physics, max_files_per_run, min_events_per_file=1)
73 good_input_files = list(reduced_file_to_iov_physics.keys())
74 b2.B2INFO(f
"Total number of files actually used as input = {len(good_input_files)}")
76 exps = [i.exp_low
for i
in reduced_file_to_iov_physics.values()]
77 runs = sorted([i.run_low
for i
in reduced_file_to_iov_physics.values()])
83 if not len(good_input_files):
84 print(
"No good input files found! Check that the input files have entries != 0!")
87 uniqueID =
"SVDCoGTimeCalibrations_Prompt_" + str(now.isoformat()) +
"_INFO:_3rdOrderPol_TBindep_Exp" + \
88 str(expNum) +
"_runsFrom" + str(firstRun) +
"to" + str(lastRun)
95 requested_iov = kwargs.get(
"requested_iov",
None)
96 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
99 collector = b2.register_module(
'SVDTimeCalibrationCollector')
100 collector.param(
"SVDClustersFromTracksName",
"SVDClustersFromTracks")
101 collector.param(
"SVDEventInfoName",
"SVDEventInfo")
102 collector.param(
"EventT0Name",
"EventT0")
103 collector.param(
"granularity",
"run")
106 algorithm = SVDCoGTimeCalibrationAlgorithm(uniqueID)
107 algorithm.setMinEntries(10000)
112 algorithms=algorithm,
113 input_files=good_input_files,
114 pre_collector_path=path,
120 calibration.strategies = strategies.SequentialBoundaries
122 for algorithm
in calibration.algorithms:
123 algorithm.params = {
"iov_coverage": output_iov}
def add_svd_reconstruction(path, isROIsimulation=False, createRecoDigits=False, applyMasking=False)
def add_svd_unpacker(path)