14 from ROOT.Belle2
import SVD3SampleELSTimeCalibrationAlgorithm
16 from caf.framework
import Calibration
17 from prompt
import CalibrationSettings
18 from caf
import strategies
19 from caf.utils
import IoV
23 b2.set_log_level(b2.LogLevel.INFO)
25 now = datetime.datetime.now()
27 settings = CalibrationSettings(name=
"SVD3SampleELSTimeCalibrationPrompt",
28 expert_username=
"gdujany",
30 input_data_formats=[
"cdst"],
31 input_data_names=[
"hlt_hadron"],
37 def get_calibrations(input_data, **kwargs):
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 moda.param(
"ShaperDigits",
'SVDShaperDigitsFromTracks')
60 moda.param(
"timeAlgorithm", 2)
61 if moda.name() ==
'SVDSpacePointCreator':
62 moda.param(
"SVDClusters",
'SVDClustersFromTracks')
64 path = b2.remove_module(path,
'SVDMissingAPVsClusterCreator')
66 file_to_iov_physics = input_data[
"hlt_hadron"]
73 reduced_file_to_iov_physics = filter_by_max_files_per_run(file_to_iov_physics, max_files_per_run, min_events_per_file=1)
75 good_input_files = list(reduced_file_to_iov_physics.keys())
76 b2.B2INFO(f
"Total number of files actually used as input = {len(good_input_files)}")
78 exps = [i.exp_low
for i
in reduced_file_to_iov_physics.values()]
79 runs = sorted([i.run_low
for i
in reduced_file_to_iov_physics.values()])
85 if not len(good_input_files):
86 print(
"No good input files found! Check that the input files have entries != 0!")
89 uniqueID =
"SVD3SampleELSTimeCalibrations_Test_" + str(now.isoformat()) +
"_INFO:_1stOrderPolAndInv_TBindep_Exp" + \
90 str(expNum) +
"_runsFrom" + str(firstRun) +
"to" + str(lastRun)
97 requested_iov = kwargs.get(
"requested_iov",
None)
98 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
101 collector = b2.register_module(
'SVDTimeCalibrationCollector')
102 collector.param(
"SVDClustersFromTracksName",
"SVDClustersFromTracks")
103 collector.param(
"SVDEventInfoName",
"SVDEventInfo")
104 collector.param(
"EventT0Name",
"EventT0")
105 collector.param(
"granularity",
"run")
108 algorithm = SVD3SampleELSTimeCalibrationAlgorithm(uniqueID)
109 algorithm.setMinEntries(10000)
114 algorithms=algorithm,
115 input_files=good_input_files,
116 pre_collector_path=path,
122 calibration.strategies = strategies.SequentialBoundaries
124 for algorithm
in calibration.algorithms:
125 algorithm.params = {
"iov_coverage": output_iov}
def add_svd_unpacker(path)
def add_svd_reconstruction(path, isROIsimulation=False, createRecoDigits=False, applyMasking=False)