ATLAS Offline Software
InDetTrackOutputConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 
5 # these are used internally by the FTAG software. We generally don't
6 # want to save them since they can be reconstructed by rerunning
7 # flavor tagging.
8 FTAG_AUXDATA = [
9  'VxTrackAtVertex',
10  'TrackCompatibility',
11  'JetFitter_TrackCompatibility_antikt4emtopo',
12  'JetFitter_TrackCompatibility_antikt4empflow',
13  'btagIp_d0Uncertainty',
14  'btagIp_z0SinThetaUncertainty',
15  'btagIp_z0SinTheta',
16  'btagIp_d0',
17  'btagIp_trackMomentum',
18  'btagIp_trackDisplacement',
19  'btagIp_invalidIp',
20 ]
21 
22 
23 def InDetTrackRecoOutputCfg(flags, extensions_list=None):
24  if extensions_list is None:
25  extensions_list = []
26 
27  from OutputStreamAthenaPool.OutputStreamConfig import addToESD, addToAOD
28  toAOD = []
29  toESD = []
30 
31  # excluded track aux data
32  excludedAuxData = ('-clusterAssociation.-TTVA_AMVFVertices_forReco.-AssoClustersUFO'
33  '.-TTVA_AMVFWeights_forReco')
34  # remove track decorations used internally by FTAG software
35  excludedAuxData += '.-'.join([''] + FTAG_AUXDATA)
36  excludedAuxData += ('.-trackParameterCovarianceMatrices'
37  '.-parameterX.-parameterY.-parameterZ'
38  '.-parameterPX.-parameterPY.-parameterPZ'
39  '.-parameterPosition')
40 
41  # exclude TTVA decorations
42  excludedAuxData += '.-TTVA_AMVFVertices.-TTVA_AMVFWeights'
43 
44  # exclude IDTIDE decorations
45  from DerivationFrameworkInDet.IDTIDE import IDTIDE_AOD_EXCLUDED_AUXDATA
46  excludedAuxData += '.-'.join([''] + IDTIDE_AOD_EXCLUDED_AUXDATA)
47  from DerivationFrameworkInDet.IDTRKVALID import IDTRKVALID_AOD_EXCLUDED_AUXDATA
48  excludedAuxData += '.-'.join([''] + IDTRKVALID_AOD_EXCLUDED_AUXDATA)
49 
50  if not (flags.Tracking.writeExtendedSi_PRDInfo or
51  flags.Tracking.writeExtendedTRT_PRDInfo):
52  excludedAuxData += '.-msosLink'
53 
54 
57  toESD += [
58  "BCM_RDO_Container#BCM_RDOs",
59  "BCM_RDO_Container#BCM_CompactDOs",
60  ]
61 
62  # write phase calculation into ESD
63  if flags.InDet.doTRTPhase:
64  toESD += ["ComTime#TRT_Phase"]
65 
66  # Save PRD
67  toESD += [
68  "InDet::SCT_ClusterContainer#SCT_Clusters",
69  "InDet::PixelClusterContainer#PixelClusters",
70  "InDet::TRT_DriftCircleContainer#TRT_DriftCircles",
71  "InDet::PixelGangedClusterAmbiguities#PixelClusterAmbiguitiesMap",
72  ]
73  if flags.Tracking.doPixelClusterSplitting:
74  toESD += [
75  "InDet::PixelGangedClusterAmbiguities#SplitClusterAmbiguityMap"]
76  toESD += ["IDCInDetBSErrContainer#SCT_FlaggedCondData"]
77 
78  from InDetConfig.TrackRecoConfig import ClusterSplitProbabilityContainerName
79  toESD += ["Trk::ClusterSplitProbabilityContainer#" +
81 
82  # add tracks
83  if flags.Tracking.doStoreTrackSeeds:
84  listOfExtensionsRequesting = [
85  e for e in extensions_list
86  if (e == '' or flags.Tracking[f"{e}Pass"].storeTrackSeeds) ]
87  for extension in listOfExtensionsRequesting:
88  toESD += ["TrackCollection#SiSPSeedSegments"+extension]
89 
90  if flags.Tracking.doTrackSegmentsPixel:
91  toESD += ["TrackCollection#ResolvedPixelTracks"]
92  if flags.Tracking.doTruth:
93  toESD += [
94  "TrackTruthCollection#ResolvedPixelTracksTruthCollection",
95  "DetailedTrackTruthCollection#ResolvedPixelTracksDetailedTruth"]
96 
97  if flags.Tracking.doTrackSegmentsSCT:
98  toESD += ["TrackCollection#ResolvedSCTTracks"]
99  if flags.Tracking.doTruth:
100  toESD += [
101  "TrackTruthCollection#ResolvedSCTTracksTruthCollection",
102  "DetailedTrackTruthCollection#ResolvedSCTTracksDetailedTruth"]
103 
104  if flags.Tracking.doTrackSegmentsTRT:
105  toESD += ["TrackCollection#StandaloneTRTTracks"]
106  if flags.Tracking.doTruth:
107  toESD += [
108  "TrackTruthCollection#StandaloneTRTTracksTruthCollection",
109  "DetailedTrackTruthCollection#StandaloneTRTTracksDetailedTruth"]
110 
111  if flags.Tracking.doPseudoTracking:
112  toESD += ["TrackCollection#InDetPseudoTracks"]
113  if flags.Tracking.doTruth:
114  toESD += [
115  "TrackTruthCollection#InDetPseudoTracksTruthCollection",
116  "DetailedTrackTruthCollection#InDetPseudoTracksDetailedTruth"]
117 
118  if flags.Tracking.doTIDE_AmbiTrackMonitoring:
119  toESD += ["TrackCollection#ObservedTracksCollection"]
120 
121  # add the forward tracks for combined muon reconstruction
122  if flags.Tracking.doForwardTracks:
123  toESD += ["TrackCollection#ResolvedForwardTracks"]
124  if flags.Tracking.doTruth:
125  toESD += [
126  "TrackTruthCollection#ResolvedForwardTracksTruthCollection",
127  "DetailedTrackTruthCollection#ResolvedForwardTracksDetailedTruth"]
128 
129  if flags.Tracking.doTrackSegmentsDisappearing:
130  toESD += ["TrackCollection#DisappearingTracks"]
131  if flags.Tracking.doTruth:
132  toESD += [
133  "TrackTruthCollection#DisappearingTracksTruthCollection",
134  "DetailedTrackTruthCollection#DisappearingTracksDetailedTruth"]
135 
136  if flags.Tracking.doLowPtRoI:
137  toESD += ["xAOD::VertexContainer#RoIVerticesLowPtRoI",
138  "xAOD::VertexAuxContainer#RoIVerticesLowPtRoIAux."]
139  if flags.Tracking.LowPtRoIPass.storeSeparateContainer:
140  toESD += ["TrackCollection#ExtendedLowPtRoITracks"]
141  if flags.Tracking.doTruth:
142  toESD += [
143  "TrackTruthCollection#ExtendedLowPtRoITracksTruthCollection",
144  "DetailedTrackTruthCollection#ExtendedLowPtRoITracksDetailedTruth"]
145 
146  # Save (Detailed) Track Truth
147  if flags.Tracking.doTruth:
148  toESD += [
149  "TrackTruthCollection#CombinedInDetTracksTruthCollection",
150  "DetailedTrackTruthCollection#CombinedInDetTracksDetailedTruth"]
151 
152  # save PRD MultiTruth
153  toESD += [
154  "PRD_MultiTruthCollection#PRD_MultiTruthPixel",
155  "PRD_MultiTruthCollection#PRD_MultiTruthSCT",
156  "PRD_MultiTruthCollection#PRD_MultiTruthTRT",
157  ]
158 
159  if not flags.Input.isMC:
160  toESD += [
161  "InDetBSErrContainer#PixelByteStreamErrs",
162  "TRT_BSErrContainer#TRT_ByteStreamErrs",
163  "TRT_BSIdErrContainer#TRT_ByteStreamIdErrs",
164  "IDCInDetBSErrContainer#SCT_ByteStreamErrs",
165  ]
166 
167  toESD += ["TrackCollection#CombinedInDetTracks"]
168 
169 
170  toAOD += [
171  "xAOD::TrackParticleContainer#InDetTrackParticles",
172  f"xAOD::TrackParticleAuxContainer#InDetTrackParticlesAux.{excludedAuxData}",
173  "xAOD::TrackParticleContainer#InDetForwardTrackParticles",
174  f"xAOD::TrackParticleAuxContainer#InDetForwardTrackParticlesAux.{excludedAuxData}",
175  "xAOD::TrackParticleContainer#InDetLargeD0TrackParticles",
176  f"xAOD::TrackParticleAuxContainer#InDetLargeD0TrackParticlesAux.{excludedAuxData}"
177  ]
178 
179  if flags.Tracking.doTrackSegmentsDisappearing:
180  toAOD += [
181  "xAOD::TrackParticleContainer#InDetDisappearingTrackParticles",
182  f"xAOD::TrackParticleAuxContainer#InDetDisappearingTrackParticlesAux.{excludedAuxData}"]
183  if flags.Tracking.doLowPtRoI:
184  toAOD += ["xAOD::VertexContainer#RoIVerticesLowPtRoI",
185  "xAOD::VertexAuxContainer#RoIVerticesLowPtRoIAux."]
186  if flags.Tracking.LowPtRoIPass.storeSeparateContainer:
187  toAOD += [
188  "xAOD::TrackParticleContainer#InDetLowPtRoITrackParticles",
189  f"xAOD::TrackParticleAuxContainer#InDetLowPtRoITrackParticlesAux.{excludedAuxData}"]
190 
191  if flags.Tracking.doTrackSegmentsPixel:
192  toAOD += [
193  "xAOD::TrackParticleContainer#InDetPixelTrackParticles",
194  f"xAOD::TrackParticleAuxContainer#InDetPixelTrackParticlesAux.{excludedAuxData}"]
195  if flags.Tracking.doTrackSegmentsSCT:
196  toAOD += [
197  "xAOD::TrackParticleContainer#InDetSCTTrackParticles",
198  f"xAOD::TrackParticleAuxContainer#InDetSCTTrackParticlesAux.{excludedAuxData}"]
199  if flags.Tracking.doTrackSegmentsTRT:
200  toAOD += [
201  "xAOD::TrackParticleContainer#InDetTRTTrackParticles",
202  f"xAOD::TrackParticleAuxContainer#InDetTRTTrackParticlesAux.{excludedAuxData}"]
203 
204  if flags.Tracking.doPseudoTracking:
205  toAOD += [
206  "xAOD::TrackParticleContainer#InDetPseudoTrackParticles",
207  f"xAOD::TrackParticleAuxContainer#InDetPseudoTrackParticlesAux.{excludedAuxData}"]
208  if flags.Tracking.doTruth:
209  toAOD += [
210  "TrackTruthCollection#InDetPseudoTrackTruthCollection",
211  "DetailedTrackTruthCollection#InDetPseudoTrackDetailedTruth"]
212 
213  if flags.Tracking.doTIDE_AmbiTrackMonitoring:
214  toAOD += [
215  "xAOD::TrackParticleContainer#InDetObservedTrackParticles",
216  f"xAOD::TrackParticleAuxContainer#InDetObservedTrackParticlesAux.{excludedAuxData}"]
217  if flags.Tracking.doTruth:
218  toAOD += [
219  "TrackTruthCollection#InDetObservedTrackTruthCollection",
220  "DetailedTrackTruthCollection#ObservedDetailedTracksTruth"]
221 
222  if flags.Tracking.doStoreSiSPSeededTracks:
223  # get list of extensions requesting track candidates.
224  # Add always the Primary Pass.
225  listOfExtensionsRequesting = [
226  e for e in extensions_list
227  if (e == '' or
228  flags.Tracking[f"{e}Pass"].storeSiSPSeededTracks) ]
229  for extension in listOfExtensionsRequesting:
230  toAOD += [
231  f"xAOD::TrackParticleContainer#SiSPSeededTracks{extension}TrackParticles",
232  f"xAOD::TrackParticleAuxContainer#SiSPSeededTracks{extension}TrackParticlesAux.{excludedAuxData}"
233  ]
234 
235  if flags.Tracking.doStoreTrackSeeds:
236  # get list of extensions requesting track seeds. Add always the Primary Pass.
237  listOfExtensionsRequesting = [
238  e for e in extensions_list
239  if (e == '' or flags.Tracking[f"{e}Pass"].storeTrackSeeds) ]
240  for extension in listOfExtensionsRequesting:
241  toAOD += [
242  f"xAOD::TrackParticleContainer#SiSPSeedSegments{extension}TrackParticles",
243  f"xAOD::TrackParticleAuxContainer#SiSPSeedSegments{extension}TrackParticlesAux."
244  ]
245 
246  if (flags.Tracking.writeExtendedSi_PRDInfo or
247  flags.Tracking.writeExtendedTRT_PRDInfo):
248  if (flags.Tracking.writeExtendedSi_PRDInfo):
249  toAOD += [
250  "xAOD::TrackMeasurementValidationContainer#PixelClusters",
251  "xAOD::TrackMeasurementValidationAuxContainer#PixelClustersAux.",
252  "xAOD::TrackMeasurementValidationContainer#SCT_Clusters",
253  "xAOD::TrackMeasurementValidationAuxContainer#SCT_ClustersAux."
254  ]
255  if (flags.Tracking.writeExtendedTRT_PRDInfo):
256  toAOD += [
257  "xAOD::TrackMeasurementValidationContainer#TRT_DriftCircles",
258  "xAOD::TrackMeasurementValidationAuxContainer#TRT_DriftCirclesAux."
259  ]
260  # get list of extensions requesting track seeds. Add always the Primary Pass.
261  listOfExtensionsRequesting = [
262  e for e in extensions_list
263  if (e == '' or flags.Tracking[f"{e}Pass"].storeTrackSeeds) ]
264  for extension in listOfExtensionsRequesting:
265  if (flags.Tracking.writeExtendedSi_PRDInfo):
266  toAOD += [
267  f"xAOD::TrackStateValidationContainer#{extension}PixelMSOSs",
268  f"xAOD::TrackStateValidationAuxContainer#{extension}PixelMSOSsAux.",
269  f"xAOD::TrackStateValidationContainer#{extension}SCT_MSOSs",
270  f"xAOD::TrackStateValidationAuxContainer#{extension}SCT_MSOSsAux."
271  ]
272  if (flags.Tracking.writeExtendedTRT_PRDInfo):
273  toAOD += [
274  f"xAOD::TrackStateValidationContainer#{extension}TRT_MSOSs",
275  f"xAOD::TrackStateValidationAuxContainer#{extension}TRT_MSOSsAux."
276  ]
277  if flags.Tracking.doStoreTrackSeeds:
278  if (flags.Tracking.writeExtendedSi_PRDInfo):
279  toAOD += [
280  f"xAOD::TrackStateValidationContainer#SiSPSeedSegments{extension}_PixelMSOSs",
281  f"xAOD::TrackStateValidationAuxContainer#SiSPSeedSegments{extension}_PixelMSOSsAux.",
282  f"xAOD::TrackStateValidationContainer#SiSPSeedSegments{extension}_SCT_MSOSs",
283  f"xAOD::TrackStateValidationAuxContainer#SiSPSeedSegments{extension}_SCT_MSOSsAux."
284  ]
285 
286  # same logic as above, but now for track candidates (SiSPSeededTracks)
287  # get list of extensions requesting track candidates. Always add the primary pass
288  if flags.Tracking.doStoreSiSPSeededTracks:
289  listOfExtensionsRequesting = [
290  e for e in extensions_list
291  if (e == '' or flags.Tracking[f"{e}Pass"].storeSiSPSeededTracks) ]
292  for extension in listOfExtensionsRequesting:
293  if (flags.Tracking.writeExtendedSi_PRDInfo):
294  toAOD += [
295  f"xAOD::TrackStateValidationContainer#SiSP{extension}_PixelMSOSs",
296  f"xAOD::TrackStateValidationAuxContainer#SiSP{extension}_PixelMSOSsAux.",
297  f"xAOD::TrackStateValidationContainer#SiSP{extension}_SCT_MSOSs",
298  f"xAOD::TrackStateValidationAuxContainer#SiSP{extension}_SCT_MSOSsAux."
299  ]
300  if (flags.Tracking.writeExtendedTRT_PRDInfo):
301  toAOD += [
302  f"xAOD::TrackStateValidationContainer#SiSP{extension}_TRT_MSOSs",
303  f"xAOD::TrackStateValidationAuxContainer#SiSP{extension}_TRT_MSOSsAux."
304  ]
305 
306  # for final tracks, only require that output requested to be stored in separate container
307  listOfExtensionsRequesting = [
308  e for e in extensions_list
309  if (e == '' or flags.Tracking[f"{e}Pass"].storeSeparateContainer) ]
310  for extension in listOfExtensionsRequesting:
311  if (flags.Tracking.writeExtendedSi_PRDInfo):
312  toAOD += [
313  f"xAOD::TrackStateValidationContainer#{extension}PixelMSOSs",
314  f"xAOD::TrackStateValidationAuxContainer#{extension}PixelMSOSsAux.",
315  f"xAOD::TrackStateValidationContainer#{extension}SCT_MSOSs",
316  f"xAOD::TrackStateValidationAuxContainer#{extension}SCT_MSOSsAux."
317  ]
318  if (flags.Tracking.writeExtendedTRT_PRDInfo):
319  toAOD += [
320  f"xAOD::TrackStateValidationContainer#{extension}TRT_MSOSs",
321  f"xAOD::TrackStateValidationAuxContainer#{extension}TRT_MSOSsAux."
322  ]
323 
324  if flags.Tracking.doTIDE_AmbiTrackMonitoring:
325  if (flags.Tracking.writeExtendedSi_PRDInfo):
326  toAOD += [
327  "xAOD::TrackStateValidationContainer#ObservedTrack_PixelMSOSs",
328  "xAOD::TrackStateValidationAuxContainer#ObservedTrack_PixelMSOSsAux.",
329  "xAOD::TrackStateValidationContainer#ObservedTrack_SCT_MSOSs",
330  "xAOD::TrackStateValidationAuxContainer#ObservedTrack_SCT_MSOSsAux."
331  ]
332  if (flags.Tracking.writeExtendedTRT_PRDInfo):
333  toAOD += [
334  "xAOD::TrackStateValidationContainer#ObservedTrack_TRT_MSOSs",
335  "xAOD::TrackStateValidationAuxContainer#ObservedTrack_TRT_MSOSsAux."
336  ]
337 
338  if flags.Tracking.doPseudoTracking:
339  if (flags.Tracking.writeExtendedSi_PRDInfo):
340  toAOD += [
341  "xAOD::TrackStateValidationContainer#Pseudo_PixelMSOSs",
342  "xAOD::TrackStateValidationAuxContainer#Pseudo_PixelMSOSsAux.",
343  "xAOD::TrackStateValidationContainer#Pseudo_SCT_MSOSs",
344  "xAOD::TrackStateValidationAuxContainer#Pseudo_SCT_MSOSsAux."
345  ]
346  if (flags.Tracking.writeExtendedTRT_PRDInfo):
347  toAOD += [
348  "xAOD::TrackStateValidationContainer#Pseudo_TRT_MSOSs",
349  "xAOD::TrackStateValidationAuxContainer#Pseudo_TRT_MSOSsAux."
350  ]
351 
352  if flags.Tracking.doV0Finder:
353  excludedVtxAuxData = "-vxTrackAtVertex.-MvfFitInfo.-isInitialized.-VTAV"
354  V0Vertices = ["V0UnconstrVertices", "V0KshortVertices",
355  "V0LambdaVertices", "V0LambdabarVertices"]
356  for v0 in V0Vertices:
357  toAOD += [
358  f"xAOD::VertexContainer#{v0}",
359  f"xAOD::VertexAuxContainer#{v0}Aux.{excludedVtxAuxData}",
360  ]
361 
362  result = ComponentAccumulator()
363  result.merge(addToESD(flags, toESD + toAOD))
364  result.merge(addToAOD(flags, toAOD))
365 
366  return result
367 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TrackRecoConfig.ClusterSplitProbabilityContainerName
def ClusterSplitProbabilityContainerName(flags)
Definition: TrackRecoConfig.py:86
python.OutputStreamConfig.addToESD
def addToESD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:127
python.InDetTrackOutputConfig.InDetTrackRecoOutputCfg
def InDetTrackRecoOutputCfg(flags, extensions_list=None)
Definition: InDetTrackOutputConfig.py:23
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.OutputStreamConfig.addToAOD
def addToAOD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:142