ATLAS Offline Software
egammaReconstructionConfig.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 reconstruction.
5  """
6 
7 from AthenaCommon.Logging import logging
8 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9 
10 
11 def egammaReconstructionCfg(flags, name="egammaReconstruction"):
12 
13  mlog = logging.getLogger(name)
14  mlog.info('Starting EGamma reconstruction configuration')
15 
16  acc = ComponentAccumulator()
17 
18  # In case it has not be added upstream already
19  from egammaAlgs.egammaTopoClusterCopierConfig import (
20  egammaTopoClusterCopierCfg)
21  acc.merge(egammaTopoClusterCopierCfg(flags))
22 
23  # Add e/gamma tracking algorithms
24  if flags.Egamma.doTracking:
25  from egammaAlgs.egammaSelectedTrackCopyConfig import (
26  egammaSelectedTrackCopyCfg)
27  acc.merge(egammaSelectedTrackCopyCfg(flags))
28 
29  from egammaAlgs.EMBremCollectionBuilderConfig import (
30  EMBremCollectionBuilderCfg)
31  acc.merge(EMBremCollectionBuilderCfg(flags))
32 
33  if (flags.Tracking.writeExtendedSi_PRDInfo or
34  flags.Tracking.writeExtendedTRT_PRDInfo):
35  from DerivationFrameworkInDet.InDetToolsConfig import (
36  GSFTSOS_CommonKernelCfg)
37  acc.merge(GSFTSOS_CommonKernelCfg(flags))
38 
39  # Add e/gamma conversion finding
40  if flags.Egamma.doConversionBuilding:
41  from egammaAlgs.EMVertexBuilderConfig import (
42  EMVertexBuilderCfg)
43  acc.merge(EMVertexBuilderCfg(flags))
44 
45  # Add algorithms to produce
46  # xAOD Electrons and Photons
47  if flags.Egamma.doCentral:
48  from egammaAlgs.egammaRecBuilderConfig import (
49  egammaRecBuilderCfg)
50  if flags.HeavyIon.Egamma.doSubtractedClusters:
51  acc.merge(egammaRecBuilderCfg(
52  flags, InputClusterContainerName=flags.HeavyIon.Egamma.CaloTopoCluster))
53  else:
54  acc.merge(egammaRecBuilderCfg(flags))
55 
56  from egammaAlgs.egammaSuperClusterBuilderConfig import (
57  electronSuperClusterBuilderCfg, photonSuperClusterBuilderCfg)
58  acc.merge(electronSuperClusterBuilderCfg(flags))
59  acc.merge(photonSuperClusterBuilderCfg(flags))
60 
61  from egammaAlgs.xAODEgammaBuilderConfig import (
62  xAODEgammaBuilderCfg)
63  acc.merge(xAODEgammaBuilderCfg(flags))
64 
65  from egammaAlgs.egammaLargeClusterMakerAlgConfig import (
66  egammaLargeClusterMakerAlgCfg)
67  acc.merge(egammaLargeClusterMakerAlgCfg(flags))
68 
69  # Add calo seeded forward algorithms to produce xAOD Forward Electrons.
70  if flags.Egamma.doForward:
71  from egammaAlgs.egammaForwardBuilderConfig import (
72  egammaForwardBuilderCfg)
73  acc.merge(egammaForwardBuilderCfg(flags))
74 
75  from egammaAlgs.egammaLargeFWDClusterMakerAlgConfig import (
76  egammaLargeFWDClusterMakerAlgCfg)
77  acc.merge(egammaLargeFWDClusterMakerAlgCfg(flags))
78 
79  # Add truth association.
80  if flags.Egamma.doTruthAssociation:
81  from egammaAlgs.egammaTruthAssociationConfig import (
82  egammaTruthAssociationCfg)
83  acc.merge(egammaTruthAssociationCfg(flags))
84 
85  mlog.info("EGamma reconstruction configured")
86 
87  return acc
88 
89 
90 if __name__ == "__main__":
91  from AthenaConfiguration.AllConfigFlags import initConfigFlags
92  from AthenaConfiguration.TestDefaults import defaultTestFiles
93  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
94  flags = initConfigFlags()
95  flags.Input.Files = defaultTestFiles.RDO_RUN2
96  flags.Output.doWriteESD = True # To test the ESD parts.
97  flags.Output.doWriteAOD = True # To test the AOD parts.
98  flags.lock()
99 
100  acc = MainServicesCfg(flags)
101  acc.merge(egammaReconstructionCfg(flags))
102  acc.printConfig(withDetails=True, printDefaults=True)
103 
104  with open("egammareconstructionconfig.pkl", "wb") as f:
105  acc.store(f)
EMBremCollectionBuilderConfig.EMBremCollectionBuilderCfg
def EMBremCollectionBuilderCfg(flags, name="EMBremCollectionBuilder", **kwargs)
Definition: EMBremCollectionBuilderConfig.py:8
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
EMVertexBuilderConfig.EMVertexBuilderCfg
def EMVertexBuilderCfg(flags, name="EMVertexBuilder", **kwargs)
Definition: EMVertexBuilderConfig.py:8
egammaLargeFWDClusterMakerAlgConfig.egammaLargeFWDClusterMakerAlgCfg
def egammaLargeFWDClusterMakerAlgCfg(flags, name="egammaLargeFWDClusterMaker", **kwargs)
Definition: egammaLargeFWDClusterMakerAlgConfig.py:15
python.InDetToolsConfig.GSFTSOS_CommonKernelCfg
def GSFTSOS_CommonKernelCfg(flags, name="GSFTSOS_CommonKernel")
Definition: InDetToolsConfig.py:236
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
egammaForwardBuilderConfig.egammaForwardBuilderCfg
def egammaForwardBuilderCfg(flags, name='egammaForwardElectron', **kwargs)
Definition: egammaForwardBuilderConfig.py:13
egammaLargeClusterMakerAlgConfig.egammaLargeClusterMakerAlgCfg
def egammaLargeClusterMakerAlgCfg(flags, name="egammaLargeClusterMaker", **kwargs)
Definition: egammaLargeClusterMakerAlgConfig.py:16
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
egammaSuperClusterBuilderConfig.photonSuperClusterBuilderCfg
def photonSuperClusterBuilderCfg(flags, name='photonSuperClusterBuilder', sequenceName=None, **kwargs)
Definition: egammaSuperClusterBuilderConfig.py:57
egammaTopoClusterCopierConfig.egammaTopoClusterCopierCfg
def egammaTopoClusterCopierCfg(flags, name='', **kwargs)
Definition: egammaTopoClusterCopierConfig.py:10
python.egammaReconstructionConfig.egammaReconstructionCfg
def egammaReconstructionCfg(flags, name="egammaReconstruction")
Definition: egammaReconstructionConfig.py:11