ATLAS Offline Software
METRecCfg.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 # Configure all MET algorithms for standard reconstruction
4 def METCfg(inputFlags):
5  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6  result=ComponentAccumulator()
7  outputList = []
8 
9  # Calo MET collections (for monitoring)
10  from METReconstruction.METCalo_Cfg import METCalo_Cfg
11  result.merge(METCalo_Cfg(inputFlags))
12  metDefs = ['EMTopo', 'EMTopoRegions', 'LocHadTopo', 'LocHadTopoRegions', 'Calo']
13  for metDef in metDefs:
14  outputList.append('xAOD::MissingETContainer#MET_'+metDef)
15  outputList.append('xAOD::MissingETAuxContainer#MET_'+metDef+'Aux.')
16 
17  # Track MET
18  from METReconstruction.METTrack_Cfg import METTrack_Cfg
19  result.merge(METTrack_Cfg(inputFlags))
20  outputList.append("xAOD::MissingETContainer#MET_Track")
21  outputList.append("xAOD::MissingETAuxContainer#MET_TrackAux.")
22 
23  # Truth MET
24  if inputFlags.Input.isMC:
25  from METReconstruction.METTruth_Cfg import METTruth_Cfg
26  result.merge(METTruth_Cfg(inputFlags))
27  outputList.append("xAOD::MissingETContainer#MET_Truth")
28  outputList.append("xAOD::MissingETAuxContainer#MET_TruthAux.")
29  outputList.append("xAOD::MissingETContainer#MET_TruthRegions")
30  outputList.append("xAOD::MissingETAuxContainer#MET_TruthRegionsAux.")
31  outputList.append('xAOD::MissingETComponentMap#METMap_Truth')
32  outputList.append('xAOD::MissingETAuxComponentMap#METMap_TruthAux.')
33 
34  # "Normal" MET collections
35  from METReconstruction.METAssociatorCfg import METAssociatorCfg
36  from METUtilities.METMakerConfig import getMETMakerAlg
37  metDefs = ['AntiKt4EMTopo','AntiKt4LCTopo']
38  if inputFlags.MET.DoPFlow:
39  metDefs.append('AntiKt4EMPFlow')
40  for metDef in metDefs:
41  # Build association maps and core soft terms
42  result.merge(METAssociatorCfg(inputFlags, metDef))
43  outputList.append('xAOD::MissingETAssociationMap#METAssoc_'+metDef)
44  outputList.append('xAOD::MissingETAuxAssociationMap#METAssoc_'+metDef+'Aux.')
45  outputList.append('xAOD::MissingETContainer#MET_Core_'+metDef)
46  outputList.append('xAOD::MissingETAuxContainer#MET_Core_'+metDef+'Aux.')
47  # Build reference MET
48  result.addEventAlgo(getMETMakerAlg(metDef))
49  outputList.append('xAOD::MissingETContainer#MET_Reference_'+metDef)
50  outputList.append('xAOD::MissingETAuxContainer#MET_Reference_'+metDef+'Aux.-ConstitObjectLinks.-ConstitObjectWeights')
51 
52  # Add the collections to the output stream
53  from OutputStreamAthenaPool.OutputStreamConfig import addToAOD, addToESD
54  result.merge(addToESD(inputFlags, outputList))
55  if inputFlags.MET.WritetoAOD:
56  result.merge(addToAOD(inputFlags, outputList))
57 
58  return result
59 
60 # Run with python -m METReconstruction.METRecCfg
61 def METRecCfgTest(flags=None):
62 
63  if flags is None:
64  # Set message levels
65  from AthenaCommon.Logging import log
66  from AthenaCommon.Constants import DEBUG
67  log.setLevel(DEBUG)
68 
69  # Config flags steer the job at various levels
70  from AthenaConfiguration.AllConfigFlags import initConfigFlags
71  flags = initConfigFlags()
72  from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultConditionsTags
73  flags.Input.Files = defaultTestFiles.ESD_RUN3_MC
74  flags.IOVDb.GlobalTag = defaultConditionsTags.RUN3_MC
75 
76  flags.fillFromArgs()
77  flags.lock()
78 
79  # Get a ComponentAccumulator setting up the fundamental Athena job
80  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
81  cfg = MainServicesCfg(flags)
82 
83  # Add the components for reading in pool files
84  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
85  cfg.merge(PoolReadCfg(flags))
86 
87  # Setup calorimeter geometry, which is needed for jet reconstruction
88  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
89  cfg.merge(LArGMCfg(flags))
90 
91  from TileGeoModel.TileGMConfig import TileGMCfg
92  cfg.merge(TileGMCfg(flags))
93 
94  from JetRecConfig.JetRecoSteering import JetRecoSteeringCfg
95  cfg.merge(JetRecoSteeringCfg(flags))
96 
97  # We also need to build links between the newly
98  # created jet constituents (GlobalFE)
99  # and electrons,photons,muons and taus
100  from eflowRec.PFCfg import PFGlobalFlowElementLinkingCfg
101  cfg.merge(PFGlobalFlowElementLinkingCfg(flags))
102 
103  cfg.merge(METCfg(flags))
104 
105  cfg.run()
106 
107 if __name__=="__main__":
108  METRecCfgTest()
METCalo_Cfg
Definition: METCalo_Cfg.py:1
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
METMakerConfig.getMETMakerAlg
def getMETMakerAlg(suffix, jetSelection="Tier0", jetColl="")
Definition: METMakerConfig.py:60
METAssociatorCfg
Definition: METAssociatorCfg.py:1
python.JetRecoSteering.JetRecoSteeringCfg
def JetRecoSteeringCfg(flags)
Definition: JetRecoSteering.py:67
METRecCfg.METCfg
def METCfg(inputFlags)
Definition: METRecCfg.py:4
METTrack_Cfg
Definition: METTrack_Cfg.py:1
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
Constants
some useful constants -------------------------------------------------—
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
python.OutputStreamConfig.addToESD
def addToESD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:127
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.OutputStreamConfig.addToAOD
def addToAOD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:142
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
METTruth_Cfg
Definition: METTruth_Cfg.py:1
PFCfg.PFGlobalFlowElementLinkingCfg
def PFGlobalFlowElementLinkingCfg(inputFlags, **kwargs)
Definition: PFCfg.py:472
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7
METRecCfg.METRecCfgTest
def METRecCfgTest(flags=None)
Definition: METRecCfg.py:61