ATLAS Offline Software
Loading...
Searching...
No Matches
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
4def 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 from AthenaConfiguration.Enums import Format
25 if inputFlags.Input.isMC and inputFlags.Input.Format!=Format.BS:
26 from METReconstruction.METTruth_Cfg import METTruth_Cfg
27 result.merge(METTruth_Cfg(inputFlags))
28 outputList.append("xAOD::MissingETContainer#MET_Truth")
29 outputList.append("xAOD::MissingETAuxContainer#MET_TruthAux.")
30 outputList.append("xAOD::MissingETContainer#MET_TruthRegions")
31 outputList.append("xAOD::MissingETAuxContainer#MET_TruthRegionsAux.")
32 outputList.append('xAOD::MissingETComponentMap#METMap_Truth')
33 outputList.append('xAOD::MissingETAuxComponentMap#METMap_TruthAux.')
34
35 # "Normal" MET collections
36 from METReconstruction.METAssociatorCfg import METAssociatorCfg
37 from METUtilities.METMakerConfig import getMETMakerAlg
38 metDefs = ['AntiKt4EMTopo','AntiKt4LCTopo']
39 if inputFlags.MET.DoPFlow:
40 metDefs.append('AntiKt4EMPFlow')
41 for metDef in metDefs:
42 # Build association maps and core soft terms
43 result.merge(METAssociatorCfg(inputFlags, metDef))
44 outputList.append('xAOD::MissingETAssociationMap#METAssoc_'+metDef)
45 outputList.append('xAOD::MissingETAuxAssociationMap#METAssoc_'+metDef+'Aux.')
46 outputList.append('xAOD::MissingETContainer#MET_Core_'+metDef)
47 outputList.append('xAOD::MissingETAuxContainer#MET_Core_'+metDef+'Aux.')
48 # Build reference MET
49 result.addEventAlgo(getMETMakerAlg(metDef))
50 outputList.append('xAOD::MissingETContainer#MET_Reference_'+metDef)
51 outputList.append('xAOD::MissingETAuxContainer#MET_Reference_'+metDef+'Aux.-ConstitObjectLinks.-ConstitObjectWeights')
52
53 # Add the collections to the output stream
54 from OutputStreamAthenaPool.OutputStreamConfig import addToAOD, addToESD
55 result.merge(addToESD(inputFlags, outputList))
56 if inputFlags.MET.WritetoAOD:
57 result.merge(addToAOD(inputFlags, outputList))
58
59 return result
60
61# Run with python -m METReconstruction.METRecCfg
62def METRecCfgTest(flags=None):
63
64 if flags is None:
65 # Set message levels
66 from AthenaCommon.Logging import log
67 from AthenaCommon.Constants import DEBUG
68 log.setLevel(DEBUG)
69
70 # Config flags steer the job at various levels
71 from AthenaConfiguration.AllConfigFlags import initConfigFlags
72 flags = initConfigFlags()
73 from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultConditionsTags
74 flags.Input.Files = defaultTestFiles.ESD_RUN3_MC
75 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN3_MC
76
77 flags.fillFromArgs()
78 flags.lock()
79
80 # Get a ComponentAccumulator setting up the fundamental Athena job
81 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
82 cfg = MainServicesCfg(flags)
83
84 # Add the components for reading in pool files
85 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
86 cfg.merge(PoolReadCfg(flags))
87
88 # Setup calorimeter geometry, which is needed for jet reconstruction
89 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
90 cfg.merge(LArGMCfg(flags))
91
92 from TileGeoModel.TileGMConfig import TileGMCfg
93 cfg.merge(TileGMCfg(flags))
94
95 from JetRecConfig.JetRecoSteering import JetRecoSteeringCfg
96 cfg.merge(JetRecoSteeringCfg(flags))
97
98 # We also need to build links between the newly
99 # created jet constituents (GlobalFE)
100 # and electrons,photons,muons and taus
101 from eflowRec.PFCfg import PFGlobalFlowElementLinkingCfg
102 cfg.merge(PFGlobalFlowElementLinkingCfg(flags))
103
104 cfg.merge(METCfg(flags))
105
106 cfg.run()
107
108if __name__=="__main__":
METCfg(inputFlags)
Definition METRecCfg.py:4
METRecCfgTest(flags=None)
Definition METRecCfg.py:62