ATLAS Offline Software
egammaRecBuilderConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 __doc__ = """
4  Instantiate egammaRecBuilder with default configuration
5  """
6 
7 from AthenaCommon.Logging import logging
8 from AthenaConfiguration.ComponentFactory import CompFactory
9 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
10 from egammaTools.EMTrackMatchBuilderConfig import EMTrackMatchBuilderCfg
11 from egammaTools.EMConversionBuilderConfig import EMConversionBuilderCfg
12 
13 
15  flags,
16  name='egammaRecBuilder',
17  sequenceName = None,
18  **kwargs):
19 
20  seqkw = {'sequence': sequenceName} if sequenceName else {}
21  acc = ComponentAccumulator (**seqkw)
22 
23  kwargs.setdefault("doTrackMatching", flags.Egamma.doTracking)
24  kwargs.setdefault("doConversions", flags.Egamma.doConversionBuilding)
25 
26  if "TrackMatchBuilderTool" not in kwargs:
27  emtrkmatch = EMTrackMatchBuilderCfg(flags)
28  kwargs["TrackMatchBuilderTool"] = acc.popToolsAndMerge(emtrkmatch)
29 
30  if "ConversionBuilderTool" not in kwargs:
31  emcnv = EMConversionBuilderCfg(flags)
32  kwargs["ConversionBuilderTool"] = acc.popToolsAndMerge(emcnv)
33 
34  kwargs.setdefault(
35  "egammaRecContainer",
36  flags.Egamma.Keys.Internal.EgammaRecs)
37  kwargs.setdefault(
38  "InputClusterContainerName",
39  flags.Egamma.Keys.Internal.EgammaTopoClusters)
40 
41  egrecAlg = CompFactory.egammaRecBuilder(name, **kwargs)
42 
43  acc.addEventAlgo(egrecAlg)
44  return acc
45 
46 
47 if __name__ == "__main__":
48  from AthenaConfiguration.AllConfigFlags import initConfigFlags
49  from AthenaConfiguration.TestDefaults import defaultTestFiles
50  from AthenaConfiguration.ComponentAccumulator import printProperties
51  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
52  flags = initConfigFlags()
53  flags.Input.Files = defaultTestFiles.RDO_RUN2
54  flags.lock()
55 
56  acc = MainServicesCfg(flags)
57  acc.merge(egammaRecBuilderCfg(flags))
58  mlog = logging.getLogger("egammaRecBuilderConfigTest")
59  mlog.info("Configuring egammaRecBuilder: ")
60  printProperties(mlog,
61  acc.getEventAlgo("egammaRecBuilder"),
62  nestLevel=1,
63  printDefaults=True)
64  with open("egammarecbuilder.pkl", "wb") as f:
65  acc.store(f)
EMConversionBuilderConfig.EMConversionBuilderCfg
def EMConversionBuilderCfg(flags, name='EMConversionBuilder', **kwargs)
Definition: EMConversionBuilderConfig.py:11
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
EMTrackMatchBuilderConfig.EMTrackMatchBuilderCfg
def EMTrackMatchBuilderCfg(flags, name='EMTrackMatchBuilder', **kwargs)
Definition: EMTrackMatchBuilderConfig.py:13
extractSporadic.printProperties
def printProperties(h, q, hLB)
Definition: extractSporadic.py:8
Trk::open
@ open
Definition: BinningType.h:40
egammaRecBuilderConfig.egammaRecBuilderCfg
def egammaRecBuilderCfg(flags, name='egammaRecBuilder', sequenceName=None, **kwargs)
Definition: egammaRecBuilderConfig.py:14
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19