ATLAS Offline Software
Loading...
Searching...
No Matches
ActsClusterizationInDetConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5from AthenaConfiguration.Enums import BeamType
6from ActsConfig.ActsUtilities import extractChildKwargs
7
8from ActsConfig.ActsClusterizationConfig import ActsClusterCacheCreatorAlgCfg
10 name: str = "ActsIDPixelClusteringTool",
11 **kwargs) -> ComponentAccumulator:
12 acc = ComponentAccumulator()
13
14 kwargs.setdefault("isITk", False)
15
16 from PixelConditionsAlgorithms.PixelConditionsConfig import PixelChargeCalibCondCfg, PixelOfflineCalibCondAlgCfg
17 acc.merge(PixelChargeCalibCondCfg(flags))
18 acc.merge(PixelOfflineCalibCondAlgCfg(flags))
19 kwargs.setdefault("PixelChargeCalibCondData", "PixelChargeCalibCondData")
20
21 if "PixelLorentzAngleTool" not in kwargs:
22 from SiLorentzAngleTool.PixelLorentzAngleConfig import PixelLorentzAngleToolCfg
23 kwargs.setdefault("PixelLorentzAngleTool", acc.popToolsAndMerge( PixelLorentzAngleToolCfg(flags) ))
24
25 kwargs.setdefault("CheckGanged", True)
26 kwargs.setdefault('UseWeightedPosition',False) # not (flags.Tracking.doPixelDigitalClustering or flags.Beam.Type is BeamType.Cosmics)
27 kwargs.setdefault('UseBroadErrors', flags.Beam.Type is BeamType.Cosmics)
28
29 acc.setPrivateTools(CompFactory.ActsTrk.PixelClusteringTool(name, **kwargs))
30 return acc
31
33 name: str = "ActsIDStripClusteringTool",
34 **kwargs) -> ComponentAccumulator:
35 acc = ComponentAccumulator()
36
37 kwargs.setdefault("isITk", False)
38
39 if 'LorentzAngleTool' not in kwargs:
40 from SiLorentzAngleTool.SCT_LorentzAngleConfig import SCT_LorentzAngleToolCfg
41 kwargs.setdefault("LorentzAngleTool", acc.popToolsAndMerge(SCT_LorentzAngleToolCfg(flags)))
42
43 if "conditionsTool" not in kwargs:
44 from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_ConditionsSummaryToolCfg
45 kwargs.setdefault("conditionsTool", acc.popToolsAndMerge(
46 SCT_ConditionsSummaryToolCfg(flags, withFlaggedCondTool=False)))
47
48 if "StripDetElStatus" not in kwargs :
49 from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConfig import (
50 SCT_DetectorElementStatusAlgWithoutFlaggedCfg)
51 acc.merge(SCT_DetectorElementStatusAlgWithoutFlaggedCfg(flags))
52 kwargs.setdefault("StripDetElStatus", "SCTDetectorElementStatusWithoutFlagged")
53
54 # Disable noisy modules suppression
55 kwargs.setdefault("maxFiredStrips", 384)
56
57 if flags.InDet.selectSCTIntimeHits:
58 coll_25ns = (flags.Beam.BunchSpacing <= 25 and
59 flags.Beam.Type is BeamType.Collisions)
60 kwargs.setdefault("timeBins", "01X" if coll_25ns else "X1X")
61
62 kwargs.setdefault("StripDetEleCollKey", "SCT_DetectorElementCollection")
63
64 acc.setPrivateTools(CompFactory.ActsTrk.StripClusteringTool(name, **kwargs))
65 return acc
66
68 name: str = 'ActsIDPixelClusterizationAlg',
69 *,
70 useCache: bool = False,
71 **kwargs) -> ComponentAccumulator:
72 acc = ComponentAccumulator()
73
74 kwargs.setdefault("IDHelper", "PixelID")
75 kwargs.setdefault("RDOContainerKey", "PixelRDOs")
76 kwargs.setdefault("ClustersKey", "PixelClusters")
77 kwargs.setdefault("DetEleCollKey", "PixelDetectorElementCollection")
78 # Regional selection
79 kwargs.setdefault('RoIs', 'ActsRegionOfInterest')
80
81 kwargs.setdefault('ClusterCacheBackend', 'ActsPixelClusterCache_Back')
82 kwargs.setdefault('ClusterCache', 'ActsPixelClustersCache')
83
84 if 'RegSelTool' not in kwargs:
85 from RegionSelector.RegSelToolConfig import regSelTool_Pixel_Cfg
86 kwargs.setdefault('RegSelTool', acc.popToolsAndMerge(regSelTool_Pixel_Cfg(flags)))
87
88 if 'ClusteringTool' not in kwargs:
89 kwargs.setdefault("ClusteringTool", acc.popToolsAndMerge(ActsIDPixelClusteringToolCfg(flags)))
90
91 if 'DetElStatus' not in kwargs:
92 from PixelConditionsAlgorithms.PixelConditionsConfig import PixelDetectorElementStatusAlgCfg
93 acc.merge(PixelDetectorElementStatusAlgCfg(flags))
94 kwargs.setdefault('DetElStatus', 'PixelDetectorElementStatus')
95
96 if not useCache:
97 acc.addEventAlgo(CompFactory.ActsTrk.PixelClusterizationAlg(name, **kwargs))
98 else:
99 acc.addEventAlgo(CompFactory.ActsTrk.PixelCacheClusterizationAlg(name, **kwargs))
100 return acc
101
103 name: str = 'ActsIDStripClusterizationAlg',
104 useCache: bool = False,
105 **kwargs) -> ComponentAccumulator:
106 acc = ComponentAccumulator()
107
108 kwargs.setdefault("RDOContainerKey", "SCT_RDOs")
109 kwargs.setdefault("ClustersKey", "SCT_Clusters")
110 kwargs.setdefault("IDHelper", "SCT_ID")
111 kwargs.setdefault("DetEleCollKey", "SCT_DetectorElementCollection")
112 # Regional selection
113 kwargs.setdefault('RoIs', 'ActsRegionOfInterest')
114
115 kwargs.setdefault('ClusterCacheBackend', 'ActsStripClusterCache_Back')
116 kwargs.setdefault('ClusterCache', 'ActsStripClustersCache')
117
118 if 'RegSelTool' not in kwargs:
119 from RegionSelector.RegSelToolConfig import regSelTool_SCT_Cfg
120 kwargs.setdefault('RegSelTool', acc.popToolsAndMerge(regSelTool_SCT_Cfg(flags)))
121
122 if 'DetElStatus' not in kwargs :
123 from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConfig import SCT_DetectorElementStatusAlgWithoutFlaggedCfg
124 acc.merge(SCT_DetectorElementStatusAlgWithoutFlaggedCfg(flags))
125 kwargs.setdefault("DetElStatus", "SCTDetectorElementStatusWithoutFlagged")
126
127 if 'ClusteringTool' not in kwargs:
128 kwargs.setdefault("ClusteringTool", acc.popToolsAndMerge(ActsIDStripClusteringToolCfg(flags)))
129
130 if not useCache:
131 acc.addEventAlgo(CompFactory.ActsTrk.StripClusterizationAlg(name, **kwargs))
132 else:
133 acc.addEventAlgo(CompFactory.ActsTrk.StripCacheClusterizationAlg(name, **kwargs))
134 return acc
135
137 name: str = "ActsIDPixelClusterPreparationAlg",
138 useCache: bool = False,
139 **kwargs) -> ComponentAccumulator:
140 acc = ComponentAccumulator()
141
142 kwargs.setdefault('InputCollection', 'PixelClusters')
143 kwargs.setdefault('DetectorElements', 'PixelDetectorElementCollection')
144
145 if 'RegSelTool' not in kwargs:
146 from RegionSelector.RegSelToolConfig import regSelTool_Pixel_Cfg
147 kwargs.setdefault('RegSelTool', acc.popToolsAndMerge(regSelTool_Pixel_Cfg(flags)))
148
149 if not useCache:
150 acc.addEventAlgo(CompFactory.ActsTrk.PixelClusterDataPreparationAlg(name, **kwargs))
151 else:
152 acc.addEventAlgo(CompFactory.ActsTrk.PixelClusterCacheDataPreparationAlg(name, **kwargs))
153 return acc
154
156 name: str = "ActsIDStripClusterPreparationAlg",
157 useCache: bool = False,
158 **kwargs) -> ComponentAccumulator:
159 acc = ComponentAccumulator()
160
161 kwargs.setdefault('InputCollection', 'SCT_Clusters')
162 kwargs.setdefault('DetectorElements', 'SCT_DetectorElementCollection')
163
164 if 'RegSelTool' not in kwargs:
165 from RegionSelector.RegSelToolConfig import regSelTool_SCT_Cfg
166 kwargs.setdefault('RegSelTool', acc.popToolsAndMerge(regSelTool_SCT_Cfg(flags)))
167
168 if not useCache:
169 acc.addEventAlgo(CompFactory.ActsTrk.StripClusterDataPreparationAlg(name, **kwargs))
170 else:
171 acc.addEventAlgo(CompFactory.ActsTrk.StripClusterCacheDataPreparationAlg(name, **kwargs))
172 return acc
173
175 *,
176 RoIs: str = "ActsRegionOfInterest",
177 **kwargs: dict) -> ComponentAccumulator:
178 assert isinstance(RoIs, str)
179 assert isinstance(kwargs, dict)
180
181 acc = ComponentAccumulator()
182
183 # Clusterization is a three step process at maximum:
184 # (1) Cache Creation
185 # (2) Clusterization algorithm (reconstruction of clusters)
186 # (3) Preparation of collection for downstream algorithms
187 # What step is scheduled depends on the tracking pass and the activation
188 # or de-activation of caching mechanism
189
190 kwargs.setdefault('processPixels', flags.Detector.EnablePixel)
191 kwargs.setdefault('processStrips', flags.Detector.EnableSCT)
192 kwargs.setdefault('runCacheCreation', flags.Acts.useCache)
193 kwargs.setdefault('runReconstruction', True)
194 kwargs.setdefault('runPreparation', flags.Acts.useCache)
195
196 # Step (1)
197 if kwargs['runCacheCreation']:
198 acc.merge(ActsClusterCacheCreatorAlgCfg(flags,
199 **extractChildKwargs(prefix='ClusterCacheCreatorAlg.', **kwargs)))
200
201 # Step (2)
202 if kwargs['runReconstruction']:
203 if kwargs['processPixels']:
204 acc.merge(ActsIDPixelClusterizationAlgCfg(flags,
205 RoIs=RoIs,
206 **extractChildKwargs(prefix='PixelClusterizationAlg.', **kwargs)))
207 if kwargs['processStrips']:
208 acc.merge(ActsIDStripClusterizationAlgCfg(flags,
209 RoIs=RoIs,
210 **extractChildKwargs(prefix='StripClusterizationAlg.', **kwargs)))
211
212 # Step (3)
213 if kwargs['runPreparation']:
214 if kwargs['processPixels']:
216 RoIs=RoIs,
217 **extractChildKwargs(prefix='PixelClusterPreparationAlg.', **kwargs)))
218
219 if kwargs['processStrips']:
221 RoIs=RoIs,
222 **extractChildKwargs(prefix='StripClusterPreparationAlg.', **kwargs)))
223
224 return acc
225
227 *,
228 previousActsExtension: str = None) -> ComponentAccumulator:
229 assert previousActsExtension is None or isinstance(previousActsExtension, str)
230
231 acc = ComponentAccumulator()
232
233 processPixels = flags.Detector.EnablePixel
234 processStrips = flags.Detector.EnableSCT
235
236 kwargs = dict()
237 kwargs.setdefault('processPixels', processPixels)
238 kwargs.setdefault('processStrips', processStrips)
239
240 # Clusterization is a three step process at maximum:
241 # (1) Cache Creation
242 # (2) Clusterization algorithm (reconstruction of clusters)
243 # (3) Preparation of collection for downstream algorithms
244 # What step is scheduled depends on the tracking pass and the activation
245 # or de-activation of caching mechanism.
246
247 # Secondary passes do not need cache creation, that has to be performed
248 # on the primary pass, and only if the caching is enabled.
249 # Reconstruction can run on secondary passes only if the caching is enabled,
250 # this is because we may need to process detector elements not processed
251 # on the primary pass.
252 # Preparation has to be performed on secondary passes always, and on primary
253 # pass only if cache is enabled. In the latter case it is useed to collect all
254 # the clusters from all views before passing them to the downstream algorithms
255
256
257 # Only Primary pass for the Inner Detector now
258 kwargs.setdefault('runCacheCreation', flags.Acts.useCache)
259 kwargs.setdefault('runReconstruction', True)
260 kwargs.setdefault('runPreparation', flags.Acts.useCache)
261
262 # Name of the RoI to be used
263 roisName = f'{flags.Tracking.ActiveConfig.extension}RegionOfInterest'
264 # Large Radius Tracking uses full scan RoI created in the primary pass
265 if flags.Tracking.ActiveConfig.extension == 'ActsLargeRadius':
266 roisName = 'ActsRegionOfInterest'
267
268 # Name of the Cluster container -> ITk + extension without "Acts" + Pixel or Strip + Clusters
269 # We also define the same collection from the main ACTS pass (primary)
270 primaryPixelClustersName = 'PixelClusters'
271 primaryStripClustersName = 'SCT_Clusters'
272 pixelClustersName = primaryPixelClustersName
273 stripClustersName = primaryStripClustersName
274
275 # Configuration for (1)
276 if kwargs['runCacheCreation']:
277 kwargs.setdefault('ClusterCacheCreatorAlg.name', f'{flags.Tracking.ActiveConfig.extension}ClusterCacheCreatorAlg')
278
279 # Configuration for (2)
280 if kwargs['runReconstruction']:
281 if kwargs['processPixels']:
282 kwargs.setdefault('PixelClusterizationAlg.name', f'{flags.Tracking.ActiveConfig.extension}PixelClusterizationAlg')
283 kwargs.setdefault('PixelClusterizationAlg.useCache', flags.Acts.useCache)
284 kwargs.setdefault('PixelClusterizationAlg.ClustersKey', pixelClustersName)
285 kwargs.setdefault('PixelClusterizationAlg.ClusterCache', f'{flags.Tracking.ActiveConfig.extension}PixelClustersCache')
286
287 if kwargs['processStrips']:
288 kwargs.setdefault('StripClusterizationAlg.name', f'{flags.Tracking.ActiveConfig.extension}StripClusterizationAlg')
289 kwargs.setdefault('StripClusterizationAlg.useCache', flags.Acts.useCache)
290 kwargs.setdefault('StripClusterizationAlg.ClustersKey', stripClustersName)
291 kwargs.setdefault('StripClusterizationAlg.ClusterCache', f'{flags.Tracking.ActiveConfig.extension}StripClustersCache')
292
293 # Configuration for (3)
294 if kwargs['runPreparation']:
295 if kwargs['processPixels']:
296 kwargs.setdefault('PixelClusterPreparationAlg.name', f'{flags.Tracking.ActiveConfig.extension}PixelClusterPreparationAlg')
297 kwargs.setdefault('PixelClusterPreparationAlg.useCache', flags.Acts.useCache)
298 kwargs.setdefault('PixelClusterPreparationAlg.OutputCollection', f'{pixelClustersName}_Cached' if kwargs['runReconstruction'] else pixelClustersName)
299 # The input is one between the collection (w/o cache) and the IDC (w/ cache)
300 if not flags.Acts.useCache:
301 # Take the collection from the reconstruction step. If not available take the collection from the primary pass
302 kwargs.setdefault('PixelClusterPreparationAlg.InputCollection', pixelClustersName if kwargs['runReconstruction'] else primaryPixelClustersName)
303 kwargs.setdefault('PixelClusterPreparationAlg.InputIDC', '')
304 else:
305 kwargs.setdefault('PixelClusterPreparationAlg.InputCollection', '')
306 kwargs.setdefault('PixelClusterPreparationAlg.InputIDC', f'{flags.Tracking.ActiveConfig.extension}PixelClustersCache')
307
308 if kwargs['processStrips']:
309 kwargs.setdefault('StripClusterPreparationAlg.name', f'{flags.Tracking.ActiveConfig.extension}StripClusterPreparationAlg')
310 kwargs.setdefault('StripClusterPreparationAlg.useCache', flags.Acts.useCache)
311 kwargs.setdefault('StripClusterPreparationAlg.OutputCollection', f'{stripClustersName}_Cached' if kwargs['runReconstruction'] else stripClustersName)
312 if not flags.Acts.useCache:
313 kwargs.setdefault('StripClusterPreparationAlg.InputCollection', stripClustersName if kwargs['runReconstruction'] else primaryStripClustersName)
314 kwargs.setdefault('StripClusterPreparationAlg.InputIDC', '')
315 else:
316 kwargs.setdefault('StripClusterPreparationAlg.InputCollection', '')
317 kwargs.setdefault('StripClusterPreparationAlg.InputIDC', f'{flags.Tracking.ActiveConfig.extension}StripClustersCache')
318
319 acc.merge(ActsIDMainClusterizationCfg(flags, RoIs=roisName, **kwargs))
320 return acc
ComponentAccumulator ActsIDPixelClusterPreparationAlgCfg(flags, str name="ActsIDPixelClusterPreparationAlg", bool useCache=False, **kwargs)
ComponentAccumulator ActsIDMainClusterizationCfg(flags, *, str RoIs="ActsRegionOfInterest", **dict kwargs)
ComponentAccumulator ActsIDPixelClusteringToolCfg(flags, str name="ActsIDPixelClusteringTool", **kwargs)
ComponentAccumulator ActsIDStripClusterPreparationAlgCfg(flags, str name="ActsIDStripClusterPreparationAlg", bool useCache=False, **kwargs)
ComponentAccumulator ActsIDPixelClusterizationAlgCfg(flags, str name='ActsIDPixelClusterizationAlg', *, bool useCache=False, **kwargs)
ComponentAccumulator ActsIDStripClusteringToolCfg(flags, str name="ActsIDStripClusteringTool", **kwargs)
ComponentAccumulator ActsIDClusterizationCfg(flags, *, str previousActsExtension=None)
ComponentAccumulator ActsIDStripClusterizationAlgCfg(flags, str name='ActsIDStripClusterizationAlg', bool useCache=False, **kwargs)