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
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'):
98 tool.HRecoil = True
99 tool.UseFELinks = False if config.objType == 'MuonLRT' or config.objType == 'LRTEle' else useFELinks
100
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