ATLAS Offline Software
Loading...
Searching...
No Matches
EMShowerBuilderConfig.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 EMShowerBuilder """
4
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory import CompFactory
7
8from AthenaCommon.Logging import logging
9from CaloIdentifier import SUBCALO
10
11
12def EMShowerBuilderCfg(flags, name='EMShowerBuilder', **kwargs):
13
14 mlog = logging.getLogger(name)
15 mlog.debug('Start configuration')
16
17 acc = ComponentAccumulator()
18 egammaIso, egammaShowerShape = CompFactory.getComps(
19 "egammaIso", "egammaShowerShape",)
20 kwargs.setdefault("CellsName", flags.Egamma.Keys.Input.CaloCells)
21 kwargs.setdefault(
22 "CaloNums", [SUBCALO.LAREM, SUBCALO.LARHEC, SUBCALO.TILE])
23 kwargs.setdefault("ShowerShapeTool", egammaShowerShape())
24 kwargs.setdefault("HadronicLeakageTool", egammaIso())
25
26 tool = CompFactory.EMShowerBuilder(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("EMShowerBuilderConfigTest")
45 mlog.info("Configuring EMShowerBuilder: ")
46 printProperties(mlog, cfg.popToolsAndMerge(
47 EMShowerBuilderCfg(flags)),
48 nestLevel=1,
49 printDefaults=True)
50
51 f = open("emshowerbuilder.pkl", "wb")
52 cfg.store(f)
53 f.close()
{Tool to estimate the hadronic energy behind the electromagnetic cluster, the
Definition egammaIso.h:16
EMShowerBuilderCfg(flags, name='EMShowerBuilder', **kwargs)