ATLAS Offline Software
egammaTrackToolsConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 __doc__ = """Tool configuration to instantiate all
4  egammaCaloTools with default configuration"""
5 
6 from AthenaCommon.Logging import logging
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9 from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg
10 from TrackToCalo.TrackToCaloConfig import EMParticleCaloExtensionToolCfg
11 
12 
13 def EMExtrapolationToolsCfg(flags, **kwargs):
14 
15  mlog = logging.getLogger('EMExtrapolationTools')
16  mlog.debug('Start configuration')
17 
18  acc = ComponentAccumulator()
19 
20  if "Extrapolator" not in kwargs:
21  extrapAcc = AtlasExtrapolatorCfg(flags)
22  kwargs["Extrapolator"] = acc.popToolsAndMerge(extrapAcc)
23 
24  if "CaloExtensionTool" not in kwargs:
25  kwargs["CaloExtensionTool"] = acc.popToolsAndMerge(
27 
28  kwargs["EnableTRT"] = flags.Detector.GeometryTRT
29 
30  emExtrapolationTools = CompFactory.EMExtrapolationTools(**kwargs)
31  acc.setPrivateTools(emExtrapolationTools)
32  return acc
33 
34 
36  name='GSFRefitterTool',
37  **kwargs):
38  acc = ComponentAccumulator()
39  if "FitterTool" not in kwargs:
40  if flags.Acts.useActsGsfInEgamma:
41  from ActsConfig.ActsGaussianSumFitterConfig import ActsGaussianSumFitterToolCfg
42  kwargs["FitterTool"] = acc.popToolsAndMerge(
43  ActsGaussianSumFitterToolCfg(flags, name="ActsGSFTrackFitter"))
44  else:
45  from TrkConfig.TrkGaussianSumFilterConfig import GaussianSumFitterCfg
46  kwargs["FitterTool"] = acc.popToolsAndMerge(
47  GaussianSumFitterCfg(flags, name="GSFTrackFitter"))
48 
49  tool = CompFactory.egammaTrkRefitterTool(name, **kwargs)
50  acc.setPrivateTools(tool)
51  return acc
52 
53 
55  name='CaloCluster_OnTrackBuilder',
56  **kwargs):
57  acc = ComponentAccumulator()
58  if "CaloSurfaceBuilder" not in kwargs:
59  from CaloTrackingGeometry.CaloTrackingGeometryConfig import (
60  CaloSurfaceBuilderMiddleCfg)
61  kwargs["CaloSurfaceBuilder"] = acc.popToolsAndMerge(
63  tool = CompFactory.CaloCluster_OnTrackBuilder(name, **kwargs)
64  acc.setPrivateTools(tool)
65  return acc
66 
67 
68 if __name__ == "__main__":
69 
70  from AthenaConfiguration.AllConfigFlags import initConfigFlags
71  from AthenaConfiguration.ComponentAccumulator import printProperties
72  from AthenaConfiguration.TestDefaults import defaultTestFiles
73  flags = initConfigFlags()
74  flags.Input.Files = defaultTestFiles.RDO_RUN2
75  flags.fillFromArgs()
76  flags.lock()
77  flags.dump()
78 
80  mlog = logging.getLogger("egammaTrackToolsConfigTest")
81  mlog.info("Configuring EMExtrapolationTools : ")
82  printProperties(mlog, cfg.popToolsAndMerge(
84  nestLevel=1,
85  printDefaults=True)
86  mlog.info("Configuring egammaTrkRefitterTool :")
87  printProperties(mlog, cfg.popToolsAndMerge(
89  nestLevel=1,
90  printDefaults=True)
91  mlog.info("Configuring CaloCluster_OnTrackBuilder :")
92  printProperties(mlog, cfg.popToolsAndMerge(
94  nestLevel=1,
95  printDefaults=True)
96 
97  f = open("egtracktools.pkl", "wb")
98  cfg.store(f)
99  f.close()
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
egammaTrackToolsConfig.CaloCluster_OnTrackBuilderCfg
def CaloCluster_OnTrackBuilderCfg(flags, name='CaloCluster_OnTrackBuilder', **kwargs)
Definition: egammaTrackToolsConfig.py:54
python.AtlasExtrapolatorConfig.AtlasExtrapolatorCfg
def AtlasExtrapolatorCfg(flags, name='AtlasExtrapolator')
Definition: AtlasExtrapolatorConfig.py:63
egammaTrackToolsConfig.EMExtrapolationToolsCfg
def EMExtrapolationToolsCfg(flags, **kwargs)
Definition: egammaTrackToolsConfig.py:13
ActsGaussianSumFitterConfig.ActsGaussianSumFitterToolCfg
ComponentAccumulator ActsGaussianSumFitterToolCfg(flags, str name="ActsGaussianSumFitterTool", **kwargs)
Definition: ActsGaussianSumFitterConfig.py:6
CaloTrackingGeometryConfig.CaloSurfaceBuilderMiddleCfg
def CaloSurfaceBuilderMiddleCfg(flags, name="CaloSurfaceBuilderMiddle", **kwargs)
Definition: Calorimeter/CaloTrackingGeometry/python/CaloTrackingGeometryConfig.py:19
extractSporadic.printProperties
def printProperties(h, q, hLB)
Definition: extractSporadic.py:8
Trk::open
@ open
Definition: BinningType.h:40
python.TrkGaussianSumFilterConfig.GaussianSumFitterCfg
def GaussianSumFitterCfg(flags, name="GaussianSumFitter", **kwargs)
Definition: TrkGaussianSumFilterConfig.py:42
TrackToCaloConfig.EMParticleCaloExtensionToolCfg
def EMParticleCaloExtensionToolCfg(flags, name='EMParticleCaloExtensionTool', **kwargs)
Definition: TrackToCaloConfig.py:30
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
egammaTrackToolsConfig.egammaTrkRefitterToolCfg
def egammaTrkRefitterToolCfg(flags, name='GSFRefitterTool', **kwargs)
Definition: egammaTrackToolsConfig.py:35