11Script to perform the svd time calibration with the CoG6, CoG3 and ELS3 algorithms
22from tracking
import add_tracking_reconstruction
24from caf.framework
import Calibration
25from caf
import strategies
26from caf.utils
import IoV
27from prompt
import CalibrationSettings, INPUT_DATA_FILTERS
30from prompt.calibrations.caf_cdc
import settings
as cdc_tracking_calibration
32b2.set_log_level(b2.LogLevel.INFO)
36now = datetime.datetime.now()
38settings = CalibrationSettings(name=
"caf_svd_time",
39 expert_username=
"giulio.dujany",
42 input_data_formats=[
"raw"],
43 input_data_names=[
"hadron_calib"],
44 input_data_filters={
"hadron_calib": [INPUT_DATA_FILTERS[
"Data Tag"][
"hadron_calib"],
45 INPUT_DATA_FILTERS[
"Beam Energy"][
"4S"],
46 INPUT_DATA_FILTERS[
"Beam Energy"][
"Continuum"],
47 INPUT_DATA_FILTERS[
"Run Type"][
"physics"],
48 INPUT_DATA_FILTERS[
"Magnet"][
"On"]]},
49 depends_on=[cdc_tracking_calibration],
51 "timeAlgorithms": [
"CoG3",
"ELS3",
"CoG6"],
52 "listOfMutedCalibrations": [],
54 "max_events_per_run": 10000,
55 "max_events_per_file": 5000,
57 "linearCutsOnCoG3":
False,
58 "upperLineParameters": [-94.0, 1.264],
59 "lowerLineParameters": [-134.0, 1.264],
60 "rangeRawTimeForIoVCoG6": [20., 80.],
61 "rangeRawTimeForIoVCoG3": [70., 140.],
62 "rangeRawTimeForIoVELS3": [20., 80.],
63 "useRawtimeForTracking":
False,
64 "useSVDGrouping":
True
66 produced_payloads=[
"SVD3SampleCoGTimeCalibrations",
67 "SVD3SampleELSTimeCalibrations",
68 "SVDCoGTimeCalibrations",
69 "SVDClusterTimeShifter"])
75def remove_module(path, name):
77 new_path = b2.create_path()
78 for m
in path.modules():
80 new_path.add_module(m)
85NEW_RECO_DIGITS_NAME =
"SVDRecoDigitsFromTracks"
86NEW_SHAPER_DIGITS_NAME =
"SVDShaperDigitsFromTracks"
89def create_collector(name="SVDTimeCalibrationCollector",
90 clusters="SVDClustersFromTracks",
91 event_info="SVDEventInfo",
96 maxRawTimeForIoV=150.):
98 Simply creates a SVDTimeCalibrationCollector module with some options.
104 collector = b2.register_module(
"SVDTimeCalibrationCollector")
105 collector.set_name(name)
106 collector.param(
"SVDClustersFromTracksName", clusters)
107 collector.param(
"SVDEventInfoName", event_info)
108 collector.param(
"EventT0Name", event_t0)
109 collector.param(
"granularity", granularity)
110 collector.param(
"RawCoGBinWidth", rawBinWidth)
111 collector.param(
"RawTimeIoVMin", minRawTimeForIoV)
112 collector.param(
"RawTimeIoVMax", maxRawTimeForIoV)
117def create_validation_collector(name="SVDTimeValidationCollector",
118 clusters="SVDClusters",
119 clusters_onTracks="SVDClustersOnTracks",
121 collector_module="SVDTimeValidationCollector",
122 time_algorithm="CoG6",
125 Simply creates a SVDTimeCalibrationCollector module with some options.
131 collector = b2.register_module(collector_module)
132 collector.set_name(name)
133 collector.param(
"SVDClustersName", clusters)
134 collector.param(
"SVDClustersOnTracksName", clusters_onTracks)
135 collector.param(
"EventT0Name", event_t0)
136 collector.param(
"granularity", granularity)
137 collector.param(
"TimeAlgorithm", time_algorithm)
145 linearCutsOnCoG3=False,
146 interceptUpperLine=-94.0,
147 angularCoefficientUpperLine=1.264,
148 interceptLowerLine=-134.0,
149 angularCoefficientLowerLine=1.264):
151 Simply creates a SVDCoGTimeCalibrationAlgorithm class with some options.
154 ROOT.Belle2.SVDCoGTimeCalibrationAlgorithm
156 from ROOT
import Belle2
157 from ROOT.Belle2
import SVDCoGTimeCalibrationAlgorithm
158 from ROOT.Belle2
import SVD3SampleCoGTimeCalibrationAlgorithm
159 from ROOT.Belle2
import SVD3SampleELSTimeCalibrationAlgorithm
161 algorithm = SVDCoGTimeCalibrationAlgorithm(unique_id)
163 algorithm = SVD3SampleCoGTimeCalibrationAlgorithm(unique_id)
164 algorithm.setTwoLineSelectionParameters(
167 angularCoefficientUpperLine,
169 angularCoefficientLowerLine)
171 algorithm = SVD3SampleELSTimeCalibrationAlgorithm(unique_id)
173 algorithm.setPrefix(prefix)
174 algorithm.setMinEntries(min_entries)
179def create_validation_algorithm(prefix="", min_entries=10000):
181 Simply creates a SVDCoGTimeValidationAlgorithm class with some options.
184 ROOT.Belle2.SVDCoGTimeValidationAlgorithm
186 from ROOT
import Belle2
187 from ROOT.Belle2
import SVDTimeValidationAlgorithm
189 algorithm = SVDTimeValidationAlgorithm()
192 algorithm.setPrefix(prefix)
193 algorithm.setMinEntries(min_entries)
198def create_svd_clusterizer(name="ClusterReconstruction",
199 clusters="SVDClustersFromTracks",
202 time_algorithm="CoG6",
203 get_3sample_raw_time=False,
204 shiftSVDClusterTime=None,
205 absoluteShiftSVDClusterTime=None,
208 Simply creates a SVDClusterizer module with some options.
214 cluster = b2.register_module(
"SVDClusterizer")
215 cluster.set_name(name)
216 cluster.param(
"Clusters", clusters)
217 if shaper_digits
is not None:
218 cluster.param(
"ShaperDigits", shaper_digits)
219 cluster.param(
"timeAlgorithm6Samples", time_algorithm)
220 if shiftSVDClusterTime
is not None:
221 cluster.param(
"shiftSVDClusterTime", shiftSVDClusterTime)
222 cluster.param(
"useDB",
False)
223 if get_3sample_raw_time:
224 cluster.param(
"returnClusterRawTime",
True)
225 if absoluteShiftSVDClusterTime
is not None:
226 cluster.param(
"absoluteShiftSVDClusterTime", absoluteShiftSVDClusterTime)
230def create_pre_collector_path(
233 max_events_per_run=10000,
234 max_events_per_file=10000,
236 useRawtimeForTracking=False,
237 is_validation=False):
239 Create a basf2 path that runs a common reconstruction path and also runs several SVDSimpleClusterizer
240 modules with different configurations. This way they reuse the same reconstructed objects.
243 clusterizers (list[pybasf2.Module]): All the differently configured
244 SVDSimpleClusterizer modules. They should output to different datastore objects.
245 max_events_per_run (int, optional): Max events read per run. Defaults to 10000.
246 is_validation (bool, optional): Is used to produce the validation plots. Defaults to False.
252 path = b2.create_path()
256 path.add_module(
"RootInput", branchNames=HLT_INPUT_OBJECTS, entrySequences=[f
'0:{max_events_per_file - 1}'])
258 path.add_module(
"RootInput")
262 raw.add_unpackers(path, components=[
'PXD',
'SVD',
'CDC'])
264 path.add_module(
"Gearbox")
265 path.add_module(
"Geometry")
268 skim6SampleEvents = b2.register_module(
"SVD6SampleEventSkim")
269 path.add_module(skim6SampleEvents)
270 emptypath = b2.create_path()
271 skim6SampleEvents.if_false(emptypath)
275 add_tracking_reconstruction(path, append_full_grid_cdc_eventt0=
True, skip_full_grid_cdc_eventt0_if_svd_time_present=
False)
276 path = remove_module(path,
"V0Finder")
277 if not is_validation:
281 b2.set_module_parameters(path,
'SVDClusterizer', returnClusterRawTime=useRawtimeForTracking)
283 if useRawtimeForTracking:
284 b2.set_module_parameters(path,
'SVDTimeGrouping',
285 forceGroupingFromDB=
False,
286 useParamFromDB=
False,
287 isEnabledIn6Samples=
True,
289 expectedSignalTimeCenter=100,
290 expectedSignalTimeMin=70, expectedSignalTimeMax=130,
291 tRangeLow=-20, tRangeHigh=220)
292 b2.set_module_parameters(path,
'SVDSpacePointCreator',
293 forceGroupingFromDB=
False,
294 useParamFromDB=
False,
295 useSVDGroupInfoIn6Sample=
True,
296 numberOfSignalGroups=2, formSingleSignalGroup=
True)
298 b2.set_module_parameters(path,
'SVDTimeGrouping',
299 forceGroupingFromDB=
False,
300 useParamFromDB=
False,
301 isEnabledIn6Samples=
True, acceptSigmaN=3,
302 expectedSignalTimeMin=-30, expectedSignalTimeMax=30)
303 b2.set_module_parameters(path,
'SVDSpacePointCreator',
304 forceGroupingFromDB=
False,
305 useSVDGroupInfoIn6Sample=
True)
307 b2.set_module_parameters(path,
'SVDTimeGrouping', forceGroupingFromDB=
False, isEnabledIn6Samples=
False)
308 b2.set_module_parameters(path,
'SVDSpacePointCreator', forceGroupingFromDB=
False, useSVDGroupInfoIn6Sample=
False)
311 path.add_module(
"SVDShaperDigitsFromTracks")
313 for cluster
in clusterizers:
314 path.add_module(cluster)
316 path = remove_module(path,
"SVDMissingAPVsClusterCreator")
321def get_calibrations(input_data, **kwargs):
323 from ROOT
import Belle2
324 from ROOT.Belle2
import SVDClusterTimeShifterAlgorithm, SVDClusterAbsoluteTimeShifterAlgorithm
326 file_to_iov_physics = input_data[
"hadron_calib"]
327 expert_config = kwargs.get(
"expert_config")
328 timeAlgorithms = expert_config[
"timeAlgorithms"]
329 listOfMutedCalibrations = expert_config[
"listOfMutedCalibrations"]
330 max_events_per_run = expert_config[
"max_events_per_run"]
331 max_events_per_file = expert_config[
"max_events_per_file"]
332 isMC = expert_config[
"isMC"]
333 linearCutsOnCoG3 = expert_config[
"linearCutsOnCoG3"]
334 upperLineParameters = expert_config[
"upperLineParameters"]
335 lowerLineParameters = expert_config[
"lowerLineParameters"]
336 rangeRawTimeForIoVCoG6 = expert_config[
"rangeRawTimeForIoVCoG6"]
337 rangeRawTimeForIoVCoG3 = expert_config[
"rangeRawTimeForIoVCoG3"]
338 rangeRawTimeForIoVELS3 = expert_config[
"rangeRawTimeForIoVELS3"]
339 useSVDGrouping = expert_config[
"useSVDGrouping"]
340 useRawtimeForTracking = expert_config[
"useRawtimeForTracking"]
342 reduced_file_to_iov_physics = filter_by_max_events_per_run(file_to_iov_physics,
343 max_events_per_run, random_select=
True,
344 max_events_per_file=max_events_per_file)
345 good_input_files = list(reduced_file_to_iov_physics.keys())
347 b2.B2INFO(f
"Total number of files used as input = {len(good_input_files)}")
349 exps = [i.exp_low
for i
in reduced_file_to_iov_physics.values()]
350 runs = sorted([i.run_low
for i
in reduced_file_to_iov_physics.values()])
356 if not len(good_input_files):
357 print(
"No good input files found! Check that the input files have entries != 0!")
360 cog6_suffix =
"_CoG6"
361 cog3_suffix =
"_CoG3"
362 els3_suffix =
"_ELS3"
367 unique_id_cog6 = f
"SVDCoGTimeCalibrations_{calType}_{now.isoformat()}_INFO:_3rdOrderPol_TBindep_" \
368 f
"Exp{expNum}_runsFrom{firstRun}to{lastRun}"
369 print(f
"\nUniqueID_CoG6:\n{unique_id_cog6}")
371 unique_id_cog3 = f
"SVD3SampleCoGTimeCalibrations_{calType}_{now.isoformat()}_INFO:_3rdOrderPol_TBindep_" \
372 f
"Exp{expNum}_runsFrom{firstRun}to{lastRun}"
373 print(f
"\nUniqueID_CoG3:\n{unique_id_cog3}")
375 unique_id_els3 = f
"SVD3SampleELSTimeCalibrations_{calType}_{now.isoformat()}_INFO:_TBindep_" \
376 f
"Exp{expNum}_runsFrom{firstRun}to{lastRun}"
377 print(f
"\nUniqueID_ELS3:\n{unique_id_els3}")
379 requested_iov = kwargs.get(
"requested_iov",
None)
380 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
386 list_of_calibrations = []
392 cog6 = create_svd_clusterizer(
393 name=f
"ClusterReconstruction{cog6_suffix}",
394 clusters=f
"SVDClustersFromTracks{cog6_suffix}",
395 reco_digits=NEW_RECO_DIGITS_NAME,
396 shaper_digits=NEW_SHAPER_DIGITS_NAME,
397 time_algorithm=
"CoG6",
398 get_3sample_raw_time=
True)
400 cog3 = create_svd_clusterizer(
401 name=f
"ClusterReconstruction{cog3_suffix}",
402 clusters=f
"SVDClustersFromTracks{cog3_suffix}",
403 reco_digits=NEW_RECO_DIGITS_NAME,
404 shaper_digits=NEW_SHAPER_DIGITS_NAME,
405 time_algorithm=
"CoG3",
406 get_3sample_raw_time=
True)
408 els3 = create_svd_clusterizer(
409 name=f
"ClusterReconstruction{els3_suffix}",
410 clusters=f
"SVDClustersFromTracks{els3_suffix}",
411 reco_digits=NEW_RECO_DIGITS_NAME,
412 shaper_digits=NEW_SHAPER_DIGITS_NAME,
413 time_algorithm=
"ELS3",
414 get_3sample_raw_time=
True)
419 eventInfo =
"SVDEventInfo"
421 eventInfo =
"SVDEventInfoSim"
423 coll_cog6 = create_collector(
424 name=f
"SVDTimeCalibrationCollector{cog6_suffix}",
425 clusters=f
"SVDClustersFromTracks{cog6_suffix}",
426 event_info=eventInfo,
428 minRawTimeForIoV=rangeRawTimeForIoVCoG6[0],
429 maxRawTimeForIoV=rangeRawTimeForIoVCoG6[1])
431 algo_cog6 = create_algorithm(
433 prefix=coll_cog6.name(),
436 coll_cog3 = create_collector(
437 name=f
"SVDTimeCalibrationCollector{cog3_suffix}",
438 clusters=f
"SVDClustersFromTracks{cog3_suffix}",
439 event_info=eventInfo,
442 minRawTimeForIoV=rangeRawTimeForIoVCoG3[0],
443 maxRawTimeForIoV=rangeRawTimeForIoVCoG3[1])
445 algo_cog3 = create_algorithm(
447 prefix=coll_cog3.name(),
449 linearCutsOnCoG3=linearCutsOnCoG3,
450 interceptUpperLine=upperLineParameters[0],
451 angularCoefficientUpperLine=upperLineParameters[1],
452 interceptLowerLine=lowerLineParameters[0],
453 angularCoefficientLowerLine=lowerLineParameters[1])
455 coll_els3 = create_collector(
456 name=f
"SVDTimeCalibrationCollector{els3_suffix}",
457 clusters=f
"SVDClustersFromTracks{els3_suffix}",
458 event_info=eventInfo,
460 minRawTimeForIoV=rangeRawTimeForIoVELS3[0],
461 maxRawTimeForIoV=rangeRawTimeForIoVELS3[1])
463 algo_els3 = create_algorithm(
465 prefix=coll_els3.name(),
474 list_of_clusterizers = []
475 list_of_algorithms = []
476 for a
in timeAlgorithms:
478 list_of_clusterizers.append(cog3)
479 list_of_algorithms.append(algo_cog3)
481 list_of_clusterizers.append(cog6)
482 list_of_algorithms.append(algo_cog6)
484 list_of_clusterizers.append(els3)
485 list_of_algorithms.append(algo_els3)
487 pre_collector_path = create_pre_collector_path(
488 clusterizers=list_of_clusterizers,
489 isMC=isMC, max_events_per_run=max_events_per_run,
490 max_events_per_file=max_events_per_file,
491 useSVDGrouping=useSVDGrouping, useRawtimeForTracking=useRawtimeForTracking)
494 collector_managed_by_CAF = coll_els3
495 if "ELS3" in timeAlgorithms:
496 collector_managed_by_CAF = coll_els3
497 if "CoG6" in timeAlgorithms:
498 pre_collector_path.add_module(coll_cog6)
499 if "CoG3" in timeAlgorithms:
500 pre_collector_path.add_module(coll_cog3)
503 elif "CoG3" in timeAlgorithms:
504 collector_managed_by_CAF = coll_cog3
505 if "CoG6" in timeAlgorithms:
506 pre_collector_path.add_module(coll_cog6)
508 collector_managed_by_CAF = coll_cog6
511 calibration = Calibration(
"SVDTime",
512 collector=collector_managed_by_CAF,
513 algorithms=list_of_algorithms,
514 input_files=good_input_files,
515 pre_collector_path=pre_collector_path)
519 for algorithm
in calibration.algorithms:
520 algorithm.params = {
"iov_coverage": output_iov}
522 if "rawTimeCalibration" not in listOfMutedCalibrations:
523 list_of_calibrations.append(calibration)
529 SVDClustersOnTrackPrefix =
"SVDClustersOnTrack"
531 shift_clusterizers_onTracks = []
532 for alg
in timeAlgorithms:
533 cluster = create_svd_clusterizer(
534 name=f
"ClusterReconstruction_{alg}",
535 clusters=f
"{SVDClustersOnTrackPrefix}_{alg}",
536 shaper_digits=NEW_SHAPER_DIGITS_NAME,
538 shiftSVDClusterTime=
False)
539 shift_clusterizers_onTracks.append(cluster)
541 shift_pre_collector_path = create_pre_collector_path(
542 clusterizers=shift_clusterizers_onTracks,
543 isMC=isMC, max_events_per_run=max_events_per_run,
544 max_events_per_file=max_events_per_file,
545 useSVDGrouping=useSVDGrouping)
547 shift_collector = b2.register_module(
"SVDClusterTimeShifterCollector")
548 shift_collector.set_name(
"SVDClusterTimeShifterCollector")
549 shift_collector.param(
"MaxClusterSize", 6)
550 shift_collector.param(
"EventT0Name",
"EventT0")
551 shift_collector.param(
"SVDClustersOnTrackPrefix", f
"{SVDClustersOnTrackPrefix}")
552 shift_collector.param(
"TimeAlgorithms", timeAlgorithms)
554 shift_algo = SVDClusterTimeShifterAlgorithm(f
"{calType}_{now.isoformat()}_INFO:_"
555 f
"Exp{expNum}_runsFrom{firstRun}to{lastRun}")
556 shift_algo.setMinEntries(100)
557 shift_algo.setMaximumAllowedShift(15.)
558 shift_algo.setTimeAlgorithm(timeAlgorithms)
560 shift_calibration = Calibration(
"SVDClusterTimeShifter",
561 collector=shift_collector,
562 algorithms=shift_algo,
563 input_files=good_input_files,
564 pre_collector_path=shift_pre_collector_path)
568 for algorithm
in shift_calibration.algorithms:
569 algorithm.params = {
"apply_iov": output_iov}
571 if "timeShiftCalibration" not in listOfMutedCalibrations:
572 list_of_calibrations.append(shift_calibration)
578 SVDClustersOnTrackPrefix =
"SVDClustersOnTrack"
580 absolute_shift_clusterizers_onTracks = []
582 for alg
in timeAlgorithms:
583 cluster = create_svd_clusterizer(
584 name=f
"ClusterReconstruction_{alg}",
585 clusters=f
"{SVDClustersOnTrackPrefix}_{alg}",
586 shaper_digits=NEW_SHAPER_DIGITS_NAME,
588 absoluteShiftSVDClusterTime=
False,
590 absolute_shift_clusterizers_onTracks.append(cluster)
592 absolute_shift_pre_collector_path = create_pre_collector_path(
593 clusterizers=absolute_shift_clusterizers_onTracks,
594 isMC=isMC, max_events_per_run=max_events_per_run,
595 max_events_per_file=max_events_per_file,
596 useSVDGrouping=useSVDGrouping)
598 absolute_shift_collector = b2.register_module(
"SVDClusterAbsoluteTimeShifterCollector")
599 absolute_shift_collector.set_name(
"SVDClusterAbsoluteTimeShifterCollector")
600 absolute_shift_collector.param(
"EventT0Name",
"EventT0")
601 absolute_shift_collector.param(
"SVDClustersOnTrackPrefix", f
"{SVDClustersOnTrackPrefix}")
602 absolute_shift_collector.param(
"TimeAlgorithms", timeAlgorithms)
604 absolute_shift_algo = SVDClusterAbsoluteTimeShifterAlgorithm(f
"{calType}_{now.isoformat()}_INFO:_"
605 f
"Exp{expNum}_runsFrom{firstRun}to{lastRun}")
606 absolute_shift_algo.setMinEntries(100)
607 absolute_shift_algo.setMaximumAllowedShift(15.)
608 absolute_shift_algo.setTimeAlgorithm(timeAlgorithms)
609 print(f
'Time algorithms for absolute shift: {timeAlgorithms}')
610 absolute_shift_calibration = Calibration(
"SVDClusterAbsoluteTimeShift",
611 collector=absolute_shift_collector,
612 algorithms=absolute_shift_algo,
613 input_files=good_input_files,
614 pre_collector_path=absolute_shift_pre_collector_path)
618 for algorithm
in absolute_shift_calibration.algorithms:
619 algorithm.params = {
"apply_iov": output_iov}
620 if "AbsoluteTimeShiftCalibration" not in listOfMutedCalibrations:
621 list_of_calibrations.append(absolute_shift_calibration)
627 val_cog6 = create_svd_clusterizer(
628 name=f
"ClusterReconstruction{cog6_suffix}",
629 clusters=f
"SVDClusters{cog6_suffix}",
630 time_algorithm=
"CoG6")
632 val_cog6_onTracks = create_svd_clusterizer(
633 name=f
"ClusterReconstruction{cog6_suffix}_onTracks",
634 clusters=f
"SVDClusters{cog6_suffix}_onTracks",
635 reco_digits=NEW_RECO_DIGITS_NAME,
636 shaper_digits=NEW_SHAPER_DIGITS_NAME,
637 time_algorithm=
"CoG6")
639 val_cog3 = create_svd_clusterizer(
640 name=f
"ClusterReconstruction{cog3_suffix}",
641 clusters=f
"SVDClusters{cog3_suffix}",
642 time_algorithm=
"CoG3")
644 val_cog3_onTracks = create_svd_clusterizer(
645 name=f
"ClusterReconstruction{cog3_suffix}_onTracks",
646 clusters=f
"SVDClusters{cog3_suffix}_onTracks",
647 reco_digits=NEW_RECO_DIGITS_NAME,
648 shaper_digits=NEW_SHAPER_DIGITS_NAME,
649 time_algorithm=
"CoG3")
651 val_els3 = create_svd_clusterizer(
652 name=f
"ClusterReconstruction{els3_suffix}",
653 clusters=f
"SVDClusters{els3_suffix}",
654 time_algorithm=
"ELS3")
656 val_els3_onTracks = create_svd_clusterizer(
657 name=f
"ClusterReconstruction{els3_suffix}_onTracks",
658 clusters=f
"SVDClusters{els3_suffix}_onTracks",
659 reco_digits=NEW_RECO_DIGITS_NAME,
660 shaper_digits=NEW_SHAPER_DIGITS_NAME,
661 time_algorithm=
"ELS3")
663 val_coll_cog6 = create_validation_collector(
664 name=f
"SVDTimeValidationCollector{cog6_suffix}",
665 clusters=f
"SVDClusters{cog6_suffix}",
666 clusters_onTracks=f
"SVDClusters{cog6_suffix}_onTracks",
668 time_algorithm=
"CoG6")
670 val_algo_cog6 = create_validation_algorithm(
671 prefix=val_coll_cog6.name(),
674 val_coll_cog3 = create_validation_collector(
675 name=f
"SVDTimeValidationCollector{cog3_suffix}",
676 clusters=f
"SVDClusters{cog3_suffix}",
677 clusters_onTracks=f
"SVDClusters{cog3_suffix}_onTracks",
679 time_algorithm=
"CoG3")
681 val_algo_cog3 = create_validation_algorithm(
682 prefix=val_coll_cog3.name(),
685 val_coll_els3 = create_validation_collector(
686 name=f
"SVDTimeValidationCollector{els3_suffix}",
687 clusters=f
"SVDClusters{els3_suffix}",
688 clusters_onTracks=f
"SVDClusters{els3_suffix}_onTracks",
690 time_algorithm=
"ELS3")
692 val_algo_els3 = create_validation_algorithm(
693 prefix=val_coll_els3.name(),
696 list_of_val_clusterizers = []
697 list_of_val_algorithms = []
698 for a
in timeAlgorithms:
700 list_of_val_clusterizers.append(val_cog3)
701 list_of_val_clusterizers.append(val_cog3_onTracks)
702 list_of_val_algorithms.append(val_algo_cog3)
704 list_of_val_clusterizers.append(val_cog6)
705 list_of_val_clusterizers.append(val_cog6_onTracks)
706 list_of_val_algorithms.append(val_algo_cog6)
708 list_of_val_clusterizers.append(val_els3)
709 list_of_val_clusterizers.append(val_els3_onTracks)
710 list_of_val_algorithms.append(val_algo_els3)
712 val_pre_collector_path = create_pre_collector_path(
713 clusterizers=list_of_val_clusterizers,
714 isMC=isMC, max_events_per_run=max_events_per_run,
715 max_events_per_file=max_events_per_file,
716 useSVDGrouping=useSVDGrouping, useRawtimeForTracking=useRawtimeForTracking,
719 val_collector_managed_by_CAF = val_coll_els3
720 if "ELS3" in timeAlgorithms:
721 val_collector_managed_by_CAF = val_coll_els3
722 if "CoG6" in timeAlgorithms:
723 val_pre_collector_path.add_module(val_coll_cog6)
724 if "CoG3" in timeAlgorithms:
725 val_pre_collector_path.add_module(val_coll_cog3)
726 elif "CoG3" in timeAlgorithms:
727 val_collector_managed_by_CAF = val_coll_cog3
728 if "CoG6" in timeAlgorithms:
729 val_pre_collector_path.add_module(val_coll_cog6)
731 val_collector_managed_by_CAF = val_coll_cog6
733 val_calibration = Calibration(
"SVDTimeValidation",
734 collector=val_collector_managed_by_CAF,
735 algorithms=list_of_val_algorithms,
736 input_files=good_input_files,
737 pre_collector_path=val_pre_collector_path)
739 for algorithm
in val_calibration.algorithms:
740 algorithm.params = {
"iov_coverage": output_iov}
742 if "timeValidation" not in listOfMutedCalibrations:
743 list_of_calibrations.append(val_calibration)
745 print(f
'List of calib: {list_of_calibrations}')
746 for item
in range(len(list_of_calibrations) - 1):
748 print(f
'Item: {item}')
749 print(f
'calib item: {list_of_calibrations[item]}')
750 print(f
'name of calib item: {list_of_calibrations[item].name}')
752 print(f
'calibration name: {list_of_calibrations[item].name}')
753 if "AbsoluteTimeShiftCalibration" in list_of_calibrations[item].name:
754 if len(list_of_calibrations) > 1:
755 print(
" WARNING : AbsoluteTimeShiftCalibration should not depend on any other calibration.")
756 print(
"Not setting dependencies to or from other calibrations.")
759 elif "AbsoluteTimeShiftCalibration" in list_of_calibrations[item + 1].name:
761 if item + 1 < len(list_of_calibrations) - 1:
763 list_of_calibrations[item + 2].depends_on(list_of_calibrations[item])
766 list_of_calibrations[item + 1].depends_on(list_of_calibrations[item])
768 return list_of_calibrations