1 """Define methods to construct configured overlay copy algorithms
3 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
6 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory
import CompFactory
8 from AthenaConfiguration.Enums
import ProductionStep
12 """Return a ComponentAccumulator for the CaloCalibrationHitContainer copying"""
15 kwargs.setdefault(
"collectionName", collectionName)
16 kwargs.setdefault(
"SignalInputKey", flags.Overlay.SigPrefix + collectionName)
17 kwargs.setdefault(
"OutputKey", collectionName)
19 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
20 acc.merge(
SGInputLoaderCfg(flags, [f
'CaloCalibrationHitContainer#{kwargs["SignalInputKey"]}']))
23 acc.addEventAlgo(CompFactory.CopyCaloCalibrationHitContainer(name + collectionName, **kwargs))
26 from SGComps.AddressRemappingConfig
import AddressRemappingCfg
28 f
"CaloCalibrationHitContainer#{collectionName}->{flags.Overlay.SigPrefix}{collectionName}"
32 if flags.Output.doWriteRDO:
33 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
35 f
"CaloCalibrationHitContainer#{collectionName}"
39 if flags.Output.doWriteRDO_SGNL:
40 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
42 f
"CaloCalibrationHitContainer#{flags.Overlay.SigPrefix}{collectionName}"
49 """Return a ComponentAccumulator for the pile-up jets copying"""
52 if "OutputKey" not in kwargs
or "BkgInputKey" not in kwargs:
53 raise RuntimeError(
"'OutputKey' and 'BkgInputKey' need to be defined")
55 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
56 acc.merge(
SGInputLoaderCfg(flags, [f
'xAOD::JetContainer#{kwargs["BkgInputKey"]}']))
59 acc.addEventAlgo(CompFactory.CopyJetTruthInfo(name, **kwargs))
62 if flags.Output.doWriteRDO:
63 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
65 f
'xAOD::JetContainer#{kwargs["OutputKey"]}',
66 f
'xAOD::AuxContainerBase!#{kwargs["OutputKey"]}Aux.-constituentLinks.-constituentWeights',
73 """Return a ComponentAccumulator for the in-time pile-up jets copying"""
74 kwargs.setdefault(
"BkgInputKey", f
"{flags.Overlay.BkgPrefix}InTimeAntiKt4TruthJets")
75 kwargs.setdefault(
"OutputKey",
"InTimeAntiKt4TruthJets")
81 """Return a ComponentAccumulator for the out-of-time pile-up jets copying"""
82 kwargs.setdefault(
"BkgInputKey", f
"{flags.Overlay.BkgPrefix}OutOfTimeAntiKt4TruthJets")
83 kwargs.setdefault(
"OutputKey",
"OutOfTimeAntiKt4TruthJets")
89 """Return a ComponentAccumulator for the in-time pile-up jets copying"""
90 kwargs.setdefault(
"BkgInputKey", f
"{flags.Overlay.BkgPrefix}InTimeAntiKt6TruthJets")
91 kwargs.setdefault(
"OutputKey",
"InTimeAntiKt6TruthJets")
97 """Return a ComponentAccumulator for the out-of-time pile-up jets copying"""
98 kwargs.setdefault(
"BkgInputKey", f
"{flags.Overlay.BkgPrefix}OutOfTimeAntiKt6TruthJets")
99 kwargs.setdefault(
"OutputKey",
"OutOfTimeAntiKt6TruthJets")
105 """Return a ComponentAccumulator for the CopyJetTruthInfo algorithms"""
107 if flags.Overlay.DataOverlay:
110 allowedContainers = [
111 f
"{flags.Overlay.BkgPrefix}InTimeAntiKt4TruthJets",
112 f
"{flags.Overlay.BkgPrefix}OutOfTimeAntiKt4TruthJets",
113 f
"{flags.Overlay.BkgPrefix}InTimeAntiKt6TruthJets",
114 f
"{flags.Overlay.BkgPrefix}OutOfTimeAntiKt6TruthJets"
116 availableContainers = []
119 for container
in allowedContainers:
120 if container
in flags.Input.Collections:
121 availableContainers.append(container)
122 if allowedContainers[0]
in availableContainers:
124 if allowedContainers[1]
in availableContainers:
126 if allowedContainers[2]
in availableContainers:
128 if allowedContainers[3]
in availableContainers:
134 """Return a ComponentAccumulator for the in-time pile-up jets copying"""
136 if flags.Overlay.DataOverlay:
139 requiredContainer = f
"{flags.Overlay.BkgPrefix}TruthPileupParticles"
142 if requiredContainer
in flags.Input.Collections:
143 kwargs.setdefault(
"BkgInputKey", requiredContainer)
144 kwargs.setdefault(
"OutputKey",
"TruthPileupParticles")
146 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
147 acc.merge(
SGInputLoaderCfg(flags, [f
'xAOD::TruthParticleContainer#{kwargs["BkgInputKey"]}']))
150 acc.addEventAlgo(CompFactory.CopyPileupParticleTruthInfo(name, **kwargs))
152 if flags.Output.doWriteRDO:
153 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
155 "xAOD::TruthParticleContainer#TruthPileupParticles",
156 "xAOD::TruthParticleAuxContainer#TruthPileupParticlesAux."
162 """Return a ComponentAccumulator for the CopyMcEventCollection algorithm"""
165 kwargs.setdefault(
"RemoveBkgHardScatterTruth",
True)
168 if flags.Overlay.DataOverlay:
170 kwargs.setdefault(
"BkgInputKey",
"")
172 kwargs.setdefault(
"BkgInputKey", f
"{flags.Overlay.BkgPrefix}TruthEvent")
173 inputs.append(f
'McEventCollection#{kwargs["BkgInputKey"]}')
174 kwargs.setdefault(
"SignalInputKey", f
"{flags.Overlay.SigPrefix}TruthEvent")
175 inputs.append(f
'McEventCollection#{kwargs["SignalInputKey"]}')
177 if flags.Sim.DoFullChain
and flags.Common.isOverlay:
178 kwargs.setdefault(
"OutputKey",
"BeamTruthEvent")
180 kwargs.setdefault(
"OutputKey",
"TruthEvent")
182 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
186 acc.addEventAlgo(CompFactory.CopyMcEventCollection(name, **kwargs))
189 from SGComps.AddressRemappingConfig
import AddressRemappingCfg
191 f
"McEventCollection#TruthEvent->{flags.Overlay.SigPrefix}TruthEvent"
195 if flags.Output.doWriteRDO:
196 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
198 "McEventCollection#TruthEvent"
202 if flags.Output.doWriteRDO_SGNL:
203 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
205 f
"McEventCollection#{flags.Overlay.SigPrefix}TruthEvent"
212 """Return a ComponentAccumulator for the CopyPixelClusterContainer algorithm"""
215 kwargs.setdefault(
"InputKey",
"PixelClusters")
216 kwargs.setdefault(
"OutputKey", flags.Overlay.BkgPrefix+
"PixelClusters")
217 kwargs.setdefault(
"ExtraInputs", {(
'InDetDD::SiDetectorElementCollection',
'ConditionStore+PixelDetectorElementCollection')})
219 alg = CompFactory.CopyPixelClusterContainer(
"CopyPixelClusterContainer", **kwargs)
220 acc.addEventAlgo(alg)
225 """Return a ComponentAccumulator for the CopyPixelClusterContainer algorithm"""
228 kwargs.setdefault(
"InputKey",
"ITkPixelClusters")
229 kwargs.setdefault(
"OutputKey", flags.Overlay.BkgPrefix+
"ITkPixelClusters")
230 kwargs.setdefault(
"ExtraInputs", [(
'InDetDD::SiDetectorElementCollection',
'ConditionStore+ITkPixelDetectorElementCollection')])
232 alg = CompFactory.CopyPixelClusterContainer(
"CopyPixelClusterContainer", **kwargs)
233 acc.addEventAlgo(alg)
238 """Return a ComponentAccumulator for the CopySCT_ClusterContainer algorithm"""
241 kwargs.setdefault(
"InputKey",
"SCT_Clusters")
242 kwargs.setdefault(
"OutputKey", flags.Overlay.BkgPrefix+
"SCT_Clusters")
243 kwargs.setdefault(
"ExtraInputs", {(
'InDetDD::SiDetectorElementCollection',
'ConditionStore+SCT_DetectorElementCollection')})
245 alg = CompFactory.CopySCT_ClusterContainer(
"CopySCT_ClusterContainer", **kwargs)
246 acc.addEventAlgo(alg)
251 """Return a ComponentAccumulator for the CopySCT_ClusterContainer algorithm"""
254 kwargs.setdefault(
"InputKey",
"ITkStripClusters")
255 kwargs.setdefault(
"OutputKey", flags.Overlay.BkgPrefix+
"ITkStripClusters")
256 kwargs.setdefault(
"ExtraInputs", [(
'InDetDD::SiDetectorElementCollection',
'ConditionStore+ITkStripDetectorElementCollection')])
258 alg = CompFactory.CopySCT_ClusterContainer(
"CopySCT_ClusterContainer", **kwargs)
259 acc.addEventAlgo(alg)
264 """Return a ComponentAccumulator for the CopyTRT_DriftCircleContainer algorithm"""
267 kwargs.setdefault(
"InputKey",
"TRT_DriftCircles")
268 kwargs.setdefault(
"OutputKey", flags.Overlay.BkgPrefix+
"TRT_DriftCircles")
269 kwargs.setdefault(
"ExtraInputs", {(
'InDetDD::TRT_DetElementContainer' ,
'ConditionStore+TRT_DetElementContainer')})
271 alg = CompFactory.CopyTRT_DriftCircleContainer(
"CopyTRT_DriftCircleContainer", **kwargs)
272 acc.addEventAlgo(alg)
278 """Return a ComponentAccumulator for the TrackCollection copying"""
281 kwargs.setdefault(
"OutputKey", flags.Overlay.BkgPrefix + collectionName)
282 kwargs.setdefault(
"InputKey", collectionName)
284 if flags.Detector.GeometryPixel:
285 extra_inputs.add((
'InDetDD::SiDetectorElementCollection',
'ConditionStore+PixelDetectorElementCollection'))
286 if flags.Detector.GeometrySCT:
287 extra_inputs.add((
'InDetDD::SiDetectorElementCollection',
'ConditionStore+SCT_DetectorElementCollection'))
288 if flags.Detector.GeometryTRT:
289 extra_inputs.add((
'InDetDD::TRT_DetElementContainer' ,
'ConditionStore+TRT_DetElementContainer' ))
290 if flags.Detector.GeometryITkPixel:
291 extra_inputs.add((
'InDetDD::SiDetectorElementCollection' ,
'ConditionStore+ITkPixelDetectorElementCollection' ))
292 if flags.Detector.GeometryITkStrip:
293 extra_inputs.add((
'InDetDD::SiDetectorElementCollection' ,
'ConditionStore+ITkStripDetectorElementCollection' ))
295 kwargs.setdefault(
"ExtraInputs", extra_inputs)
297 alg = CompFactory.CopyTrackCollection(
"CopyTrackCollection"+collectionName, **kwargs)
298 acc.addEventAlgo(alg)
300 if flags.Output.doWriteRDO:
301 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
303 "TrackCollection#" + flags.Overlay.BkgPrefix+collectionName]))
309 """Return a ComponentAccumulator for the DetailedTrackTruthCollection copying"""
312 kwargs.setdefault(
"OutputKey", flags.Overlay.BkgPrefix + collectionName)
313 kwargs.setdefault(
"InputKey", collectionName)
315 alg = CompFactory.CopyDetailedTrackTruthCollection(
"CopyDetailedTrackTruthCollection"+collectionName)
316 acc.addEventAlgo(alg)
318 if flags.Output.doWriteRDO:
319 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
321 "DetailedTrackTruthCollection#" + flags.Overlay.BkgPrefix+collectionName
328 """Return a ComponentAccumulator for the PRD_MultiTruthCollection copying"""
331 kwargs.setdefault(
"OutputKey", flags.Overlay.BkgPrefix + collectionName)
332 kwargs.setdefault(
"InputKey", collectionName)
334 alg = CompFactory.CopyPRD_MultiTruthCollection(
"CopyPRD_MultiTruthCollection"+collectionName)
335 acc.addEventAlgo(alg)
337 if flags.Output.doWriteRDO:
338 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
340 "PRD_MultiTruthCollection#" + flags.Overlay.BkgPrefix+collectionName
347 """Return a ComponentAccumulator for the TrackRecordCollection copying"""
350 kwargs.setdefault(
"collectionName", collectionName)
351 kwargs.setdefault(
"SignalInputKey", flags.Overlay.SigPrefix + collectionName)
352 kwargs.setdefault(
"OutputKey", collectionName)
353 kwargs.setdefault(
"ExtraInputs", flags.Overlay.ExtraInputs)
355 if flags.Common.ProductionStep
is not ProductionStep.FastChain:
356 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
357 acc.merge(
SGInputLoaderCfg(flags, [f
'TrackRecordCollection#{kwargs["SignalInputKey"]}']))
360 from SGComps.AddressRemappingConfig
import AddressRemappingCfg
362 f
"TrackRecordCollection#{collectionName}->{flags.Overlay.SigPrefix}{collectionName}"
366 acc.addEventAlgo(CompFactory.CopyTrackRecordCollection(name + collectionName, **kwargs))
369 if flags.Output.doWriteRDO:
370 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
372 f
"TrackRecordCollection#{collectionName}"
376 if flags.Output.doWriteRDO_SGNL:
377 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
379 f
"TrackRecordCollection#{flags.Overlay.SigPrefix}{collectionName}"
386 """Return overlay configuration for the CopyCalibrationHitContainer algorithms"""
389 kwargs.setdefault(
"ExtraInputs", flags.Overlay.ExtraInputs)
391 allowedContainers = [
392 "LArCalibrationHitActive",
"LArCalibrationHitDeadMaterial",
"LArCalibrationHitInactive"
393 "TileCalibrationCellHitCnt",
"TileCalibrationDMHitCnt",
394 "TileCalibHitActiveCell",
"TileCalibHitInactiveCell",
"TileCalibHitDeadMaterial",
396 availableContainers = []
399 for container
in allowedContainers:
400 if (flags.Overlay.ByteStream
and container
in flags.Input.Collections) \
401 or (
not flags.Overlay.ByteStream
and container
in flags.Input.SecondaryCollections):
402 availableContainers.append(container)
404 for container
in availableContainers:
411 """Return overlay configuration for the CopyPixelClusterContainer algorithm"""
414 if flags.Output.doWriteRDO:
415 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
417 "InDet::PixelClusterContainer#Bkg_PixelClusters"
423 """Return overlay configuration for the CopyITkPixelClusterContainer algorithm"""
425 if flags.Output.doWriteRDO:
426 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
428 "InDet::PixelClusterContainer#Bkg_ITkPixelClusters"
434 """Return overlay configuration for the CopySCT_ClusterContainer algorithm"""
437 if flags.Output.doWriteRDO:
438 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
440 "InDet::SCT_ClusterContainer#Bkg_SCT_Clusters"
446 """Return overlay configuration for the CopySCT_ClusterContainer algorithm"""
449 if flags.Output.doWriteRDO:
450 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
452 "InDet::SCT_ClusterContainer#Bkg_ITkStripClusters"
458 """Return overlay configuration for the CopyTRT_DriftCircleContainer algorithm"""
461 if flags.Output.doWriteRDO:
462 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
464 "InDet::TRT_DriftCircleContainer#Bkg_TRT_DriftCircles"]))
470 """Return overlay configuration for the TrackRecordCollection algorithms"""
474 allowedContainers = [
479 availableContainers = []
482 if flags.Common.ProductionStep == ProductionStep.FastChain:
483 availableContainers = allowedContainers
485 hardScatterInputCollections = flags.Input.Collections
if flags.Overlay.ByteStream
else flags.Input.SecondaryCollections
486 for container
in allowedContainers:
487 if container
in hardScatterInputCollections:
488 availableContainers.append(container)
490 for container
in availableContainers:
497 """ Return overlay configuration for copying tracks"""
501 allowedContainers = [
502 "CombinedInDetTracks",
503 "DisappearingTracks",
504 "ResolvedForwardTracks",
505 "ExtendedLargeD0Tracks"
508 availableContainers = []
510 if flags.Common.ProductionStep == ProductionStep.FastChain:
511 availableContainers = allowedContainers
513 hardScatterInputCollections = flags.Input.Collections
514 for container
in allowedContainers:
515 if container
in hardScatterInputCollections:
516 availableContainers.append(container)
517 for container
in availableContainers:
523 """ Return overlay configuration for copying tracks"""
527 allowedContainers = [
529 "ResolvedConversionTracks"
531 availableContainers = []
533 if flags.Common.ProductionStep == ProductionStep.FastChain:
534 availableContainers = allowedContainers
536 hardScatterInputCollections = flags.Input.Collections
537 for container
in allowedContainers:
538 if container
in hardScatterInputCollections:
539 availableContainers.append(container)
540 for container
in availableContainers:
546 """ Return overlay configuration for copying detailed track truth"""
550 allowedContainers = [
551 "DisappearingTracksDetailedTruth",
552 "ResolvedForwardTracksDetailedTruth",
553 "CombinedInDetTracksDetailedTruth",
554 "ExtendedLargeD0TracksDetailedTruth"
557 availableContainers = []
560 if flags.Common.ProductionStep == ProductionStep.FastChain:
561 availableContainers = allowedContainers
563 hardScatterInputCollections = flags.Input.Collections
564 for container
in allowedContainers:
565 if container
in hardScatterInputCollections:
566 availableContainers.append(container)
568 for container
in availableContainers:
575 """ Return overlay configuration for copying detailed track truth"""
579 allowedContainers = [
581 "PRD_MultiTruthPixel",
585 availableContainers = []
588 if flags.Common.ProductionStep == ProductionStep.FastChain:
589 availableContainers = allowedContainers
591 hardScatterInputCollections = flags.Input.Collections
592 for container
in allowedContainers:
593 if container
in hardScatterInputCollections:
594 availableContainers.append(container)
596 for container
in availableContainers: