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