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