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