ATLAS Offline Software
egammaSelectedTrackCopyConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 __doc__ = "Instantiate egammaSelectedTrackCopy with default configuration"
4 
5 from AthenaCommon.Logging import logging
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 
9 
10 def egammaSelectedTrackCopyCfg(flags, name="egammaSelectedTrackCopy", **kwargs):
11  acc = ComponentAccumulator()
12 
13  if "egammaCaloClusterSelector" not in kwargs:
14  from egammaCaloTools.egammaCaloToolsConfig import (
15  egammaCaloClusterSelectorGSFCfg,
16  )
17 
18  kwargs["egammaCaloClusterSelector"] = acc.popToolsAndMerge(
20  )
21 
22  if "ExtrapolationTool" not in kwargs:
23  from egammaTrackTools.egammaTrackToolsConfig import (
24  EMExtrapolationToolsCfg,
25  )
26 
27  extraptool = EMExtrapolationToolsCfg(
28  flags, name="EMExtrapolationTools")
29  kwargs["ExtrapolationTool"] = acc.popToolsAndMerge(extraptool)
30 
31  kwargs.setdefault("ClusterContainerName",
32  flags.Egamma.Keys.Internal.EgammaTopoClusters)
33  kwargs.setdefault("TrackParticleContainerName",
34  flags.Egamma.Keys.Input.TrackParticles)
35  kwargs.setdefault("OutputTrkPartContainerName",
36  flags.Egamma.Keys.Output.TrkPartContainerName)
37 
38  if flags.Reco.EnableHGTDExtension:
39  kwargs.setdefault("TrackParticleTimeDecoration",
40  flags.Egamma.Keys.Input.TrackParticles+".time")
41 
42  doFwd = flags.Detector.GeometryITk and flags.Egamma.doForward
43  kwargs.setdefault("doFwdTracks", doFwd)
44  if doFwd:
45  kwargs.setdefault("FwdClusterContainerName",
46  flags.Egamma.Keys.Internal.ForwardTopoClusters)
47 
48  # P->T conversion extra dependencies
49  if flags.Detector.GeometryITk:
50  kwargs.setdefault(
51  "ExtraInputs",
52  [
53  (
54  "InDetDD::SiDetectorElementCollection",
55  "ConditionStore+ITkPixelDetectorElementCollection",
56  ),
57  (
58  "InDetDD::SiDetectorElementCollection",
59  "ConditionStore+ITkStripDetectorElementCollection",
60  ),
61  ],
62  )
63  else:
64  kwargs.setdefault(
65  "ExtraInputs",
66  [
67  (
68  "InDetDD::SiDetectorElementCollection",
69  "ConditionStore+PixelDetectorElementCollection",
70  ),
71  (
72  "InDetDD::SiDetectorElementCollection",
73  "ConditionStore+SCT_DetectorElementCollection",
74  ),
75  ],
76  )
77 
78  egseltrkcpAlg = CompFactory.egammaSelectedTrackCopy(name, **kwargs)
79 
80  acc.addEventAlgo(egseltrkcpAlg)
81  return acc
82 
83 
84 if __name__ == "__main__":
85  from AthenaConfiguration.AllConfigFlags import initConfigFlags
86  from AthenaConfiguration.TestDefaults import defaultTestFiles
87  from AthenaConfiguration.ComponentAccumulator import printProperties
88  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
89  flags = initConfigFlags()
90  flags.Input.Files = defaultTestFiles.RDO_RUN2
91  flags.lock()
92 
93  acc = MainServicesCfg(flags)
94  acc.merge(egammaSelectedTrackCopyCfg(flags))
95  mlog = logging.getLogger("egammaSelectedTrackCopyConfigTest")
96  mlog.info("Configuring egammaSelectedTrackCopy: ")
98  mlog,
99  acc.getEventAlgo("egammaSelectedTrackCopy"),
100  nestLevel=1,
101  printDefaults=True,
102  )
103  with open("egammaselectedtrackCopy.pkl", "wb") as f:
104  acc.store(f)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
egammaTrackToolsConfig.EMExtrapolationToolsCfg
def EMExtrapolationToolsCfg(flags, **kwargs)
Definition: egammaTrackToolsConfig.py:13
python.egammaCaloToolsConfig.egammaCaloClusterSelectorGSFCfg
def egammaCaloClusterSelectorGSFCfg(flags, name="caloClusterGSFSelector", **kwargs)
Definition: egammaCaloToolsConfig.py:36
extractSporadic.printProperties
def printProperties(h, q, hLB)
Definition: extractSporadic.py:8
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
egammaSelectedTrackCopyConfig.egammaSelectedTrackCopyCfg
def egammaSelectedTrackCopyCfg(flags, name="egammaSelectedTrackCopy", **kwargs)
Definition: egammaSelectedTrackCopyConfig.py:10