ATLAS Offline Software
Loading...
Searching...
No Matches
egammaTopoClusterCopierConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3""" Instantiate egammaTopoClusterCopier with default configuration
4"""
5
6from AthenaCommon.Logging import logging
7from AthenaConfiguration.ComponentFactory import CompFactory
8from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9
10
11def egammaTopoClusterCopierCfg(flags, name='', **kwargs):
12 acc = ComponentAccumulator()
13
14 kwargs.setdefault("InputTopoCollection",
15 flags.Egamma.Keys.Input.TopoClusters)
16 kwargs.setdefault("OutputTopoCollection",
17 flags.Egamma.Keys.Internal.EgammaTopoClusters)
18
19 if flags.Egamma.doForward:
20 kwargs.setdefault("OutputFwdTopoCollection",
21 flags.Egamma.Keys.Internal.ForwardTopoClusters)
22
23 kwargs.setdefault("ECut", 700 if not flags.Egamma.doLowMu else 300)
24
25 kwargs.setdefault('hasITk', flags.Detector.GeometryITk)
26
27 if name == '':
28 name = kwargs["OutputTopoCollection"]+'Copier'
29
30 egcopierAlg = CompFactory.egammaTopoClusterCopier(name, **kwargs)
31
32 acc.addEventAlgo(egcopierAlg)
33
34 return acc
35
36
37def indetTopoClusterCopierCfg(flags, name='', **kwargs):
38 """Create a copier to be used in tracking.
39 If 'OutputTopoCollection' is the same as used in
40 'egammaTopoClusterCopierCfg', these two functions will produce
41 the same tool that will be de-duplicated later, preventing
42 duplication of the output containers. This will happen in
43 a standard pp reconstruction.
44 If 'OutputTopoCollection' is not the same, two tools will be
45 created, each with a different output container. This will
46 happen in a HI reconstruction."""
47
48 kwargs.setdefault(
49 "InputTopoCollection",
50 flags.Tracking.TopoClusters)
51 kwargs.setdefault(
52 "OutputTopoCollection",
53 flags.Tracking.EgammaTopoClusters)
54
55 if name == '':
56 name = kwargs["OutputTopoCollection"]+'Copier'
57
58 return egammaTopoClusterCopierCfg(flags, name, **kwargs)
59
60
61if __name__ == "__main__":
62 from AthenaConfiguration.AllConfigFlags import initConfigFlags
63 from AthenaConfiguration.TestDefaults import defaultTestFiles
64 from AthenaConfiguration.ComponentAccumulator import printProperties
65 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
66 flags = initConfigFlags()
67 flags.Input.Files = defaultTestFiles.RDO_RUN2
68 flags.lock()
69 acc = MainServicesCfg(flags)
70 mlog = logging.getLogger("egammaTopoClusterCopierConfigTest")
71 mlog.info("Configuring egammaTopoClusterCopier: ")
72 acc.merge(egammaTopoClusterCopierCfg(flags))
73 printProperties(mlog,
74 acc.getEventAlgo("egammaTopoClustersCopier"),
75 nestLevel=1,
76 printDefaults=True)
77 with open("egammatopoclustercopier.pkl", "wb") as f:
78 acc.store(f)
indetTopoClusterCopierCfg(flags, name='', **kwargs)
egammaTopoClusterCopierCfg(flags, name='', **kwargs)