ATLAS Offline Software
Loading...
Searching...
No Matches
METAssocCfg Namespace Reference

Classes

class  AssocConfig
 Configuration of builders. More...
class  METAssocConfig
 Top level MET configuration. More...

Functions

 getAssociator (configFlags, config, suffix, doPFlow=False, doRecoil=False, trkseltool=None, trkisotool=None, caloisotool=None, useFELinks=False, modConstKey="", modClusColls={})
 getMETAssocTool (topconfig, msglvl=INFO)
 getMETAssocAlg (algName='METAssociation', configs={}, tools=[], msglvl=INFO)

Variables

 metlog = Logging.logging.getLogger('METConfig')
dict defaultInputKey
 Define some default values.
str prefix = 'METAssocConfig: '

Function Documentation

◆ getAssociator()

METAssocCfg.getAssociator ( configFlags,
config,
suffix,
doPFlow = False,
doRecoil = False,
trkseltool = None,
trkisotool = None,
caloisotool = None,
useFELinks = False,
modConstKey = "",
modClusColls = {} )

Definition at line 45 of file METAssocCfg.py.

50 modClusColls={}):
51 tool = None
52 doModClus = (modConstKey!="" and not doPFlow)
53 if doModClus:
54 modLCClus = modClusColls['LC{0}Clusters'.format(modConstKey)]
55 modEMClus = modClusColls['EM{0}Clusters'.format(modConstKey)]
56
57 # Construct tool and set defaults for case-specific configuration
58 if config.objType == 'Ele':
59 tool = CompFactory.getComp("met::METElectronAssociator")('MET_ElectronAssociator_'+suffix,TCMatchMethod=1)
60 if config.objType == 'LRTEle':
61 tool = CompFactory.getComp("met::METElectronAssociator")('MET_LRTElectronAssociator_'+suffix,TCMatchMethod=1)
62 if config.objType == 'Gamma':
63 tool = CompFactory.getComp("met::METPhotonAssociator")('MET_PhotonAssociator_'+suffix,TCMatchMethod=1)
64 if config.objType == 'Tau':
65 tool = CompFactory.getComp("met::METTauAssociator")('MET_TauAssociator_'+suffix)
66 if config.objType == 'LCJet':
67 tool = CompFactory.getComp("met::METJetAssocTool")('MET_LCJetAssocTool_'+suffix)
68 if config.objType == 'EMJet':
69 tool = CompFactory.getComp("met::METJetAssocTool")('MET_EMJetAssocTool_'+suffix)
70 if config.objType == 'PFlowJet':
71 tool = CompFactory.getComp("met::METJetAssocTool")('MET_PFlowJetAssocTool_'+suffix)
72 if config.objType == 'HadronicRecoil':
73 tool = CompFactory.getComp("met::METJetAssocTool")('MET_PFlowJetAssocTool_HR_'+suffix)
74 if config.objType == 'CustomJet':
75 tool = CompFactory.getComp("met::METJetAssocTool")('MET_CustomJetAssocTool_'+suffix)
76 if config.objType == 'Muon':
77 tool = CompFactory.getComp("met::METMuonAssociator")('MET_MuonAssociator_'+suffix)
78 if config.objType == 'MuonLRT':
79 tool = CompFactory.getComp("met::METMuonAssociator")('MET_MuonLRTAssociator_'+suffix)
80 if config.objType == 'Soft':
81 tool = CompFactory.getComp("met::METSoftAssociator")('MET_SoftAssociator_'+suffix)
82 tool.DecorateSoftConst = True
83 if doModClus:
84 tool.LCModClusterKey = modLCClus
85 tool.EMModClusterKey = modEMClus
86 if config.objType == 'Truth':
87 tool = CompFactory.getComp("met::METTruthAssociator")('MET_TruthAssociator_'+suffix)
88 tool.RecoJetKey = config.inputKey
89 if doPFlow:
90 tool.PFlow = True
91 if doRecoil:
92 tool.FlowElementCollection = modConstKey if modConstKey!="" else defaultInputKey["PFlowObjHR"]
93 else:
94 tool.FlowElementCollection = modConstKey if modConstKey!="" else defaultInputKey["PFlowObj"]
95 else:
96 tool.UseModifiedClus = doModClus
97 if doRecoil and (config.objType == 'Muon' or config.objType == 'Ele'): #we only need the recoil implementation for e and mu
98 tool.HRecoil = True
99 tool.UseFELinks = False if config.objType == 'MuonLRT' or config.objType == 'LRTEle' else useFELinks
100 # set input/output key names
101 if config.inputKey == '' and defaultInputKey[config.objType] != '':
102 tool.InputCollection = defaultInputKey[config.objType]
103 config.inputKey = tool.InputCollection
104 elif hasattr(tool, 'InputCollection'):
105 tool.InputCollection = config.inputKey
106 if doModClus:
107 tool.ClusColl = modLCClus
108 if 'EMTopo' in suffix: tool.ClusColl = modEMClus
109 tool.TrkColl = defaultInputKey['Tracks']
110 tool.UseTracks = configFlags.MET.UseTracks
111 tool.TrackSelectorTool = trkseltool
112 tool.TrackIsolationTool = trkisotool
113 tool.CaloIsolationTool = caloisotool
114
115 return tool
116

◆ getMETAssocAlg()

METAssocCfg.getMETAssocAlg ( algName = 'METAssociation',
configs = {},
tools = [],
msglvl = INFO )

Definition at line 219 of file METAssocCfg.py.

219def getMETAssocAlg(algName='METAssociation',configs={},tools=[],msglvl=INFO):
220
221 assocTools = []
222 assocTools += tools
223
224 if configs=={} and tools==[]:
225 metlog.info("{} Empty list of MET association configs provided. None will be reconstructed.".format(prefix))
226 for key,conf in configs.items():
227 metlog.info("{} Generate METAssocTool for MET_{}".format(prefix,key))
228 assoctool = getMETAssocTool(conf,msglvl)
229 assocTools.append(assoctool)
230
231 for tool in assocTools:
232 metlog.info("{} Added METAssocTool {} to alg {}".format(prefix,tool.name,algName))
233 assocAlg = CompFactory.getComp("met::METRecoAlg")(name=algName,
234 RecoTools=assocTools)
235 return assocAlg

◆ getMETAssocTool()

METAssocCfg.getMETAssocTool ( topconfig,
msglvl = INFO )

Definition at line 205 of file METAssocCfg.py.

205def getMETAssocTool(topconfig,msglvl=INFO):
206 assocTool = None
207 if topconfig.doTruth:
208 assocTool = CompFactory.getComp("met::METAssociationTool")('MET_TruthAssociationTool_'+topconfig.suffix,
209 METAssociators = topconfig.assoclist,
210 METSuffix = topconfig.suffix)
211 else:
212 assocTool = CompFactory.getComp("met::METAssociationTool")('MET_AssociationTool_'+topconfig.suffix,
213 METAssociators = topconfig.assoclist,
214 METSuffix = topconfig.suffix,
215 OutputLevel=msglvl)
216 return assocTool
217
218# Convert the provided METAssocConfigs into a concrete algorithm

Variable Documentation

◆ defaultInputKey

dict METAssocCfg.defaultInputKey
Initial value:
1= {
2 'Ele' :'Electrons',
3 'LRTEle' :'LRTElectrons',
4 'Gamma' :'Photons',
5 'Tau' :'TauJets',
6 'LCJet' :'AntiKt4LCTopoJets',
7 'EMJet' :'AntiKt4EMTopoJets',
8 'PFlowJet' :'AntiKt4EMPFlowJets',
9 'HadronicRecoil':'',
10 'Muon' :'Muons',
11 'MuonLRT' :'MuonsLRT',
12 'Soft' :'',
13 'Clusters' :'CaloCalTopoClusters',
14 'Tracks' :'InDetTrackParticles',
15 'PFlowObj' :'CHSGParticleFlowObjects',
16 'PFlowObjHR' :'CHSGParticleFlowObjects',
17 'PrimVxColl' :'PrimaryVertices',
18 'Truth' :'TruthEvents',
19 }

Define some default values.

Definition at line 15 of file METAssocCfg.py.

◆ metlog

METAssocCfg.metlog = Logging.logging.getLogger('METConfig')

Definition at line 7 of file METAssocCfg.py.

◆ prefix

str METAssocCfg.prefix = 'METAssocConfig: '

Definition at line 35 of file METAssocCfg.py.