ATLAS Offline Software
ITkActsTrackRecoConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
3 
4 def ITkActsTrackRecoCfg(flags) -> ComponentAccumulator:
5  # Main Job Option for ACTS Track Reconstruction with ITk
6  print("Scheduling the ACTS Job Option for ITk Track Reconstruction")
7  if flags.Tracking.doITkFastTracking:
8  print("- Configuration requested: Fast Tracking")
10 
11  # Pre-Processing
12  # Retrieve all the tracking passes
13  from InDetConfig.ITkActsHelpers import extractTrackingPasses
14  scheduledTrackingPasses = extractTrackingPasses(flags)
15  # Keep track of previous pass (used for PRD mapping)
16  previousExtension = None
17 
18  # Track Collections to be merged for main track particle collection
19  # This is the groups of tracks generated in tracking passes that do not store
20  # tracks in separate containers
21  InputCombinedITkTracks = []
22 
23  # Container names
24  trackParticleContainerName = "InDetTrackParticles"
25  primaryVertices = "PrimaryVertices"
26 
27  # Reconstruction
28  from InDetConfig.ITkActsHelpers import isPrimaryPass
29  for currentFlags in scheduledTrackingPasses:
30  # Printing configuration
31  print(f"---- Preparing scheduling of algorithms for tracking pass: {currentFlags.Tracking.ActiveConfig.extension}")
32  print(f"---- - Is primary pass: {isPrimaryPass(currentFlags)}")
33  from TrkConfig.TrackingPassFlags import printActiveConfig
34  printActiveConfig(currentFlags)
35 
36  # Data Preparation
37  # This includes Region-of-Interest creation, Cluster and Space Point formation
38  from InDetConfig.ITkActsDataPreparationConfig import ITkActsDataPreparationCfg
39  acc.merge(ITkActsDataPreparationCfg(currentFlags,
40  previousExtension = previousExtension))
41 
42  # Track Reconstruction
43  # This includes Seeding, Track Finding (CKF) and Ambiguity Resolution
44  from InDetConfig.ITkActsPatternRecognitionConfig import ITkActsTrackReconstructionCfg
45  acc.merge(ITkActsTrackReconstructionCfg(currentFlags,
46  previousExtension = previousExtension))
47 
48  # Update variables
49  previousExtension = currentFlags.Tracking.ActiveConfig.extension
50  if not currentFlags.Tracking.ActiveConfig.storeSeparateContainer or isPrimaryPass(currentFlags):
51  acts_tracks = f"{currentFlags.Tracking.ActiveConfig.extension}Tracks" if not currentFlags.Acts.doAmbiguityResolution else f"{currentFlags.Tracking.ActiveConfig.extension}ResolvedTracks"
52  InputCombinedITkTracks.append(acts_tracks)
53 
54 
55  # Track particle creation
56  print(f"Creating track particle collection '{trackParticleContainerName}' from combination of following track collection:")
57  for trackCollection in InputCombinedITkTracks:
58  print(f'- {trackCollection}')
59 
60  # In case perigee expression is Vertex we have a situation where
61  # there is a first temporary track particle creation wrt BeamLine
62  # followed, after vertex reco, of a second particle creation wrt vertex
63  #
64  # The final track particle collection will still be the one defined in trackParticleContainerName
65  persistifyCollection = True
66  particleCollection = trackParticleContainerName
67  perigeeExpression = flags.Tracking.perigeeExpression
68  if flags.Tracking.perigeeExpression == "Vertex":
69  # We do not want to persistify this temporary collection
70  persistifyCollection = False
71  particleCollection = f"{trackParticleContainerName}Temporary"
72  perigeeExpression = "BeamLine"
73 
74  # Track particles wrt BeamLine
75  from InDetConfig.ITkActsParticleCreationConfig import ITkActsTrackParticleCreationCfg
76  acc.merge(ITkActsTrackParticleCreationCfg(flags,
77  TrackContainers = InputCombinedITkTracks,
78  TrackParticleContainer = particleCollection,
79  persistifyCollection = persistifyCollection,
80  PerigeeExpression = perigeeExpression))
81 
82  # Vertex reconstruction
83  if flags.Tracking.doVertexFinding:
84  from InDetConfig.ActsPriVxFinderConfig import primaryVertexFindingCfg
85  acc.merge(primaryVertexFindingCfg(flags,
86  name = "ActsPriVxFinderAlg",
87  TracksName = particleCollection,
88  vxCandidatesOutputName = primaryVertices))
89 
90  # Track particles wrt Vertex
91  #
92  # In case perigee expression is Vertex we need to schedule the final
93  # track particle creation using the vertex
94  # The track collection(s) unchanged, only the final track particle container
95  # has a different name
96  if flags.Tracking.perigeeExpression == "Vertex":
97  assert flags.Tracking.doVertexFinding, \
98  f"Requested the computation of track particles wrt but flags.Tracking.doVertexFinding is set to {flags.Tracking.doVertexFinding}"
99  print('Requesting to compute the track particle collection wrt the Vertex')
100  acc.merge(ITkActsTrackParticleCreationCfg(flags,
101  TrackContainers = InputCombinedITkTracks,
102  TrackParticleContainer = trackParticleContainerName))
103 
104  # Post-Processing
105  print('Starting Post-Processing')
106 
107 
110  if flags.Tracking.writeExtendedSi_PRDInfo:
111  # Get all the track particle collections being generated
112  # this covers the main tracking collection InDetTrackParticles
113  # as well as the converted seeds, tracks from CKF and all those
114  # track collection that do not get merged.
115  # This operation is necessary only if we desire to only persistify
116  # on-track PRD info, since we need to get all the measurements used by
117  # all tracks we want to persistify
118  generatedTrackParticleCollections = ["InDetTrackParticles"]
119  if flags.Tracking.PRDInfo.KeepOnlyOnTrackMeasurements:
120  from InDetConfig.ITkActsHelpers import getListOfGeneratedTrackParticles
121  generatedTrackParticleCollections = getListOfGeneratedTrackParticles(flags)
122 
123  # Add the truth origin to the truth particles
124  # This handles:
125  # - Pixel detector
126  # - Strip detector
127  from InDetConfig.InDetPrepRawDataToxAODConfig import ITkActsPrepDataToxAODCfg
128  acc.merge(ITkActsPrepDataToxAODCfg(flags,
129  TrackParticles = generatedTrackParticleCollections))
130 
131  # Create MSOS on final InDetTrackParticles collection
132  from ActsConfig.ActsObjectDecorationConfig import ActsTrackStateOnSurfaceDecoratorAlgCfg
134  name=f"Acts{trackParticleContainerName}StateOnSurfaceDecoratorAlg",
135  TrackParticles=trackParticleContainerName))
136 
137  # Run on the specific tracking passes
138  for currentFlags in scheduledTrackingPasses:
139  # Particle persistification for tracking pass
140  from InDetConfig.ITkActsParticleCreationConfig import ITkActsTrackParticlePersistificationCfg
141  acc.merge(ITkActsTrackParticlePersistificationCfg(currentFlags))
142 
143  # Create MSOS for the intermediate track particle collections
144  # this may be the CKF and/or the ambi tracks and can only happen if
145  # - storeSiSPSeededTracks for this tracking pass is requested
146  # - storeSeparateContainer for this tracking pass is requested
147  if flags.Tracking.writeExtendedSi_PRDInfo:
148  from ActsConfig.ActsObjectDecorationConfig import ActsTrackStateOnSurfaceDecoratorAlgCfg
149  # CKF tracks are called: SiSPSeededTracks{currentFlags.Tracking.ActiveConfig.extension}TrackParticles
150  if currentFlags.Tracking.ActiveConfig.storeSiSPSeededTracks:
151  TrackParticleCollectionForMsos = f'SiSPSeededTracks{currentFlags.Tracking.ActiveConfig.extension}TrackParticles'
152  acc.merge(ActsTrackStateOnSurfaceDecoratorAlgCfg(currentFlags,
153  name=f"{TrackParticleCollectionForMsos}StateOnSurfaceDecoratorAlg",
154  TrackParticles=TrackParticleCollectionForMsos,
155  PixelMSOSs=f"SiSPSeededITk{currentFlags.Tracking.ActiveConfig.extension}PixelMSOSs",
156  StripMSOSs=f"SiSPSeededITk{currentFlags.Tracking.ActiveConfig.extension}StripMSOSs"))
157 
158  if currentFlags.Tracking.ActiveConfig.storeSeparateContainer:
159  # track collection can be the CKF or the ambi depending
160  # on the presence of the ambiguity resolution algorithm
161  # but the track particle collection remains the same
162  # name: InDet{currentFlags.Tracking.ActiveConfig.extension}TrackParticles
163  TrackParticleCollectionForMsos = f'InDet{currentFlags.Tracking.ActiveConfig.extension}TrackParticles'
164  acc.merge(ActsTrackStateOnSurfaceDecoratorAlgCfg(currentFlags,
165  name=f"{TrackParticleCollectionForMsos}StateOnSurfaceDecoratorAlg",
166  TrackParticles=TrackParticleCollectionForMsos,
167  PixelMSOSs=f"ITk{currentFlags.Tracking.ActiveConfig.extension}PixelMSOSs",
168  StripMSOSs=f"ITk{currentFlags.Tracking.ActiveConfig.extension}StripMSOSs"))
169 
170 
171 
172  acc.printConfig(withDetails = False, summariseProps = False)
173  return acc
174 
python.ActsPriVxFinderConfig.primaryVertexFindingCfg
ComponentAccumulator primaryVertexFindingCfg(flags, str name="InDetPriVxFinder", *str TracksName, str vxCandidatesOutputName=None, **kwargs)
Definition: InnerDetector/InDetConfig/python/ActsPriVxFinderConfig.py:29
python.ITkActsHelpers.isPrimaryPass
bool isPrimaryPass(flags)
Definition: ITkActsHelpers.py:3
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.ITkActsHelpers.getListOfGeneratedTrackParticles
list[str] getListOfGeneratedTrackParticles(flags)
Definition: ITkActsHelpers.py:87
python.ITkActsParticleCreationConfig.ITkActsTrackParticlePersistificationCfg
ComponentAccumulator ITkActsTrackParticlePersistificationCfg(flags)
Definition: ITkActsParticleCreationConfig.py:86
python.ITkActsPatternRecognitionConfig.ITkActsTrackReconstructionCfg
ComponentAccumulator ITkActsTrackReconstructionCfg(flags, *str previousExtension=None)
Definition: ITkActsPatternRecognitionConfig.py:4
python.ITkActsParticleCreationConfig.ITkActsTrackParticleCreationCfg
ComponentAccumulator ITkActsTrackParticleCreationCfg(flags, *list[str] TrackContainers, str TrackParticleContainer, bool persistifyCollection=True, str PerigeeExpression=None)
Definition: ITkActsParticleCreationConfig.py:4
python.ITkActsDataPreparationConfig.ITkActsDataPreparationCfg
ComponentAccumulator ITkActsDataPreparationCfg(flags, *str previousExtension=None)
Definition: ITkActsDataPreparationConfig.py:4
python.TrackingPassFlags.printActiveConfig
def printActiveConfig(flags)
Definition: TrackingPassFlags.py:1009
python.ITkActsHelpers.extractTrackingPasses
list extractTrackingPasses(flags)
Definition: ITkActsHelpers.py:28
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.InDetPrepRawDataToxAODConfig.ITkActsPrepDataToxAODCfg
ComponentAccumulator ITkActsPrepDataToxAODCfg(flags, *str PixelClusterContainer="ITkPixelClusters", str StripClusterContainer="ITkStripClusters", str PixelMeasurementContainer="ITkPixelMeasurements", str StripMeasurementContainer="ITkStripMeasurements", list[str] TrackParticles=None)
Definition: InDetPrepRawDataToxAODConfig.py:46
python.ITkActsTrackRecoConfig.ITkActsTrackRecoCfg
ComponentAccumulator ITkActsTrackRecoCfg(flags)
Definition: ITkActsTrackRecoConfig.py:4
ActsObjectDecorationConfig.ActsTrackStateOnSurfaceDecoratorAlgCfg
ComponentAccumulator ActsTrackStateOnSurfaceDecoratorAlgCfg(flags, str name="ActsTrackStateOnSurfaceDecoratorAlg", **kwargs)
Definition: ActsObjectDecorationConfig.py:7