11def ITkActsDeviceTrackRecoCfg(flags, *, previousExtension=None):
12 acc = ComponentAccumulator()
13
14
15 print(f
"Setting up GPU algorithms with {flags.Device.Backend.value} backend")
16
17 acc.merge(DeviceDetectorDescriptionCondAlgCfg(flags))
18
19
20 if flags.Acts.Device.doClusterization:
21
22
23 if not flags.Tracking.doPixelDigitalClustering:
24 raise ValueError("clusterization on device is not compatible "
25 "with analog clustering at the moment due to incorrent "
26 "ToT values for Pixel hits in the simulation data.")
27
28
29 from ActsConfig.ActsRegionsOfInterestConfig import ActsRegionsOfInterestCreatorAlgCfg
30 acc.merge(ActsRegionsOfInterestCreatorAlgCfg(flags,
31 name=f"{flags.Tracking.ActiveConfig.extension}RegionsOfInterestCreatorAlg"))
32
33 print(
"Performing clusterization on device")
34
35
36 if flags.Acts.EDM.PhaseII :
37 from ActsConfig.ActsPhaseIIRawDataEdmConfig import (
38 PhaseIIPixelRawDataContainerCfg,
39 PhaseIIStripRawDataContainerCfg,
40 )
41 acc.merge(PhaseIIPixelRawDataContainerCfg(flags))
42 acc.merge(PhaseIIStripRawDataContainerCfg(flags))
43 from ActsGPUEventCnv.ActsGPUEventCnvConfig import PhaseIIRDOtoTracccCellConverterAlgCfg
44 acc.merge(PhaseIIRDOtoTracccCellConverterAlgCfg(flags,
45 TracccCells = "TracccCellCollection",
46 ))
47 else:
48 from ActsGPUEventCnv.ActsGPUEventCnvConfig import RDOtoTracccCellConverterAlgCfg
49 acc.merge(RDOtoTracccCellConverterAlgCfg(flags,
50 TracccCells = "TracccCellCollection",
51 ))
52
53
54 from ActsGPUDataPreparation.ActsGPUDataPreparationConfig import DeviceClusterizationAlgCfg
55 acc.merge(DeviceClusterizationAlgCfg(flags,
56 InputTracccCells="TracccCellCollection",
57 OutputTracccMeasurements="TracccMeasurementCollection",
58 OutputTracccClusters="TracccClusterCollection",
59 RetrieveClusterCells=flags.Tracking.doTruth,
60 previousExtension=previousExtension))
61 clustersLocation = DataLocation.DEVICE
62
63 else:
64 from InDetConfig.ITkActsDataPreparationConfig import ITkActsDataPreparationCfg
65 acc.merge(ITkActsDataPreparationCfg(flags, previousExtension=previousExtension))
66 clustersLocation = DataLocation.HOST
67
68
69 if flags.Acts.Device.doSeeding:
70
71 if clustersLocation is not DataLocation.DEVICE:
72 raise ValueError("Device seeding requires device clusterization "
73 "(flags.Acts.Device.doClusterization=True): it reads the "
74 "traccc measurement collection straight out of device memory "
75 "and there is currently no host->device measurement converter.")
76
77
78 from ActsGPUDataPreparation.ActsGPUDataPreparationConfig import DeviceSPFormationAlgCfg
79 acc.merge(DeviceSPFormationAlgCfg(flags,
80 name="DeviceSPFormationAlg",
81 InputTracccMeasurements="TracccMeasurementCollection",
82 OutputTracccPixelSpacepoints="TracccPixelSpacepointCollection"))
83
84 from ActsConfig.ActsConfigFlags import SeedingStrategy
85
86 print(f
"Performing seeding on device with seeding strategy set to {flags.Acts.Device.seedingStrategy}")
87 if flags.Acts.Device.seedingStrategy in [SeedingStrategy.Gbts, SeedingStrategy.GbtsFtf]:
88 from ActsGPUPatternRecognition.ActsGPUPatternRecognitionConfig import DeviceGBTSSeedingAlgCfg
89 acc.merge(DeviceGBTSSeedingAlgCfg(flags,
90 name="DeviceGBTSSeedingAlg",
91 InputTracccPixelSpacepoints="TracccPixelSpacepointCollection",
92 InputTracccMeasurements="TracccMeasurementCollection",
93 OutputTracccPixelSeeds="TracccPixelSeedCollection"))
94 else:
95 from ActsGPUPatternRecognition.ActsGPUPatternRecognitionConfig import DeviceTripletSeedingAlgCfg
96 acc.merge(DeviceTripletSeedingAlgCfg(flags,
97 name="DeviceTripletSeedingAlg",
98 InputTracccPixelSpacepoints="TracccPixelSpacepointCollection",
99 OutputTracccPixelSeeds="TracccPixelSeedCollection"))
100
101 seedsLocation = DataLocation.DEVICE
102
103 else:
104
105
106
107 if clustersLocation is DataLocation.DEVICE:
108 from ActsGPUEventCnv.ActsGPUEventCnvConfig import TracccMeasurementConverterAlgCfg
109 acc.merge(TracccMeasurementConverterAlgCfg(flags,
110 InputMeasurements="TracccMeasurementCollection",
111 InputClusters="TracccClusterCollection",
112 InputCells="TracccCellCollection",
113 ConvertClustersWithCells = flags.Tracking.doTruth,
114 OutputPixelSpacePoints="ITkPixelSpacePoints",
115 OutputPixelClusters="ITkPixelClusters",
116 OutputStripClusters="ITkStripClusters"
117 ))
118
119 from ActsConfig.ActsSpacePointFormationConfig import ActsStripSpacePointFormationAlgCfg
120 acc.merge(ActsStripSpacePointFormationAlgCfg(flags,
121 name=f"{flags.Tracking.ActiveConfig.extension}StripSpacePointFormationAlg",
122 StripClusters="ITkStripClusters",
123 StripSpacePoints="ITkStripSpacePoints",
124 StripOverlapSpacePoints="ITkStripOverlapSpacePoints"))
125
126 clustersLocation = DataLocation.HOST
127
128
129
130
131
132 if flags.Tracking.doTruth:
133 from ActsConfig.ActsTruthConfig import ActsTruthAssociationAlgCfg, ActsTruthParticleHitCountAlgCfg
134 acc.merge(ActsTruthAssociationAlgCfg(flags))
135 acc.merge(ActsTruthParticleHitCountAlgCfg(flags))
136
137 from ActsConfig.ActsSeedingConfig import ActsSeedingCfg
138 acc.merge(ActsSeedingCfg(flags))
139 seedsLocation = DataLocation.HOST
140
141
142
143 if flags.Acts.Device.doTrackReconstruction:
144
145 if clustersLocation is not DataLocation.DEVICE or seedsLocation is not DataLocation.DEVICE:
146 raise ValueError("Device track reconstruction requires device clusterization "
147 "(flags.Acts.Device.doClusterization=True) and device seeding "
148 "(flags.Acts.Device.doSeeding=True): it reads the traccc measurement "
149 "and seed collections straight out of device memory and there is "
150 "currently no host->device converter for these yet.")
151
152
153 from ActsGPUMagField.ActsGPUMagFieldConfig import JSONDeviceMagFieldProviderSvcCfg
154 acc.merge(JSONDeviceMagFieldProviderSvcCfg(flags,
155 DeviceMagFieldObjectName="TracccMagneticField",
156 HostMagFieldObjectName="TracccHostMagField",
157 ))
158
159 from ActsGPUPatternRecognition.ActsGPUPatternRecognitionConfig import DeviceTrkParamEstimationAlgCfg, DeviceTrackFindingAlgCfg
160 acc.merge(DeviceTrkParamEstimationAlgCfg(flags,
161 InputTracccSpacepoints="TracccPixelSpacepointCollection",
162 InputTracccMeasurements="TracccMeasurementCollection",
163 InputTracccSeeds="TracccPixelSeedCollection",
164 InputTracccMagField="TracccMagneticField",
165 OutputTracccTrackParameters="TracccTrackParameterCollection",
166 ))
167
168 acc.merge(DeviceTrackFindingAlgCfg(flags,
169 InputTracccMeasurements="TracccMeasurementCollection",
170 InputTracccMagField="TracccMagneticField",
171 InputTracccTrackParameters="TracccTrackParameterCollection",
172 InputTracccDetectorGeometry="TracccDeviceDetectorGeometry",
173 OutputTracccTracks="TracccTrackCollection",
174 ))
175
176 if clustersLocation is not DataLocation.DEVICE:
177 acc.merge(TracccMeasurementConverterAlgCfg(flags,
178 InputMeasurements="TracccMeasurementCollection",
179 InputClusters="TracccClusterCollection",
180 InputCells="TracccCellCollection",
181 ConvertClustersWithCells = flags.Tracking.doTruth,
182 OutputPixelClusters="ITkPixelClusters",
183 OutputPixelSpacePoints="ITkPixelSpacePoints",
184 OutputMeasToPixelSP="ITkTracccMeasToPixelSP",
185 OutputMeasToStripCl="ITkTracccMeasToStripCl",
186 OutputStripClusters="ITkStripClusters",
187 GeoIdMapping="TracccGeoIdMapping",
188 ))
189
190 from ActsGPUEventCnv.ActsGPUEventCnvConfig import TracccTrackConverterAlgCfg, TracccMeasurementConverterAlgCfg
191 if clustersLocation is DataLocation.DEVICE:
192 acc.merge(TracccMeasurementConverterAlgCfg(flags,
193 InputMeasurements="TracccMeasurementCollection",
194 InputClusters="TracccClusterCollection",
195 InputCells="TracccCellCollection",
196 ConvertClustersWithCells = flags.Tracking.doTruth,
197 OutputPixelClusters="ITkPixelClusters",
198 OutputPixelSpacePoints="ITkPixelSpacePoints",
199 OutputMeasToPixelSP="ITkTracccMeasToPixelSP",
200 OutputMeasToStripCl="ITkTracccMeasToStripCl",
201 OutputStripClusters="ITkStripClusters"
202 ))
203
204
205
206 if flags.Tracking.ActiveConfig.useITkStripSeeding or (flags.Acts.SpacePoints.doStrip and not flags.Tracking.ActiveConfig.isSecondaryPass):
207 from ActsConfig.ActsSpacePointFormationConfig import ActsStripSpacePointFormationAlgCfg
208 acc.merge(ActsStripSpacePointFormationAlgCfg(flags,
209 name=f"{flags.Tracking.ActiveConfig.extension}StripSpacePointFormationAlg",
210 StripClusters="ITkStripClusters",
211 StripSpacePoints="ITkStripSpacePoints",
212 StripOverlapSpacePoints="ITkStripOverlapSpacePoints"))
213
214 acc.merge(TracccTrackConverterAlgCfg(flags,
215 InputPixelClusters="ITkPixelClusters",
216 InputStripClusters="ITkStripClusters",
217 InputMeasToPixelSP="ITkTracccMeasToPixelSP",
218 InputMeasToStripCl="ITkTracccMeasToStripCl",
219 InputTracks="TracccTrackCollection",
220 OutputTracks=f"{flags.Tracking.ActiveConfig.extension}Tracks",
221 ))
222
223
224
225 else:
226
227
228 if clustersLocation is DataLocation.DEVICE:
229 from ActsGPUEventCnv.ActsGPUEventCnvConfig import TracccMeasurementConverterAlgCfg
230 acc.merge(TracccMeasurementConverterAlgCfg(flags,
231 InputMeasurements="TracccMeasurementCollection",
232 InputClusters="TracccClusterCollection",
233 InputCells="TracccCellCollection",
234 ConvertClustersWithCells = flags.Tracking.doTruth,
235 OutputPixelClusters="ITkPixelClusters",
236 OutputPixelSpacePoints="ITkPixelSpacePoints",
237 OutputMeasToPixelSP="ITkTracccMeasToPixelSP",
238 OutputMeasToStripCl="ITkTracccMeasToStripCl",
239 OutputStripClusters="ITkStripClusters"
240 ))
241 from ActsConfig.ActsSpacePointFormationConfig import ActsStripSpacePointFormationAlgCfg
242 acc.merge(ActsStripSpacePointFormationAlgCfg(flags,
243 name=f"{flags.Tracking.ActiveConfig.extension}StripSpacePointFormationAlg",
244 StripClusters="ITkStripClusters",
245 StripSpacePoints="ITkStripSpacePoints",
246 StripOverlapSpacePoints="ITkStripOverlapSpacePoints"))
247 clustersLocation = DataLocation.HOST
248
249 if seedsLocation is DataLocation.DEVICE:
250 from ActsGPUEventCnv.ActsGPUEventCnvConfig import TracccSeedConverterAlgCfg
251
252 acc.merge(TracccSeedConverterAlgCfg(flags,
253 name="TracccSeedConverterAlg",
254 InputSpacepointsDevice="TracccPixelSpacepointCollection",
255 InputSpacepoints="ITkPixelSpacePoints",
256 InputMeasToPixelSP="ITkTracccMeasToPixelSP",
257 InputSeeds="TracccPixelSeedCollection",
258 OutputSeeds=f'{flags.Tracking.ActiveConfig.extension}PixelSeeds'))
259 seedsLocation = DataLocation.HOST
260
261
262 from ActsConfig.ActsTrackFindingConfig import ActsTrackFindingCfg
263 acc.merge(ActsTrackFindingCfg(flags))
264
265
266 if flags.Acts.doAmbiguityResolution:
267 from ActsConfig.ActsTrackFindingConfig import ActsAmbiguityResolutionCfg
268 acc.merge(ActsAmbiguityResolutionCfg(flags))
269
270
271
272 from ActsConfig.ActsPrdAssociationConfig import ActsPrdAssociationAlgCfg
273 acc.merge(ActsPrdAssociationAlgCfg(flags,
274 name = f'{flags.Tracking.ActiveConfig.extension}PrdAssociationAlg',
275 previousActsExtension = previousExtension))
276
277
278 if flags.Tracking.doTruth:
279
280
281 from ActsConfig.ActsTruthConfig import ActsTruthAssociationAlgCfg, ActsTruthParticleHitCountAlgCfg
282 acc.merge(ActsTruthAssociationAlgCfg(flags))
283 acc.merge(ActsTruthParticleHitCountAlgCfg(flags))
284 if flags.Acts.doTruthInspection:
285 from ActsConfig.ActsInspectTruthContentConfig import ActsInspectTruthContentAlgCfg
286 acc.merge(ActsInspectTruthContentAlgCfg(flags))
287
288
289
290
291
292 if flags.Tracking.ActiveConfig.storeSiSPSeededTracks or not flags.Acts.doAmbiguityResolution:
293 from ActsConfig.ActsTruthConfig import ActsTrackToTruthAssociationAlgCfg, ActsTrackFindingValidationAlgCfg
294 acts_tracks = f"{flags.Tracking.ActiveConfig.extension}Tracks"
295 acc.merge(ActsTrackToTruthAssociationAlgCfg(flags,
296 name = f"{acts_tracks}TrackToTruthAssociationAlg",
297 ACTSTracksLocation = acts_tracks,
298 AssociationMapOut = f"{acts_tracks}ToTruthParticleAssociation"))
299
300 acc.merge(ActsTrackFindingValidationAlgCfg(flags,
301 name = f"{acts_tracks}TrackFindingValidationAlg",
302 TrackToTruthAssociationMap = f"{acts_tracks}ToTruthParticleAssociation"))
303
304
305
306 if flags.Acts.doAmbiguityResolution:
307 acts_tracks = f"{flags.Tracking.ActiveConfig.extension}ResolvedTracks"
308 from ActsConfig.ActsTruthConfig import ActsTrackToTruthAssociationAlgCfg, ActsTrackFindingValidationAlgCfg
309 acc.merge(ActsTrackToTruthAssociationAlgCfg(flags,
310 name = f"{acts_tracks}TrackToTruthAssociationAlg",
311 ACTSTracksLocation = acts_tracks,
312 AssociationMapOut = f"{acts_tracks}ToTruthParticleAssociation"))
313
314 acc.merge(ActsTrackFindingValidationAlgCfg(flags,
315 name = f"{acts_tracks}TrackFindingValidationAlg",
316 TrackToTruthAssociationMap = f"{acts_tracks}ToTruthParticleAssociation"))
317
318
319 if flags.Tracking.ActiveConfig.storeTrackSeeds and flags.Acts.Device.doSeeding:
320 from ActsConfig.ActsSeedingConfig import ActsStoreTrackSeedsCfg
321 from ActsConfig.ActsAnalysisConfig import ActsPixelSeedsToTrackParamsAlgCfg, ActsStripSeedsToTrackParamsAlgCfg
322 processPixels = flags.Tracking.ActiveConfig.useITkPixelSeeding
323 processStrips = flags.Tracking.ActiveConfig.useITkStripSeeding
324
325 prefix = flags.Tracking.ActiveConfig.extension
326
327 if flags.Acts.Device.doTrackReconstruction:
328 from ActsGPUEventCnv.ActsGPUEventCnvConfig import TracccSeedConverterAlgCfg
329 acc.merge(TracccSeedConverterAlgCfg(flags,
330 name="TracccSeedConverterAlg",
331 InputSpacepointsDevice="TracccPixelSpacepointCollection",
332 InputSpacepoints="ITkPixelSpacePoints",
333 InputMeasToPixelSP="ITkTracccMeasToPixelSP",
334 InputSeeds="TracccPixelSeedCollection",
335 OutputSeeds=f'{flags.Tracking.ActiveConfig.extension}PixelSeeds'))
336
337
338 if processPixels:
339 acc.merge(ActsPixelSeedsToTrackParamsAlgCfg(
340 flags,
341 name = prefix + 'PixelSeedsToTrackParamsAlg',
342 InputSeedContainerKey = prefix + 'PixelSeeds',
343 OutputTrackParamsCollectionKey = prefix + 'PixelEstimatedTrackParams'))
344 if processStrips:
345 acc.merge(ActsStripSeedsToTrackParamsAlgCfg(
346 flags,
347 name = prefix + 'StripSeedsToTrackParamsAlg',
348 InputSeedContainerKey = prefix + 'StripSeeds',
349 OutputTrackParamsCollectionKey = prefix + 'StripEstimatedTrackParams'))
350
351 if processPixels:
352 acc.merge(ActsStoreTrackSeedsCfg(flags,processPixels=True, processStrips=False))
353 if processStrips:
354 acc.merge(ActsStoreTrackSeedsCfg(flags,processPixels=False, processStrips=True))
355 if processPixels and processStrips:
356 acc.merge(ActsStoreTrackSeedsCfg(flags,processPixels=True, processStrips=True))
357
358 return acc
359
360