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