ATLAS Offline Software
egammaLRTReconstructionConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 """ Instantiate the EGamma LRT reconstruction.
4 """
5 
6 from AthenaCommon.Logging import logging
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from egammaTrackTools.egammaTrackToolsConfig import (
9  EMExtrapolationToolsCfg)
10 
11 
12 def egammaLRTReconstructionCfg(flags, name="egammaLRTReconstruction"):
13 
14  mlog = logging.getLogger(name)
15  mlog.info('Starting EGamma LRT reconstruction configuration')
16 
17  acc = ComponentAccumulator()
18 
19  # Add e/gamma tracking algorithms
20  if flags.Egamma.doTracking:
21  from egammaAlgs.egammaSelectedTrackCopyConfig import (
22  egammaSelectedTrackCopyCfg)
23  emextLRT = acc.popToolsAndMerge(
26  flags,
27  name="LRTegammaSelectedTrackCopy",
28  TrackParticleContainerName="InDetLargeD0TrackParticles",
29  OutputTrkPartContainerName="LRTegammaSelectedTrackParticles",
30  ExtrapolationTool=emextLRT)
31  )
32 
33  from egammaAlgs.EMBremCollectionBuilderConfig import (
34  EMBremCollectionBuilderCfg)
36  flags,
37  name='LRTEMBremCollectionBuilder',
38  TrackParticleContainerName='InDetLargeD0TrackParticles',
39  SelectedTrackParticleContainerName='LRTegammaSelectedTrackParticles',
40  OutputTrkPartContainerName='LRT'+flags.Egamma.Keys.Output.GSFTrackParticles,
41  OutputTrackContainerName='LRT'+flags.Egamma.Keys.Output.GSFTracks)
42  )
43 
44  # Add calo seeded central algorithms
45  if flags.Egamma.doCentral:
46  from egammaAlgs.egammaRecBuilderConfig import (
47  egammaRecBuilderCfg)
48  from egammaTools.EMTrackMatchBuilderConfig import (
49  EMTrackMatchBuilderCfg)
50  emextLRT = acc.popToolsAndMerge(
52  lrtemtrackmatch = acc.popToolsAndMerge(EMTrackMatchBuilderCfg(
53  flags,
54  name='LRTEMTrackMatchBuilder',
55  TrackParticlesName='LRT'+flags.Egamma.Keys.Output.GSFTrackParticles,
56  ExtrapolationTool=emextLRT)
57  )
58  acc.merge(egammaRecBuilderCfg(
59  flags,
60  name='LRTegammaRecBuilder',
61  egammaRecContainer="LRT"+flags.Egamma.Keys.Internal.EgammaRecs,
62  TrackMatchBuilderTool=lrtemtrackmatch,
63  doConversions=False)
64  )
65 
66  from egammaAlgs.egammaSuperClusterBuilderConfig import (
67  electronSuperClusterBuilderCfg)
69  flags,
70  name='LRTelectronSuperClusterBuilder',
71  InputEgammaRecContainerName='LRT' +
72  flags.Egamma.Keys.Internal.EgammaRecs,
73  OutputEgammaRecContainerKey='LRT' +
74  flags.Egamma.Keys.Internal.ElectronSuperRecs,
75  SuperClusterCollectionName = 'LRT' +
76  flags.Egamma.Keys.Internal.ElectronSuperClusters,
77  TrackMatchBuilderTool=lrtemtrackmatch)
78  )
79 
80  from egammaAlgs.xAODEgammaBuilderConfig import (
81  xAODEgammaBuilderCfg)
82  from egammaTools.EMClusterToolConfig import (
83  EMClusterToolCfg)
84  LRTEMClusterTool = acc.popToolsAndMerge(EMClusterToolCfg(
85  flags,
86  name='LRTEMClusterTool',
87  OutputClusterContainerName='LRT'+flags.Egamma.Keys.Output.CaloClusters)
88  )
89  acc.merge(xAODEgammaBuilderCfg(
90  flags,
91  name='LRTxAODEgammaBuilder',
92  InputElectronRecCollectionName='LRT' +
93  flags.Egamma.Keys.Internal.ElectronSuperRecs,
94  ElectronOutputName='LRT'+flags.Egamma.Keys.Output.Electrons,
95  PhotonOutputName="LRT"+flags.Egamma.Keys.Output.Photons,
96  EMClusterTool=LRTEMClusterTool,
97  doPhotons=False)
98  )
99 
100  # Add truth association
101  if flags.Egamma.doTruthAssociation:
102  from egammaAlgs.egammaTruthAssociationConfig import (
103  egammaTruthAssociationCfg)
104  acc.merge(egammaTruthAssociationCfg(
105  flags,
106  name='LRTegammaTruthAssociationAlg',
107  ElectronContainerName='LRT'+flags.Egamma.Keys.Output.Electrons,
108  EgammaTruthContainerName='LRT'+flags.Egamma.Keys.Output.TruthParticles,
109  MatchPhotons=False,
110  MatchForwardElectrons=False)
111  )
112 
113  mlog.info("EGamma LRT reconstruction configured")
114 
115  return acc
116 
117 
118 if __name__ == "__main__":
119  from AthenaConfiguration.AllConfigFlags import initConfigFlags
120  from AthenaConfiguration.TestDefaults import defaultTestFiles
121  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
122  flags = initConfigFlags()
123  flags.Input.Files = defaultTestFiles.RDO_RUN2
124  flags.Output.doWriteESD = True # To test the ESD parts
125  flags.Output.doWriteAOD = True # To test the AOD parts
126  flags.lock()
127 
128  acc = MainServicesCfg(flags)
129  acc.merge(egammaLRTReconstructionCfg(flags))
130  acc.printConfig(withDetails=True,
131  printDefaults=True)
132 
133  with open("egammalrtbuilderconfig.pkl", "wb") as f:
134  acc.store(f)
EMBremCollectionBuilderConfig.EMBremCollectionBuilderCfg
def EMBremCollectionBuilderCfg(flags, name="EMBremCollectionBuilder", **kwargs)
Definition: EMBremCollectionBuilderConfig.py:8
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.egammaLRTReconstructionConfig.egammaLRTReconstructionCfg
def egammaLRTReconstructionCfg(flags, name="egammaLRTReconstruction")
Definition: egammaLRTReconstructionConfig.py:12
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:312
egammaTrackToolsConfig.EMExtrapolationToolsCfg
def EMExtrapolationToolsCfg(flags, **kwargs)
Definition: egammaTrackToolsConfig.py:12
EMTrackMatchBuilderConfig.EMTrackMatchBuilderCfg
def EMTrackMatchBuilderCfg(flags, name='EMTrackMatchBuilder', **kwargs)
Definition: EMTrackMatchBuilderConfig.py:13
egammaSuperClusterBuilderConfig.electronSuperClusterBuilderCfg
def electronSuperClusterBuilderCfg(flags, name='electronSuperClusterBuilder', sequenceName=None, **kwargs)
Definition: egammaSuperClusterBuilderConfig.py:16
xAODEgammaBuilderConfig.xAODEgammaBuilderCfg
def xAODEgammaBuilderCfg(flags, name='xAODEgammaBuilder', sequenceName=None, **kwargs)
Definition: xAODEgammaBuilderConfig.py:17
Trk::open
@ open
Definition: BinningType.h:40
egammaRecBuilderConfig.egammaRecBuilderCfg
def egammaRecBuilderCfg(flags, name='egammaRecBuilder', sequenceName=None, **kwargs)
Definition: egammaRecBuilderConfig.py:13
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
egammaSelectedTrackCopyConfig.egammaSelectedTrackCopyCfg
def egammaSelectedTrackCopyCfg(flags, name="egammaSelectedTrackCopy", **kwargs)
Definition: egammaSelectedTrackCopyConfig.py:11
egammaTruthAssociationConfig.egammaTruthAssociationCfg
def egammaTruthAssociationCfg(flags, name='egammaTruthAssociation', sequenceName=None, **kwargs)
Definition: egammaTruthAssociationConfig.py:15
EMClusterToolConfig.EMClusterToolCfg
def EMClusterToolCfg(flags, name='EMClusterTool', **kwargs)
Definition: EMClusterToolConfig.py:13