14 mlog = logging.getLogger(name)
15 mlog.info(
"Starting InDetTrackParticle Cluster Thinning configuration")
18 kwargs.setdefault(
"StreamName",
"StreamAOD")
20 if not flags.Detector.EnablePixel:
21 kwargs.setdefault(
"InDetTrackStatesPixKey",
"")
22 kwargs.setdefault(
"InDetTrackMeasurementsPixKey",
"")
23 if not flags.Detector.EnableSCT:
24 kwargs.setdefault(
"InDetTrackStatesSctKey",
"")
25 kwargs.setdefault(
"InDetTrackMeasurementsSctKey",
"")
26 if not flags.Detector.EnableTRT:
27 kwargs.setdefault(
"InDetTrackStatesTrtKey",
"")
28 kwargs.setdefault(
"InDetTrackMeasurementsTrtKey",
"")
30 if not flags.Tracking.thinPixelClustersOnTrack:
31 kwargs.setdefault(
"ThinPixelHitsOnTrack",
False)
32 if not flags.Tracking.thinSCTClustersOnTrack:
33 kwargs.setdefault(
"ThinSCTHitsOnTrack",
False)
34 if not flags.Tracking.thinTRTClustersOnTrack:
35 kwargs.setdefault(
"ThinTRTHitsOnTrack",
False)
37 kwargs.setdefault(
"InDetTrackParticlesKey",
"InDetTrackParticles")
38 kwargs.setdefault(
"SelectionString",
"InDetTrackParticles.pt>10*GeV")
44 if flags.Tracking.thinPixelClustersOnTrack
and not flags.Tracking.writeExtendedSi_PRDInfo:
45 msg =
"Requested to thin pixel hits on track, but flags.Tracking.writeExtendedSi_PRDInfo is set to false, so the relevant containers will not be written to the AOD. Cannot add ThinInDetClustersAlg."
47 raise RuntimeError( msg )
49 if flags.Tracking.thinSCTClustersOnTrack
and not flags.Tracking.writeExtendedSi_PRDInfo:
50 msg =
"Requested to thin SCT hits on track, but flags.Tracking.writeExtendedSi_PRDInfo is set to false, so the relevant containers will not be written to the AOD. Cannot add ThinInDetClustersAlg."
52 raise RuntimeError( msg )
54 if flags.Tracking.thinTRTClustersOnTrack
and not flags.Tracking.writeExtendedTRT_PRDInfo:
55 msg =
"Requested to thin TRT hits on track, but flags.Tracking.writeExtendedTRT_PRDInfo is set to false, so the relevant containers will not be written to the AOD. Cannot add ThinInDetClustersAlg."
57 raise RuntimeError( msg )
59 nTrackContainers = len(flags.Tracking.thinInDetClustersTrackContainers)
60 nSelectionStrings = len(flags.Tracking.thinInDetClustersSelectionStrings)
61 nPixelMSOSContainers = len(flags.Tracking.thinInDetClustersPixelMSOSContainers)
62 nSCTMSOSContainers = len(flags.Tracking.thinInDetClustersSCTMSOSContainers)
63 nTRTMSOSContainers = len(flags.Tracking.thinInDetClustersTRTMSOSContainers)
65 if not nTrackContainers == nSelectionStrings:
66 msg = f
"Number of selection strings ({nSelectionStrings}) does not match number of track containers ({nTrackContainers}). Cannot add ThinInDetClustersAlg."
68 raise RuntimeError( msg )
70 if flags.Tracking.thinPixelClustersOnTrack:
71 if not nTrackContainers == nPixelMSOSContainers:
72 msg = f
"Number of pixel MSOS containers ({nPixelMSOSContainers}) does not match number of track containers ({nTrackContainers}). Cannot add ThinInDetClustersAlg."
74 raise RuntimeError( msg )
76 if flags.Tracking.thinSCTClustersOnTrack:
77 if not nTrackContainers == nSCTMSOSContainers:
78 msg = f
"Number of SCT MSOS containers ({nSCTMSOSContainers}) does not match number of track containers ({nTrackContainers}). Cannot add ThinInDetClustersAlg."
80 raise RuntimeError( msg )
82 if flags.Tracking.thinTRTClustersOnTrack:
83 if not nTrackContainers == nTRTMSOSContainers:
84 msg = f
"Number of TRT MSOS containers ({nTRTMSOSContainers}) does not match number of track containers ({nTrackContainers}). Cannot add ThinInDetClustersAlg."
86 raise RuntimeError( msg )
88 for idx,trackContainer
in enumerate(flags.Tracking.thinInDetClustersTrackContainers):
89 selectionString = flags.Tracking.thinInDetClustersSelectionStrings[idx]
90 if trackContainer
not in selectionString:
91 mlog.warning(f
"Track container {trackContainer} is not used in the associated selection string: {selectionString}.")
97 for idx,trackContainer
in enumerate(flags.Tracking.thinInDetClustersTrackContainers):
98 kwargs[
"InDetTrackParticlesKey"]= trackContainer
99 kwargs[
"SelectionString"] = flags.Tracking.thinInDetClustersSelectionStrings[idx]
105 if flags.Tracking.thinPixelClustersOnTrack:
106 kwargs[
"ThinPixelHitsOnTrack"] =
True
107 kwargs[
"InDetTrackStatesPixKey"] = flags.Tracking.thinInDetClustersPixelMSOSContainers[idx]
108 kwargs[
"InDetTrackMeasurementsPixKey"] =
"PixelClusters"
109 if flags.Tracking.thinSCTClustersOnTrack:
110 kwargs[
"ThinSCTHitsOnTrack"] =
True
111 kwargs[
"InDetTrackStatesSctKey"] = flags.Tracking.thinInDetClustersSCTMSOSContainers[idx]
112 kwargs[
"InDetTrackMeasurementsSctKey"] =
"SCT_Clusters"
113 if flags.Tracking.thinTRTClustersOnTrack:
114 kwargs[
"ThinTRTHitsOnTrack"] =
True
115 kwargs[
"InDetTrackStatesTrtKey"] = flags.Tracking.thinInDetClustersTRTMSOSContainers[idx]
116 kwargs[
"InDetTrackMeasurementsTrtKey"] =
"TRT_DriftCircles"
118 acc.addEventAlgo(CompFactory.ThinInDetClustersAlg(name+
"_"+trackContainer, **kwargs))