ATLAS Offline Software
Loading...
Searching...
No Matches
EMClusterToolConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3""" Configuration for EMClusterTool """
4
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory import CompFactory
7
8from AthenaCommon.Logging import logging
9
10from egammaMVACalib.egammaMVACalibConfig import egammaMVASvcCfg
11
12
13def 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
32if __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
43 cfg = ComponentAccumulator()
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()
EMClusterToolCfg(flags, name='EMClusterTool', **kwargs)