ATLAS Offline Software
Loading...
Searching...
No Matches
EMVertexBuilderConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5from AthenaCommon.Logging import logging
6
7
8def EMVertexBuilderCfg(flags, name="EMVertexBuilder", **kwargs):
9 acc = ComponentAccumulator()
10
11 if "ExtrapolationTool" not in kwargs:
12 from egammaTrackTools.egammaTrackToolsConfig import (
13 EMExtrapolationToolsCfg)
14 kwargs["ExtrapolationTool"] = acc.popToolsAndMerge(
15 EMExtrapolationToolsCfg(flags))
16 if "VertexFinderTool" not in kwargs:
17 from InDetConfig.InDetConversionFinderToolsConfig import (
18 InDetConversionFinderToolsCfg)
19 kwargs["VertexFinderTool"] = acc.popToolsAndMerge(
20 InDetConversionFinderToolsCfg(flags))
21
22 alg = CompFactory.EMVertexBuilder(name, **kwargs)
23 acc.addEventAlgo(alg)
24 return acc
25
26
27if __name__ == "__main__":
28 from AthenaConfiguration.AllConfigFlags import initConfigFlags
29 from AthenaConfiguration.TestDefaults import defaultTestFiles
30 from AthenaConfiguration.ComponentAccumulator import printProperties
31 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
32 flags = initConfigFlags()
33 flags.Input.Files = defaultTestFiles.RDO_RUN2
34 flags.lock()
35
36 acc = MainServicesCfg(flags)
37 acc.merge(EMVertexBuilderCfg(flags))
38 mlog = logging.getLogger("EMVertexBuilderConfigTest")
39 mlog.info("Configuring EMVertexBuilder: ")
40 printProperties(mlog,
41 acc.getEventAlgo("EMVertexBuilder"),
42 nestLevel=1,
43 printDefaults=True)
44 with open("vertexbuilder.pkl", "wb") as f:
45 acc.store(f)
EMVertexBuilderCfg(flags, name="EMVertexBuilder", **kwargs)