ATLAS Offline Software
Loading...
Searching...
No Matches
ITkTrackRecoConfig.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.Enums import Format
5from TrkConfig.TrackingPassFlags import printActiveConfig
6from AthenaCommon.Constants import WARNING, INFO
7
8_flags_set = [] # For caching
9_extensions_list = [] # For caching, possible legacy / validate Passes/Configurations
10_actsExtensions = ['Acts', 'ActsLegacy', 'ActsConversion', 'ActsLargeRadius', 'ActsLowPt', 'ActsValidateF100', 'ActsValidateF150', 'ActsValidateLargeRadiusStandalone'] # Possible Acts Alone Passes/Configurations
11_outputExtensions = [] # Passes/Configurations to be passed to the output job option
12
14 global _flags_set
15 if _flags_set:
16 return _flags_set
17
18 flags_set = []
19
20 # Primary Pass(es)
21 from TrkConfig.TrkConfigFlags import TrackingComponent
22 validation_configurations = {
23 TrackingComponent.ActsValidateClusters : "ActsValidateClusters",
24 TrackingComponent.ActsValidateLargeRadiusStandalone: "ActsValidateLargeRadiusStandalone",
25 TrackingComponent.ActsValidateTracks : "ActsValidateTracks",
26 TrackingComponent.ActsValidateAmbiguityResolution : "ActsValidateAmbiguityResolution",
27 TrackingComponent.ActsValidateF100 : "ActsValidateF100",
28 TrackingComponent.ActsValidateF150 : "ActsValidateF150",
29 }
30
31 # Athena Pass
32 if TrackingComponent.AthenaChain in flags.Tracking.recoChain:
33 flags_set += [flags.cloneAndReplace(
34 "Tracking.ActiveConfig",
35 f"Tracking.{flags.Tracking.ITkPrimaryPassConfig.value}Pass")]
36
37 # Acts Pass - Legacy like
38 if TrackingComponent.ActsLegacyChain in flags.Tracking.recoChain:
39 flags_set += [flags.cloneAndReplace(
40 "Tracking.ActiveConfig",
41 "Tracking.ITkActsLegacyPass")]
42
43 # Acts Pass - Fast Tracking based
44 if TrackingComponent.ActsChain in flags.Tracking.recoChain:
45 flags_set += [flags.cloneAndReplace(
46 "Tracking.ActiveConfig",
47 "Tracking.ITkActsPass")]
48
49 # Acts Heavy Ion Pass
50 if TrackingComponent.ActsHeavyIon in flags.Tracking.recoChain:
51 flags_set += [flags.cloneAndReplace(
52 "Tracking.ActiveConfig",
53 "Tracking.ITkActsHeavyIonPass")]
54
55 # GNN pass
56 if TrackingComponent.GNNChain in flags.Tracking.recoChain:
57 flags_set += [flags.cloneAndReplace(
58 "Tracking.ActiveConfig",
59 "Tracking.ITkGNNPass")]
60
61 # Acts Conversion Pass
62 if flags.Detector.EnableCalo and flags.Acts.doITkConversion:
63 flags_set += [flags.cloneAndReplace(
64 "Tracking.ActiveConfig",
65 "Tracking.ITkActsConversionPass")]
66
67 # Acts Large Radius Pass
68 if flags.Acts.doLargeRadius:
69 flags_set += [flags.cloneAndReplace(
70 "Tracking.ActiveConfig",
71 "Tracking.ITkActsLargeRadiusPass")]
72
73 # Acts Low Pt Pass
74 if flags.Acts.doLowPt:
75 flags_set += [flags.cloneAndReplace(
76 "Tracking.ActiveConfig",
77 "Tracking.ITkActsLowPtPass")]
78
79 # Acts Validation Passes
80 for [configuration, key] in validation_configurations.items():
81 if configuration in flags.Tracking.recoChain:
82 toAdd = eval(f"flags.cloneAndReplace('Tracking.ActiveConfig', 'Tracking.ITk{key}Pass')")
83 flags_set += [toAdd]
84
85 # Photon conversion tracking reco
86 if flags.Detector.EnableCalo and flags.Tracking.doITkConversion:
87 flagsConv = flags.cloneAndReplace("Tracking.ActiveConfig",
88 "Tracking.ITkConversionPass")
89 flags_set += [flagsConv]
90
91 # LRT
92 if flags.Tracking.doLargeD0:
93 if flags.Tracking.useITkFTF:
94 flagsLRT = flags.cloneAndReplace("Tracking.ActiveConfig",
95 "Tracking.ITkFTFLargeD0Pass")
96 elif flags.Tracking.doITkFastTracking:
97 flagsLRT = flags.cloneAndReplace("Tracking.ActiveConfig",
98 "Tracking.ITkLargeD0FastPass")
99 else:
100 flagsLRT = flags.cloneAndReplace("Tracking.ActiveConfig",
101 "Tracking.ITkLargeD0Pass")
102 flags_set += [flagsLRT]
103
104
105 if TrackingComponent.FPGAChain in flags.Tracking.recoChain:
106 flags_set += [flags.cloneAndReplace(
107 "Tracking.ActiveConfig",
108 "Tracking.ITkFPGAPass")]
109
110 # LowPt
111 if flags.Tracking.doLowPt:
112 flagsLowPt = flags.cloneAndReplace("Tracking.ActiveConfig",
113 "Tracking.ITkLowPtPass")
114 flags_set += [flagsLowPt]
115
116 _flags_set = flags_set # Put into cache
117
118 return flags_set
119
120
122 flags_set = CombinedTrackingPassFlagSets(flags)
123 extension = flags_set[-1].Tracking.ActiveConfig.extension
124 ClusterSplitProbContainer = "ITkAmbiguityProcessorSplitProb" + extension
125 return ClusterSplitProbContainer
126
127
129 TrackContainer: str ="",
130 ClusterSplitProbContainer: str = "") -> ComponentAccumulator:
131 result = ComponentAccumulator()
132 extension = flags.Tracking.ActiveConfig.extension
133 doTrackOverlay = flags.TrackOverlay.isTrackOverlaySeq
134 if doTrackOverlay:
135 # schedule merger to combine signal and background tracks
136 InputTracks = [flags.Overlay.SigPrefix+TrackContainer,
137 flags.Overlay.BkgPrefix+TrackContainer]
138 AssociationMapName = ("PRDtoTrackMapMerge_Resolved" +
139 extension + "Tracks")
140 MergerOutputTracks = TrackContainer
141
142 from TrkConfig.TrkTrackCollectionMergerConfig import TrackCollectionMergerAlgCfg
143 result.merge(TrackCollectionMergerAlgCfg(
144 flags,
145 name="TrackCollectionMergerAlgCfg"+extension,
146 InputCombinedTracks=InputTracks,
147 OutputCombinedTracks=MergerOutputTracks,
148 AssociationMapName=AssociationMapName))
149
150 # Run truth, but only do this for non ACTS workflows
151 if flags.Tracking.doTruth and extension not in _actsExtensions:
152 from InDetConfig.ITkTrackTruthConfig import ITkTrackTruthCfg
153 result.merge(ITkTrackTruthCfg(
154 flags,
155 Tracks=TrackContainer,
156 DetailedTruth=TrackContainer+"DetailedTruth",
157 TracksTruth=TrackContainer+"TruthCollection"))
158
159 # Create track particles from all the different track collections
160 # We have different algorithms depending on the EDM being used
161 if extension not in _actsExtensions:
162 # Workflows that use Trk Tracks
163 from xAODTrackingCnv.xAODTrackingCnvConfig import ITkTrackParticleCnvAlgCfg
164 result.merge(ITkTrackParticleCnvAlgCfg(
165 flags,
166 name=extension + "TrackParticleCnvAlg",
167 TrackContainerName=TrackContainer,
168 xAODTrackParticlesFromTracksContainerName=(
169 "InDet" + extension + "TrackParticles"),
170 ClusterSplitProbabilityName=(
171 "" if flags.Tracking.doITkFastTracking else
172 ClusterSplitProbContainer),
173 AssociationMapName=""))
174 else:
175 # Workflows that use Acts Tracks
176 from ActsConfig.ActsTrackFindingConfig import ActsTrackToTrackParticleCnvAlgCfg
177 # The following few lines will disappear once we have imposed a proper nomenclature for our algorithms and collection
178 prefix = flags.Tracking.ActiveConfig.extension
179 result.merge(ActsTrackToTrackParticleCnvAlgCfg(flags, f"{prefix}ResolvedTrackToAltTrackParticleCnvAlg",
180 ACTSTracksLocation=[TrackContainer],
181 TrackParticlesOutKey=f'InDet{prefix}TrackParticles'))
182
183 if flags.Tracking.doTruth :
184 from ActsConfig.ActsTruthConfig import ActsTrackParticleTruthDecorationAlgCfg
185 result.merge(ActsTrackParticleTruthDecorationAlgCfg(flags,
186 name=f'{TrackContainer}ParticleTruthDecorationAlg',
187 TrackToTruthAssociationMaps = [f'{TrackContainer}ToTruthParticleAssociation'],
188 TrackParticleContainerName = f'InDet{prefix}TrackParticles'
189 ))
190 return result
191
192
193# Returns CA + ClusterSplitProbContainer
195 previousActsExtension: str = None,
196 InputCombinedITkTracks: list[str] = None,
197 InputCombinedActsTracks: list[str] = None,
198 InputExtendedITkTracks: list[str] = None,
199 StatTrackCollections: list[str] = None,
200 StatTrackTruthCollections: list[str] = None,
201 ClusterSplitProbContainer: str = ""):
202 # We use these lists to store the collections from all the tracking passes, thus keeping the history
203 # of previous passes. None of these lists is allowed to be a None
204 assert InputCombinedITkTracks is not None and isinstance(InputCombinedITkTracks, list)
205 assert InputCombinedActsTracks is not None and isinstance(InputCombinedActsTracks, list)
206 assert InputExtendedITkTracks is not None and isinstance(InputExtendedITkTracks, list)
207 assert StatTrackCollections is not None and isinstance(StatTrackCollections, list)
208 assert StatTrackTruthCollections is not None and isinstance(StatTrackTruthCollections ,list)
209
210 # Get the tracking pass extension name
211 extension = flags.Tracking.ActiveConfig.extension
212
213 result = ComponentAccumulator()
214 # Define collection name(s)
215 # This is the track collection AFTER the ambiguity resolution
216 doTrackOverlay = flags.TrackOverlay.isTrackOverlaySeq
217 TrackContainer = "Resolved" + extension + "Tracks"
218 # For Acts we have another convention, with the extention as the first element in the name
219 if extension in _actsExtensions:
220 TrackContainer = extension + "ResolvedTracks" if flags.Acts.doAmbiguityResolution else extension + "Tracks"
221 if doTrackOverlay and extension == "Conversion":
222 TrackContainer = flags.Overlay.SigPrefix + TrackContainer
223
224 # This is the track collection BEFORE the ambiguity resolution
225 SiSPSeededTracks = "SiSPSeeded" + extension + "Tracks"
226 # For ACTS the name is totally different
227 if extension in _actsExtensions:
228 SiSPSeededTracks = extension + "Tracks"
229
230 # This performs track finding
231 from InDetConfig.ITkTrackingSiPatternConfig import ITkTrackingSiPatternCfg
232 result.merge(ITkTrackingSiPatternCfg(
233 flags,
234 previousActsExtension=previousActsExtension,
235 InputCollections=InputExtendedITkTracks,
236 ResolvedTrackCollectionKey=TrackContainer,
237 SiSPSeededTrackCollectionKey=SiSPSeededTracks,
238 ClusterSplitProbContainer=ClusterSplitProbContainer))
239 StatTrackCollections += [SiSPSeededTracks, TrackContainer]
240 StatTrackTruthCollections += [SiSPSeededTracks+"TruthCollection",
241 TrackContainer+"TruthCollection"]
242
243 if doTrackOverlay and extension == "Conversion":
244 TrackContainer = "Resolved" + extension + "Tracks"
246 flags,
247 TrackContainer=TrackContainer,
248 ClusterSplitProbContainer=ClusterSplitProbContainer))
249
250 if flags.Tracking.ActiveConfig.storeSeparateContainer:
251 # If we do not want the track collection to be merged with another collection
252 # then we immediately create the track particles from it
253 # This happens inside ITkStoreTrackSeparateContainerCfg
254
255 # Track container, for ACTS workflow, depends on whether we activated the ambiguity resolution or not
256 inputTrack = TrackContainer
257 if extension in _actsExtensions and not flags.Tracking.ActiveConfig.doActsAmbiguityResolution:
258 inputTrack = SiSPSeededTracks
259
261 flags,
262 TrackContainer=inputTrack,
263 ClusterSplitProbContainer=ClusterSplitProbContainer))
264 else:
265 # ClusterSplitProbContainer is used for removing measurements used in previous passes
266 # For ACTS this is still not possible, TO BE IMPLEMENTED
267 ClusterSplitProbContainer = (
268 "ITkAmbiguityProcessorSplitProb" + extension)
269 # Collect all the Trk Track collections to be then merged in a single big collection
270 # Merging will be done later, and after that we create track particles from the merged collection
271 if extension not in _actsExtensions:
272 InputCombinedITkTracks += [TrackContainer]
273 else:
274 InputCombinedActsTracks += [TrackContainer]
275
276 # This is only used in this same function for the Track-PRD association
277 # Not yet supported for ACTS tracks
278 if extension not in _actsExtensions:
279 InputExtendedITkTracks += [TrackContainer]
280
281 return result, ClusterSplitProbContainer
282
283
285 InputCombinedITkTracks: list[str] = None,
286 ActsTrackContainerName="InDetActsTrackParticles") -> ComponentAccumulator:
287 # Inputs must not be None
288 assert InputCombinedITkTracks is not None and isinstance(InputCombinedITkTracks, list)
289
290 acc = ComponentAccumulator()
291 if len(InputCombinedITkTracks) == 0:
292 return acc
293
294 # Schedule Track particle creation
295 from ActsConfig.ActsTrackFindingConfig import ActsTrackToTrackParticleCnvAlgCfg
296 acc.merge(ActsTrackToTrackParticleCnvAlgCfg(flags, "ActsCombinedTrackToTrackParticleCnvAlg",
297 ACTSTracksLocation=InputCombinedITkTracks,
298 TrackParticlesOutKey=ActsTrackContainerName))
299 if flags.Tracking.doTruth :
300 from ActsConfig.ActsTruthConfig import ActsTrackParticleTruthDecorationAlgCfg
301 track_to_truth_maps=[]
302 for track_container in InputCombinedITkTracks :
303 track_to_truth_maps += [f'{track_container}ToTruthParticleAssociation']
304 # note: suppress stat dumps from ActsTrackParticleTruthDecorationAlg if there is only
305 # a single input collection, because it duplicates in that case the output of
306 # the TrackFindingValidationAlg
307 acc.merge(ActsTrackParticleTruthDecorationAlgCfg(
308 flags,
309 name=f'{ActsTrackContainerName}TruthDecorationAlg',
310 TrackToTruthAssociationMaps = track_to_truth_maps,
311 TrackParticleContainerName = ActsTrackContainerName,
312 OutputLevel=WARNING if len(InputCombinedITkTracks)==1 else INFO,
313 ComputeTrackRecoEfficiency=False if len(InputCombinedITkTracks)==1 else True
314 ))
315 return acc
316
318 InputCombinedITkTracks: list[str] = None,
319 StatTrackCollections: list[str] = None,
320 StatTrackTruthCollections: list[str] = None):
321 # None of the input collection is supposed to be None
322 assert InputCombinedITkTracks is not None and isinstance(InputCombinedITkTracks, list)
323 assert StatTrackCollections is not None and isinstance(StatTrackCollections, list)
324 assert StatTrackTruthCollections is not None and isinstance(StatTrackTruthCollections, list)
325
326 # If there are no tracks return directly
327 result = ComponentAccumulator()
328 if len(InputCombinedITkTracks) == 0:
329 return result
330
331 doTrackOverlay = flags.TrackOverlay.isTrackOverlaySeq
332 TrackContainer = "CombinedITkTracks"
333 if doTrackOverlay:
334 #schedule merge to combine signal and background tracks
335 InputCombinedITkTracks += [flags.Overlay.BkgPrefix + TrackContainer]
336
337 from TrkConfig.TrkConfigFlags import TrackingComponent
338 doGNNWithoutAmbiReso = (TrackingComponent.GNNChain in flags.Tracking.recoChain and (not flags.Tracking.GNN.doAmbiResolution))
339 skipClusterMerge = doGNNWithoutAmbiReso or flags.Tracking.doITkFastTracking
340 # This merges track collections
341 from TrkConfig.TrkTrackCollectionMergerConfig import (
342 ITkTrackCollectionMergerAlgCfg)
343 result.merge(ITkTrackCollectionMergerAlgCfg(
344 flags,
345 InputCombinedTracks=InputCombinedITkTracks,
346 OutputCombinedTracks=TrackContainer,
347 AssociationMapName=(
348 "" if skipClusterMerge else
349 f"PRDtoTrackMapMerge_{TrackContainer}")))
350
351 if flags.Tracking.doTruth:
352 from InDetConfig.ITkTrackTruthConfig import ITkTrackTruthCfg
353 result.merge(ITkTrackTruthCfg(
354 flags,
355 Tracks=TrackContainer,
356 DetailedTruth=f"{TrackContainer}DetailedTruth",
357 TracksTruth=f"{TrackContainer}TruthCollection"))
358
359 StatTrackCollections += [TrackContainer]
360 StatTrackTruthCollections += [f"{TrackContainer}TruthCollection"]
361
362 if flags.Tracking.doSlimming:
363 from TrkConfig.TrkTrackSlimmerConfig import TrackSlimmerCfg
364 result.merge(TrackSlimmerCfg(
365 flags,
366 TrackLocation=[TrackContainer]))
367
368 splitProbName = ITkClusterSplitProbabilityContainerName(flags)
369
370 # This creates track particles
371 if flags.Tracking.perigeeExpression == "BeamLine":
372 from xAODTrackingCnv.xAODTrackingCnvConfig import ITkTrackParticleCnvAlgCfg
373 result.merge(ITkTrackParticleCnvAlgCfg(
374 flags,
375 ClusterSplitProbabilityName=(
376 "" if skipClusterMerge else
377 splitProbName),
378 AssociationMapName=(
379 "" if skipClusterMerge else
380 f"PRDtoTrackMapMerge_{TrackContainer}"),
381 isActsAmbi = 'ActsValidateResolvedTracks' in splitProbName or \
382 'ActsValidateAmbiguityResolution' in splitProbName or \
383 'ActsValidateScoreBasedAmbiguityResolution' in splitProbName or \
384 'ActsConversion' in splitProbName or \
385 'ActsLargeRadius' in splitProbName or \
386 'ActsValidateLargeRadiusStandalone' in splitProbName or \
387 'ActsLowPt' in splitProbName or \
388 ('Acts' in splitProbName and 'Validate' not in splitProbName) ))
389
390 return result
391
392
393def ITkStatsCfg(flags, StatTrackCollections=None,
394 StatTrackTruthCollections=None):
395 result = ComponentAccumulator()
396
397 from InDetConfig.InDetRecStatisticsConfig import (
398 ITkRecStatisticsAlgCfg)
399 result.merge(ITkRecStatisticsAlgCfg(
400 flags,
401 TrackCollectionKeys=StatTrackCollections,
402 TrackTruthCollectionKeys=(
403 StatTrackTruthCollections if flags.Tracking.doTruth else [])))
404
405 if flags.Tracking.doTruth:
406 from InDetConfig.InDetTrackClusterAssValidationConfig import (
407 ITkTrackClusterAssValidationCfg)
408 result.merge(ITkTrackClusterAssValidationCfg(
409 flags,
410 TracksLocation=StatTrackCollections))
411
412 return result
413
414
416 result = ComponentAccumulator()
417
418 #Add the truth origin to the truth particles
419 from InDetConfig.InDetPrepRawDataToxAODConfig import ITkActsPrepDataToxAODCfg
420 result.merge(ITkActsPrepDataToxAODCfg(flags))
421
422 return result
423
425 result = ComponentAccumulator()
426
427 if flags.Tracking.doTIDE_AmbiTrackMonitoring:
428 from InDetConfig.InDetPrepRawDataToxAODConfig import (
429 ITkPixelPrepDataToxAOD_ExtraTruthCfg as PixelPrepDataToxAODCfg,
430 ITkStripPrepDataToxAOD_ExtraTruthCfg as StripPrepDataToxAODCfg)
431 else:
432 from InDetConfig.InDetPrepRawDataToxAODConfig import (
433 ITkPixelPrepDataToxAODCfg as PixelPrepDataToxAODCfg,
434 ITkStripPrepDataToxAODCfg as StripPrepDataToxAODCfg)
435
436 result.merge(PixelPrepDataToxAODCfg(
437 flags,
438 ClusterSplitProbabilityName=(
439 "" if flags.Tracking.doITkFastTracking else
441 result.merge(StripPrepDataToxAODCfg(flags))
442
443 from DerivationFrameworkInDet.InDetToolsConfig import (
444 ITkTSOS_CommonKernelCfg)
445 # Set up one algorithm for each output tracking container
446 # Always done for default pass
447 # Done for other passes if pass requests to store track seeds OR track candidates OR requests separate container
448 # Input handling/configuration of algorithm for specific cases is done in TSOS_CommonKernelCfg
449 listOfExtensionsRequesting = [
450 e for e in _extensions_list if (e == '')
451 or (flags.Tracking[f"ITk{e}Pass"].storeTrackSeeds) # Store Si track seeds
452 or (flags.Tracking[f"ITk{e}Pass"].storeSiSPSeededTracks) # Store Si candidate tracks
453 or (flags.Tracking[f"ITk{e}Pass"].storeSeparateContainer) ] # Particular tracking pass requesting separate container from main pass
454
455 result.merge(ITkTSOS_CommonKernelCfg(
456 flags, listOfExtensions = listOfExtensionsRequesting))
457
458 if flags.Tracking.doStoreTrackSeeds:
459 from DerivationFrameworkInDet.InDetToolsConfig import (
460 ITkSiSPSeedsTSOS_CommonKernelCfg)
461 # Setup one algorithm for each output tracking container
462 listOfExtensionsRequesting = [
463 e for e in _extensions_list if (e == '') or
464 flags.Tracking[f"ITk{e}Pass"].storeTrackSeeds ]
465 result.merge(ITkSiSPSeedsTSOS_CommonKernelCfg(
466 flags, listOfExtensions = listOfExtensionsRequesting))
467
468 if flags.Tracking.doStoreSiSPSeededTracks:
469 listOfExtensionsRequesting = [
470 e for e in _extensions_list if (e=='') or
471 flags.Tracking[f"ITk{e}Pass"].storeSiSPSeededTracks ]
472 from DerivationFrameworkInDet.InDetToolsConfig import (
473 ITkSiSPTSOS_CommonKernelCfg)
474 result.merge(ITkSiSPTSOS_CommonKernelCfg(flags, listOfExtensions = listOfExtensionsRequesting))
475
476 if flags.Input.isMC:
477 listOfExtensionsRequesting = [
478 e for e in _extensions_list if (e=='') or
479 (flags.Tracking[f"ITk{e}Pass"].storeSiSPSeededTracks and
480 flags.Tracking[f"ITk{e}Pass"].storeSeparateContainer) ]
481 from InDetPhysValMonitoring.InDetPhysValDecorationConfig import (
482 ITkPhysHitDecoratorAlgCfg)
483 for extension in listOfExtensionsRequesting:
484 result.merge(ITkPhysHitDecoratorAlgCfg(
485 flags,
486 name=f"ITkPhysHit{extension}DecoratorAlg",
487 TrackParticleContainerName=f"InDet{extension}TrackParticles"))
488
489 return result
490
491
492
495
496
497def ITkTrackRecoCfg(flags) -> ComponentAccumulator:
498 """Configures complete ITk tracking """
499
500 from InDetConfig.ITkActsHelpers import primaryPassUsesActs
501 if primaryPassUsesActs(flags):
502 from InDetConfig.ITkActsTrackRecoConfig import ITkActsTrackRecoCfg
503 return ITkActsTrackRecoCfg(flags)
504
505 result = ComponentAccumulator()
506
507 if flags.Input.Format is Format.BS:
508 # TODO: ITk BS providers
509 raise RuntimeError("ByteStream inputs not supported")
510
511 # Get all the requested tracking passes
512 flags_set = CombinedTrackingPassFlagSets(flags)
513
514 # Store the names of several collections from all the different passes
515 # These collections will then be used for different purposes
516
517 # Tracks to be ultimately merged in InDetTrackParticle collection
518 InputCombinedITkTracks = []
519 # Same but for ACTS collection
520 InputCombinedActsTracks = []
521 # Includes also tracks which end in standalone TrackParticle collections
522 InputExtendedITkTracks = []
523 # Cluster split prob container for measurement removal
524 ClusterSplitProbContainer = ""
525 # To be passed to the InDetRecStatistics alg
526 StatTrackCollections = []
527 StatTrackTruthCollections = []
528 # Record previous ACTS extension
529 previousActsExtension = None
530
531 from InDetConfig.SiliconPreProcessing import ITkRecPreProcessingSiliconCfg
532
533 for current_flags in flags_set:
534 printActiveConfig(current_flags)
535
536
537 extension = current_flags.Tracking.ActiveConfig.extension
538 if extension not in _actsExtensions:
539 _extensions_list.append(extension)
540
541 # Add the extension to the output job option
542 _outputExtensions.append(extension)
543
544 # Data Preparation
545 # According to the tracking pass we have different data preparation
546 # sequences. We may have:
547 # (1) Full Athena data preparation
548 # (2) Full Acts data preparation
549 # (3) Hybrid configurations with EDM converters
550 result.merge(ITkRecPreProcessingSiliconCfg(current_flags,
551 previousActsExtension=previousActsExtension))
552
553 # Track Reconstruction
554 # This includes track finding and ambiguity resolution
555 # The output is the component accumulator to be added to the sequence
556 # and the name of the cluster split prob container that is used for
557 # removing measurements used by previous passes
558 # This last object will also assure the proper sequence of the tracking passes
559 # since it will create a data dependency from the prevous pass
560 acc, ClusterSplitProbContainer = ITkTrackRecoPassCfg(
561 current_flags,
562 previousActsExtension,
563 InputCombinedITkTracks=InputCombinedITkTracks,
564 InputCombinedActsTracks=InputCombinedActsTracks,
565 InputExtendedITkTracks=InputExtendedITkTracks,
566 StatTrackCollections=StatTrackCollections,
567 StatTrackTruthCollections=StatTrackTruthCollections,
568 ClusterSplitProbContainer=ClusterSplitProbContainer)
569 result.merge(acc)
570
571 # Store ACTS extension
572 if 'Acts' in extension:
573 previousActsExtension = extension
574
575 # This merges the track collection in InputCombinedITkTracks
576 # and creates a track particle collection from that
577 if InputCombinedITkTracks:
578
579 result.merge(
580 ITkTrackFinalCfg(flags,
581 InputCombinedITkTracks=InputCombinedITkTracks,
582 StatTrackCollections=StatTrackCollections,
583 StatTrackTruthCollections=StatTrackTruthCollections))
584
585
586
587
588 # Now handle ACTS tracks instead if present in the event
589 if InputCombinedActsTracks:
590
591 # The name of the Acts xAOD container name depends on what
592 # workflow has been executed, which we get by checking
593 # the size of the track containers.
594
595 ActsTrackContainerName = "InDetTrackParticles" if not InputCombinedITkTracks else "InDetActsTrackParticles"
596 ActsPrimaryVertices = "PrimaryVertices" if not InputCombinedITkTracks else "ActsPrimaryVertices"
597
598 result.merge(ITkActsTrackFinalCfg(flags,
599 InputCombinedITkTracks=InputCombinedActsTracks,
600 ActsTrackContainerName=ActsTrackContainerName))
601
602 # Perform vertex finding
603 if flags.Tracking.doVertexFinding:
604
605 from InDetConfig.InDetPriVxFinderConfig import primaryVertexFindingCfg
606
607 # Schedule the usual vertex finding for Athena workflow(s)
608 # ONLY schedule this if there are Athena Legacy Track collections
609 if InputCombinedITkTracks:
610 result.merge(primaryVertexFindingCfg(flags))
611
612 # Schedule the same vertex finding for Acts workflow(s)
613 # For now this is separate from the Athena counterpart, but in the
614 # end the difference will not be needed anymore
615 # ONLY schedule this if there are ACTS Track collections
616 if InputCombinedActsTracks:
617 result.merge(primaryVertexFindingCfg(flags,
618 name="ActsPriVxFinderAlg",
619 TracksName=ActsTrackContainerName,
620 vxCandidatesOutputName=ActsPrimaryVertices))
621
622 # Post Processing
623 # This is mainly for validation support
624 print("-------- POST PROCESSING --------")
625 for current_flags in flags_set:
626 extension = current_flags.Tracking.ActiveConfig.extension
627 print(f"- Running post-processing for extension: {extension}")
628
629 # Persistify the Seeds
630 # This is done for the InDet EDM, while for ACTS seeds the persistification
631 # support is done while scheduling the seeding algorithms
632 # This means that here we only care about the legacy seeds, that are
633 # produced whem the legacy Track Finding is scheduled
634 # - flags.Tracking.ActiveConfig.doAthenaTrack
635 # This also covers the case of the Acts->InDet Seed conversion, since that
636 # runs the legacy track finding as well
637 #
638 # At the end of this we have a track collection (segments from the seeds)
639 # and the corresponding track particle collection
640 if current_flags.Tracking.ActiveConfig.doAthenaTrack:
641 if current_flags.Tracking.doStoreTrackSeeds:
642 from InDetConfig.ITkPersistificationConfig import ITkTrackSeedsFinalCfg
643 result.merge(ITkTrackSeedsFinalCfg(current_flags))
644
645 # Persistify Track from Track Finding
646 # Currently this is only possible for Trk Tracks
647 # For legacy tracking passes the CKF Trk Tracks are always produced
648 # - flags.Tracking.ActiveConfig.doAthenaTrack
649 # For hybrid ACTS-Athena tracking passes they are produced only after Track EDM conversion
650 # - flags.Tracking.ActiveConfig.doActsToAthenaTrack
651 if current_flags.Tracking.ActiveConfig.doAthenaTrack or current_flags.Tracking.ActiveConfig.doActsToAthenaTrack:
652 if current_flags.Tracking.doStoreSiSPSeededTracks:
653 from InDetConfig.ITkPersistificationConfig import ITkSiSPSeededTracksFinalCfg
654 result.merge(ITkSiSPSeededTracksFinalCfg(current_flags))
655
656 if flags.Tracking.doStats:
657 if _extensions_list:
658 result.merge(ITkStatsCfg(
659 flags_set[0], # Use cuts from primary pass
660 StatTrackCollections=StatTrackCollections,
661 StatTrackTruthCollections=StatTrackTruthCollections))
662
663
664
665 if flags.Tracking.writeExtendedSi_PRDInfo:
666 if _extensions_list:
667 result.merge(ITkExtendedPRDInfoCfg(flags))
668
669 #Acts algorithm
670 else:
671 result.merge(ITkActsExtendedPRDInfoCfg(flags))
672
673 # output
674 from InDetConfig.ITkTrackOutputConfig import ITkTrackRecoOutputCfg
675 result.merge(ITkTrackRecoOutputCfg(flags, _outputExtensions))
676 result.printConfig(withDetails = False, summariseProps = False)
677 return result
678
679
680if __name__ == "__main__":
681 from AthenaConfiguration.AllConfigFlags import initConfigFlags
682 flags = initConfigFlags()
683
684 # Disable calo for this test
685 flags.Detector.EnableCalo = False
686
687 from AthenaConfiguration.TestDefaults import defaultTestFiles
688 flags.Input.Files = defaultTestFiles.RDO_RUN4
689
690 import sys
691 if "--doFTF" in sys.argv:
692 flags.Tracking.useITkFTF = True
693 flags.Tracking.doITkFastTracking = True
694
695 flags.lock()
696
697 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
698 top_acc = MainServicesCfg(flags)
699
700 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
701 top_acc.merge(PoolReadCfg(flags))
702
703 if flags.Input.isMC and flags.Output.doGEN_AOD2xAOD:
704 from xAODTruthCnv.xAODTruthCnvConfig import GEN_AOD2xAODCfg
705 top_acc.merge(GEN_AOD2xAODCfg(flags))
706
707 top_acc.merge(ITkTrackRecoCfg(flags))
708
709 from AthenaCommon.Constants import DEBUG
710 top_acc.foreach_component("AthEventSeq/*").OutputLevel = DEBUG
711 top_acc.printConfig(withDetails=True, summariseProps=True)
712 top_acc.store(open("ITkTrackReco.pkl", "wb"))
713
714 if "--norun" not in sys.argv:
715 sc = top_acc.run(5)
716 if sc.isFailure():
717 sys.exit(-1)
void print(char *figname, TCanvas *c1)
ITkTrackFinalCfg(flags, list[str] InputCombinedITkTracks=None, list[str] StatTrackCollections=None, list[str] StatTrackTruthCollections=None)
ComponentAccumulator ITkActsTrackFinalCfg(flags, list[str] InputCombinedITkTracks=None, ActsTrackContainerName="InDetActsTrackParticles")
ITkTrackRecoPassCfg(flags, str previousActsExtension=None, list[str] InputCombinedITkTracks=None, list[str] InputCombinedActsTracks=None, list[str] InputExtendedITkTracks=None, list[str] StatTrackCollections=None, list[str] StatTrackTruthCollections=None, str ClusterSplitProbContainer="")
ComponentAccumulator ITkTrackRecoCfg(flags)
Main ITk tracking config #####################.
ComponentAccumulator ITkStoreTrackSeparateContainerCfg(flags, str TrackContainer="", str ClusterSplitProbContainer="")
ITkStatsCfg(flags, StatTrackCollections=None, StatTrackTruthCollections=None)