ATLAS Offline Software
EMConversionBuilderConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 __doc__ = "Configure Conversion building"
4 
5 from AthenaCommon.Logging import logging
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from egammaTrackTools.egammaTrackToolsConfig import EMExtrapolationToolsCfg
9 
10 
11 def EMConversionBuilderCfg(flags, name='EMConversionBuilder', **kwargs):
12 
13  mlog = logging.getLogger(name)
14  mlog.debug('Start configuration')
15 
16  acc = ComponentAccumulator()
17  EMConversionBuilder = CompFactory.EMConversionBuilder
18 
19  if "ExtrapolationTool" not in kwargs:
20  kwargs["ExtrapolationTool"] = acc.popToolsAndMerge(
22  )
23 
24  kwargs.setdefault("ConversionContainerName",
25  flags.Egamma.Keys.Output.ConversionVertices)
26 
27  emconv = EMConversionBuilder(name, **kwargs)
28 
29  acc.setPrivateTools(emconv)
30  return acc
31 
32 
33 if __name__ == "__main__":
34 
35  from AthenaConfiguration.AllConfigFlags import initConfigFlags
36  from AthenaConfiguration.ComponentAccumulator import printProperties
37  from AthenaConfiguration.TestDefaults import defaultTestFiles
38  flags = initConfigFlags()
39  flags.Input.Files = defaultTestFiles.RDO_RUN2
40  flags.fillFromArgs()
41  flags.lock()
42  flags.dump()
43 
45  mlog = logging.getLogger("EMConversionBuilderConfigTest")
46  mlog.info("Configuring EMConversionBuilder: ")
47  printProperties(mlog, cfg.popToolsAndMerge(
48  EMConversionBuilderCfg(flags)),
49  nestLevel=1,
50  printDefaults=True)
51 
52  f = open("emshowerbuilder.pkl", "wb")
53  cfg.store(f)
54  f.close()
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
EMConversionBuilder
Definition: EMConversionBuilder.h:45
EMConversionBuilderConfig.EMConversionBuilderCfg
def EMConversionBuilderCfg(flags, name='EMConversionBuilder', **kwargs)
Definition: EMConversionBuilderConfig.py:11
egammaTrackToolsConfig.EMExtrapolationToolsCfg
def EMExtrapolationToolsCfg(flags, **kwargs)
Definition: egammaTrackToolsConfig.py:13
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