53def getBuilder(config,suffix,doTracks,doCells,doTriggerMET,doOriginCorrClus):
56 if config.objType ==
'SoftTrk':
57 tool = CompFactory.getComp(
"met::METSoftTermsTool")(
'MET_SoftTrkTool_'+suffix)
58 tool.InputComposition =
'Tracks'
59 tool.TrackKey = defaultInputKey[config.objType]
60 config.inputKey = defaultInputKey[config.objType]
61 if config.objType.endswith(
'SoftClus'):
62 tool = CompFactory.getComp(
"met::METSoftTermsTool")(
'MET_SoftClusTool_'+suffix)
63 tool.InputComposition =
'Clusters'
64 tool.CaloClusterKey = defaultInputKey[config.objType]
65 config.inputKey = defaultInputKey[config.objType]
66 if config.objType ==
'SoftPFlow':
67 tool = CompFactory.getComp(
"met::METSoftTermsTool")(
'MET_SoftPFlowTool_'+suffix)
68 tool.InputComposition =
'PFlow'
69 pfotool = CompFactory.RetrievePFOTool(
'MET_PFOTool_'+suffix)
70 tool.PFOTool = pfotool
72 tool = CompFactory.getComp(
"met::METTruthTool")(
'MET_TruthTool_'+config.objType)
73 tool.InputComposition = config.objType
74 tool.InputCollection = defaultInputKey[
'Truth']
75 config.inputKey = defaultInputKey[
'Truth']
76 config.outputKey = config.objType
78 tool = CompFactory.getComp(
"met::METCaloRegionsTool")(
'MET_CaloRegionsTool')
81 tool.DoTriggerMET = doTriggerMET
82 tool.CaloCellKey = defaultInputKey[
'Calo']
83 config.inputKey = defaultInputKey[
'Calo']
86 tool.DoTriggerMET =
False
87 tool.CaloClusterKey = defaultInputKey[
'SoftClus']
88 config.inputKey = defaultInputKey[
'SoftClus']
89 config.outputKey = config.objType
92 if config.inputKey ==
'':
93 tool.InputCollection = defaultInputKey[config.objType]
94 config.inputKey = tool.InputCollection
95 elif hasattr(tool,
'InputCollection'):
96 tool.InputCollection = config.inputKey
97 if not suffix==
'Calo':
98 if config.outputKey ==
'':
99 tool.MissingETKey = defaultOutputKey[config.objType]
100 config.outputKey = tool.MissingETKey
102 tool.MissingETKey = config.outputKey
113def getRefiner(flags,config,suffix,trkseltool=None,trkvxtool=None,trkisotool=None,caloisotool=None):
116 if config.type ==
'TrackFilter':
117 tool = CompFactory.getComp(
"met::METTrackFilterTool")(
'MET_TrackFilterTool_'+suffix)
118 tool.InputPVKey = defaultInputKey[
'PrimaryVx']
119 tool.TrackSelectorTool=trkseltool
120 tool.TrackVxAssocTool=trkvxtool
122 tool.UseIsolationTools =
False
123 tool.TrackIsolationTool = trkisotool
124 tool.CaloIsolationTool = caloisotool
126 tool.DoPVSel = flags.MET.UseTracks
127 tool.DoVxSep = flags.MET.UseTracks
128 tool.MissingETKey = config.outputKey
135 if suffix ==
'Truth':
136 config.outputKey = config.objType
137 tool = CompFactory.getComp(
"met::METRegionsTool")(
'MET_'+config.outputKey+
'Regions_'+suffix)
138 tool.InputMETContainer =
'MET_'+suffix
139 tool.InputMETMap =
'METMap_'+suffix
140 tool.InputMETKey = config.outputKey
141 tool.RegionValues = [ 1.5, 3.2, 10 ]
251 recoTool = CompFactory.getComp(
"met::METRecoTool")(
'MET_RecoTool_'+topconfig.suffix,
252 METBuilders = topconfig.buildlist,
253 METRefiners = topconfig.reflist,
254 METContainer = topconfig.outputCollection(),
255 METComponentMap = topconfig.outputMap(),
256 WarnIfDuplicate = topconfig.duplicateWarning)
258 recoTool.METFinalName = defaultOutputKey[
'Total']
264 regTool = CompFactory.getComp(
"met::METRecoTool")(
'MET_RegionTool_'+topconfig.suffix,
266 METRefiners = topconfig.reglist,
267 METContainer = topconfig.outputCollection()+
'Regions',
268 METComponentMap = topconfig.outputMap()+
'Regions',
269 WarnIfDuplicate = topconfig.duplicateWarning)
275 for key,conf
in configs.items():
276 metlog.info(
"{} Generate METRecoTool for MET_{}".format(prefix,key))
278 recoTools.append(recotool)
281 recoTools.append(regiontool)
282 for tool
in recoTools:
283 metlog.info(
"{} Added METRecoTool {} to alg {}".format(prefix,tool.name,algName))
284 recoAlg = CompFactory.getComp(
"met::METRecoAlg")(name=algName,RecoTools=recoTools)
__init__(self, suffix, inputFlags, buildconfigs=[], refconfigs=[], doTracks=False, doSum=False, doRegions=False, doCells=False, doTriggerMET=True, duplicateWarning=True, doOriginCorrClus=False)
getRefiner(flags, config, suffix, trkseltool=None, trkvxtool=None, trkisotool=None, caloisotool=None)