ATLAS Offline Software
Loading...
Searching...
No Matches
python.ActsTrackRecoConfig Namespace Reference

Functions

bool isPrimaryPass (flags)
list extractTrackingPasses (flags)
list[str] getListOfGeneratedTrackParticles (flags)
ComponentAccumulator ActsTrackRecoCfg (flags)

Function Documentation

◆ ActsTrackRecoCfg()

ComponentAccumulator ActsTrackRecoCfg ( flags)

Definition at line 66 of file ActsTrackRecoConfig.py.

66def ActsTrackRecoCfg(flags) -> ComponentAccumulator:
67 # Main Job Option for ACTS Track Reconstruction with Inner Detector
68 print("Scheduling the ACTS Job Option for Inner Detector Track Reconstruction")
69
70 acc = ComponentAccumulator()
71
72 # Pre-Processing
73 # Retrieve all the tracking passes
74 scheduledTrackingPasses = extractTrackingPasses(flags)
75 # Keep track of previous pass (used for PRD mapping)
76 previousExtension = None
77
78 # Track Collections to be merged for main track particle collection
79 # This is the groups of tracks generated in tracking passes that do not store
80 # tracks in separate containers
81 InputCombinedTracks = []
82
83 # Container names
84 trackParticleContainerName = "InDetTrackParticles"
85 primaryVertices = "PrimaryVertices"
86
87 # Reconstruction
88 for currentFlags in scheduledTrackingPasses:
89 # Printing configuration
90 print(f"---- Preparing scheduling of algorithms for tracking pass: {currentFlags.Tracking.ActiveConfig.extension}")
91 print(f"---- - Is primary pass: {isPrimaryPass(currentFlags)}")
92 from TrkConfig.TrackingPassFlags import printActiveConfig
93 printActiveConfig(currentFlags)
94
95 # Data Preparation
96 # This includes Region-of-Interest creation, Cluster and Space Point formation
97 from InDetConfig.ActsDataPreparationConfig import ActsDataPreparationCfg
98 acc.merge(ActsDataPreparationCfg(currentFlags,
99 previousExtension = previousExtension))
100
101 # Track Reconstruction
102 # This includes Seeding, Track Finding (CKF) and Ambiguity Resolution
103 from InDetConfig.ActsPatternRecognitionConfig import ActsTrackReconstructionCfg
104 acc.merge(ActsTrackReconstructionCfg(currentFlags,
105 previousExtension = previousExtension))
106
107 # Update variables
108 previousExtension = currentFlags.Tracking.ActiveConfig.extension
109 if not currentFlags.Tracking.ActiveConfig.storeSeparateContainer or isPrimaryPass(currentFlags):
110 acts_tracks = f"{currentFlags.Tracking.ActiveConfig.extension}Tracks" if not currentFlags.Acts.doAmbiguityResolution else f"{currentFlags.Tracking.ActiveConfig.extension}ResolvedTracks"
111 InputCombinedTracks.append(acts_tracks)
112
113
114 # Track particle creation
115 print(f"Creating track particle collection '{trackParticleContainerName}' from combination of following track collection:")
116 for trackCollection in InputCombinedTracks:
117 print(f'- {trackCollection}')
118
119 # In case perigee expression is Vertex we have a situation where
120 # there is a first temporary track particle creation wrt BeamLine
121 # followed, after vertex reco, of a second particle creation wrt vertex
122 #
123 # The final track particle collection will still be the one defined in trackParticleContainerName
124 persistifyCollection = True
125 particleCollection = trackParticleContainerName
126 perigeeExpression = flags.Tracking.perigeeExpression
127 if flags.Tracking.perigeeExpression is PerigeeExpression.Vertex:
128 # We do not want to persistify this temporary collection
129 persistifyCollection = False
130 particleCollection = f"{trackParticleContainerName}Temporary"
131 perigeeExpression = PerigeeExpression.BeamLine
132
133 # Track particles wrt BeamLine
134 from InDetConfig.ITkActsParticleCreationConfig import ITkActsTrackParticleCreationCfg
135 acc.merge(ITkActsTrackParticleCreationCfg(flags,
136 TrackContainers = InputCombinedTracks,
137 TrackParticleContainer = particleCollection,
138 persistifyCollection = persistifyCollection,
139 PerigeeExpression = perigeeExpression))
140
141 # Vertex reconstruction
142 if flags.Tracking.doVertexFinding:
143 from InDetConfig.ActsPriVxFinderConfig import primaryVertexFindingCfg
144 acc.merge(primaryVertexFindingCfg(flags,
145 name = "ActsPriVxFinderAlg",
146 TracksName = particleCollection,
147 vxCandidatesOutputName = primaryVertices))
148
149 # Track particles wrt Vertex
150 #
151 # In case perigee expression is Vertex we need to schedule the final
152 # track particle creation using the vertex
153 # The track collection(s) unchanged, only the final track particle container
154 # has a different name
155 if flags.Tracking.perigeeExpression is PerigeeExpression.Vertex:
156 assert flags.Tracking.doVertexFinding, \
157 f"Requested the computation of track particles wrt but flags.Tracking.doVertexFinding is set to {flags.Tracking.doVertexFinding}"
158 print('Requesting to compute the track particle collection wrt the Vertex')
159 acc.merge(ITkActsTrackParticleCreationCfg(flags,
160 TrackContainers = InputCombinedTracks,
161 TrackParticleContainer = trackParticleContainerName))
162
163 # Post-Processing
164 print('Starting Post-Processing')
165
166
167
170 if flags.Tracking.writeExtendedSi_PRDInfo:
171 # Get all the track particle collections being generated
172 # this covers the main tracking collection InDetTrackParticles
173 # as well as the converted seeds, tracks from CKF and all those
174 # track collection that do not get merged.
175 # This operation is necessary only if we desire to only persistify
176 # on-track PRD info, since we need to get all the measurements used by
177 # all tracks we want to persistify
178 generatedTrackParticleCollections = ["InDetTrackParticles"]
179 if flags.Tracking.PRDInfo.KeepOnlyOnTrackMeasurements:
180 generatedTrackParticleCollections = getListOfGeneratedTrackParticles(flags)
181
182 # Add the truth origin to the truth particles
183 # This handles:
184 # - Pixel detector
185 # - Strip detector
186 from InDetConfig.InDetPrepRawDataToxAODConfig import ActsPrepDataToxAODCfg
187 acc.merge(ActsPrepDataToxAODCfg(flags,
188 TrackParticles = generatedTrackParticleCollections))
189
190 # Create MSOS on final InDetTrackParticles collection
191 from ActsConfig.ActsObjectDecorationConfig import ActsInDetTrackStateOnSurfaceDecoratorAlgCfg
192 acc.merge(ActsInDetTrackStateOnSurfaceDecoratorAlgCfg(flags,
193 name=f"Acts{trackParticleContainerName}StateOnSurfaceDecoratorAlg",
194 TrackParticles=trackParticleContainerName))
195
196 # Run on the specific tracking passes
197 for currentFlags in scheduledTrackingPasses:
198 # Particle persistification for tracking pass
199 from InDetConfig.ITkActsParticleCreationConfig import ITkActsTrackParticlePersistificationCfg
200 acc.merge(ITkActsTrackParticlePersistificationCfg(currentFlags))
201
202 # Create MSOS for the intermediate track particle collections
203 # this may be the CKF and/or the ambi tracks and can only happen if
204 # - storeSiSPSeededTracks for this tracking pass is requested
205 # - storeSeparateContainer for this tracking pass is requested
206 if flags.Tracking.writeExtendedSi_PRDInfo:
207 from ActsConfig.ActsObjectDecorationConfig import ActsInDetTrackStateOnSurfaceDecoratorAlgCfg
208 # CKF tracks are called: SiSPSeededTracks{currentFlags.Tracking.ActiveConfig.extension}TrackParticles
209 if currentFlags.Tracking.ActiveConfig.storeSiSPSeededTracks:
210 TrackParticleCollectionForMsos = f'SiSPSeededTracks{currentFlags.Tracking.ActiveConfig.extension}TrackParticles'
211 acc.merge(ActsInDetTrackStateOnSurfaceDecoratorAlgCfg(currentFlags,
212 name=f"{TrackParticleCollectionForMsos}StateOnSurfaceDecoratorAlg",
213 TrackParticles=TrackParticleCollectionForMsos,
214 PixelMSOSs=f"SiSPSeeded{currentFlags.Tracking.ActiveConfig.extension}PixelMSOSs",
215 StripMSOSs=f"SiSPSeeded{currentFlags.Tracking.ActiveConfig.extension}StripMSOSs"))
216
217 if currentFlags.Tracking.ActiveConfig.storeSeparateContainer:
218 # track collection can be the CKF or the ambi depending
219 # on the presence of the ambiguity resolution algorithm
220 # but the track particle collection remains the same
221 # name: InDet{currentFlags.Tracking.ActiveConfig.extension}TrackParticles
222 TrackParticleCollectionForMsos = f'InDet{currentFlags.Tracking.ActiveConfig.extension}TrackParticles'
223 acc.merge(ActsInDetTrackStateOnSurfaceDecoratorAlgCfg(currentFlags,
224 name=f"{TrackParticleCollectionForMsos}StateOnSurfaceDecoratorAlg",
225 TrackParticles=TrackParticleCollectionForMsos,
226 PixelMSOSs=f"{currentFlags.Tracking.ActiveConfig.extension}PixelMSOSs",
227 StripMSOSs=f"{currentFlags.Tracking.ActiveConfig.extension}StripMSOSs"))
228 # Debug output
229 # from ActsConfig.ActsGeometryConfig import ActsWriteTrackingGeometryTransformsAlgCfg
230 # acc.merge(ActsWriteTrackingGeometryTransformsAlgCfg(flags,WriteFullTransform = False, OutputName = "transforms.csv"))
231 # from AthenaCommon.Constants import DEBUG, ALL, VERBOSE
232 # acc.foreach_component("*/TrackFindingAlg").OutputLevel = DEBUG
233 acc.printConfig(withDetails = True, summariseProps = True)
234 return acc
235
void print(char *figname, TCanvas *c1)

◆ extractTrackingPasses()

list extractTrackingPasses ( flags)

Definition at line 15 of file ActsTrackRecoConfig.py.

15def extractTrackingPasses(flags) -> list:
16 # Function for extracting the requested tracking passes that need to be scheduled
17 trackingPasses = []
18
19 # Primary pass
20 trackingPasses += [flags.cloneAndReplace(
21 "Tracking.ActiveConfig",
22 f"Tracking.{flags.Tracking.PrimaryPassConfig.value}Pass")]
23
24 # Only have primary pass for the moment
25 print("List of scheduled passes:")
26 for trackingPass in trackingPasses:
27 print(f'- {trackingPass.Tracking.ActiveConfig.extension}')
28
29 return trackingPasses
30

◆ getListOfGeneratedTrackParticles()

list[str] getListOfGeneratedTrackParticles ( flags)

Definition at line 31 of file ActsTrackRecoConfig.py.

31def getListOfGeneratedTrackParticles(flags) -> list[str]:
32 generateTrackCollections = ["InDetTrackParticles"]
33
34 # loop on tracking passes
35 scheduledTrackingPasses: list = extractTrackingPasses(flags)
36 for currentFlags in scheduledTrackingPasses:
37 # Add the seed tracks
38 if currentFlags.Tracking.ActiveConfig.storeTrackSeeds:
39 # pixel seeds
40 generatePixelSegments = currentFlags.Detector.EnablePixel
41 generateStripSegments = currentFlags.Detector.EnableStrip
42
43 if generatePixelSegments:
44 generateTrackCollections += [f'SiSPSeedSegments{currentFlags.Tracking.ActiveConfig.extension}PixelTrackParticles']
45 if generateStripSegments:
46 generateTrackCollections += [f'SiSPSeedSegments{currentFlags.Tracking.ActiveConfig.extension}StripTrackParticles']
47 if generatePixelSegments and generateStripSegments:
48 generateTrackCollections += [f'SiSPSeedSegments{currentFlags.Tracking.ActiveConfig.extension}TrackParticles']
49
50 # Add CKF tracks
51 if currentFlags.Tracking.ActiveConfig.storeSiSPSeededTracks:
52 generateTrackCollections += [f'SiSPSeededTracks{currentFlags.Tracking.ActiveConfig.extension}TrackParticles']
53
54 # Add tracks after ambi
55 # this is necessary only if ambiguity resolution is run and we
56 # store track particles in a separate container w.r.t InDetTrackParticles
57 if currentFlags.Acts.doAmbiguityResolution and currentFlags.Tracking.ActiveConfig.storeSeparateContainer:
58 generateTrackCollections += [f'InDet{currentFlags.Tracking.ActiveConfig.extension}TrackParticles']
59
60 print('Here is the list of generated track particle collections:')
61 for collection in generateTrackCollections:
62 print(f'- {collection}')
63
64 return generateTrackCollections
65

◆ isPrimaryPass()

bool isPrimaryPass ( flags)

Definition at line 5 of file ActsTrackRecoConfig.py.

5def isPrimaryPass(flags) -> bool:
6 if not flags.hasCategory("Tracking.ActiveConfig"):
7 return False
8 # Support for non ACTS passes, that do not respect the convention
9 # This comes from Athena legacy passes
10 if flags.Tracking.ActiveConfig.extension in ["", "HeavyIon"]:
11 return True
12
13 return f"{flags.Tracking.ActiveConfig.extension}" == flags.Tracking.PrimaryPassConfig.value
14