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