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