From 42ea9800ea839f77668a8c3ba47c5fd14c585810 Mon Sep 17 00:00:00 2001 From: Bill Balunas <bill.balunas@cern.ch> Date: Thu, 29 Oct 2020 13:18:36 +0100 Subject: [PATCH] Add FlowElement support to (old) MET config --- .../python/LegacyRunII/METAssocConfig.py | 17 ++++++++++++++-- .../LegacyRunII/METAssocConfig_readAOD.py | 6 +++--- .../LegacyRunII/METConfig_Associator.py | 20 +++++++++++++++++++ .../python/LegacyRunII/METRecoConfig.py | 7 ------- .../python/LegacyRunII/METRecoFlags.py | 6 ++++++ 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py index 5dc91c5fb16..6f2972858f9 100644 --- a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py +++ b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py @@ -15,11 +15,13 @@ defaultInputKey = { 'LCJet' :'AntiKt4LCTopoJets', 'EMJet' :'AntiKt4EMTopoJets', 'PFlowJet' :'AntiKt4EMPFlowJets', + 'PFlowFEJet':'AntiKt4EMPFlowFEJets', 'Muon' :'Muons', 'Soft' :'', 'Clusters' :'CaloCalTopoClusters', 'Tracks' :'InDetTrackParticles', 'PFlowObj' :'CHSParticleFlowObjects', + 'PFlowObjFE':'CHSFlowElements', 'PrimVxColl':'PrimaryVertices', 'Truth' :'TruthEvents', } @@ -63,6 +65,8 @@ def getAssociator(config,suffix,doPFlow=False, tool = CfgMgr.met__METJetAssocTool('MET_EMJetAssocTool_'+suffix) if config.objType == 'PFlowJet': tool = CfgMgr.met__METJetAssocTool('MET_PFlowJetAssocTool_'+suffix) + if config.objType == 'PFlowFEJet': + tool = CfgMgr.met__METJetAssocTool('MET_PFlowFEJetAssocTool_'+suffix) if config.objType == 'Muon': tool = CfgMgr.met__METMuonAssociator('MET_MuonAssociator_'+suffix) if config.objType == 'Soft': @@ -74,9 +78,14 @@ def getAssociator(config,suffix,doPFlow=False, if config.objType == 'Truth': tool = CfgMgr.met__METTruthAssociator('MET_TruthAssociator_'+suffix) tool.RecoJetKey = config.inputKey + + from METReconstruction.METRecoFlags import metFlags if doPFlow: tool.PFlow = True - tool.PFlowColl = modConstKey if modConstKey!="" else defaultInputKey["PFlowObj"] + if metFlags.UseFlowElements() : + tool.FlowElementCollection = modConstKey if modConstKey!="" else defaultInputKey["PFlowObjFE"] + else: + tool.PFlowColl = modConstKey if modConstKey!="" else defaultInputKey["PFlowObj"] else: tool.UseModifiedClus = doModClus # set input/output key names @@ -146,7 +155,11 @@ class METAssocConfig: modConstKey_tmp = modConstKey modClusColls_tmp = modClusColls if doPFlow: - if modConstKey_tmp == "": modConstKey_tmp = "CHSParticleFlowObjects" + from METReconstruction.METRecoFlags import metFlags + if metFlags.UseFlowElements(): + if modConstKey_tmp == "": modConstKey_tmp = "CHSFlowElements" + else: + if modConstKey_tmp == "": modConstKey_tmp = "CHSParticleFlowObjects" else: if modConstKey_tmp == "": modConstKey_tmp = "OriginCorr" if modClusColls_tmp == {}: modClusColls_tmp = {'LCOriginCorrClusters':'LCOriginTopoClusters', diff --git a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig_readAOD.py b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig_readAOD.py index 0257b283e2e..61b3897355c 100644 --- a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig_readAOD.py +++ b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig_readAOD.py @@ -21,6 +21,7 @@ defaultInputKey = { 'LCJet' :'AntiKt4LCTopoJets', 'EMJet' :'AntiKt4EMTopoJets', 'PFlowJet' :'AntiKt4EMPFlowJets', + 'PFlowFEJet':'AntiKt4EMPFlowFEJets', 'Muon' :'Muons', 'Soft' :'', 'ClusColl' :'CaloCalTopoClusters', @@ -82,6 +83,8 @@ def getAssociator(config,suffix,doPFlow=False, tool = CfgMgr.met__METJetAssocTool('MET_EMJetAssocTool_'+suffix) if config.objType == 'PFlowJet': tool = CfgMgr.met__METJetAssocTool('MET_PFlowJetAssocTool_'+suffix) + if config.objType == 'PFlowFEJet': + tool = CfgMgr.met__METJetAssocTool('MET_PFlowFEJetAssocTool_'+suffix) if config.objType == 'Muon': tool = CfgMgr.met__METMuonAssociator('MET_MuonAssociator_'+suffix,DoClusterMatch=False) if config.objType == 'Soft': @@ -94,9 +97,6 @@ def getAssociator(config,suffix,doPFlow=False, ToolSvc == tool tool.RecoJetKey = config.inputKey if doPFlow: - pfotool = CfgMgr.CP__RetrievePFOTool('MET_PFOTool_'+suffix) - ToolSvc += pfotool - tool.PFOTool = pfotool tool.PFlow = True else: tool.UseModifiedClus = doOriginCorrClus diff --git a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METConfig_Associator.py b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METConfig_Associator.py index 600e5e9b691..de6c00f8784 100644 --- a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METConfig_Associator.py +++ b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METConfig_Associator.py @@ -70,3 +70,23 @@ if metFlags.DoPFlow() and metFlags.UseTracks(): metFlags.METAssocConfigs()[cfg_akt4pf.suffix] = cfg_akt4pf metFlags.METAssocOutputList().append(cfg_akt4pf.suffix) + + +############################################################################ +# PFlow (FlowElement) +if metFlags.DoPFlow() and metFlags.UseTracks() and metFlags.UseFlowElements(): + JetType = 'PFlowFEJet' + + associators = [AssocConfig(JetType), + AssocConfig('Muon'), + AssocConfig('Ele'), + AssocConfig('Gamma'), + AssocConfig('Tau'), + AssocConfig('Soft')] + cfg_akt4pffe = METAssocConfig('AntiKt4EMPFlowFE', + associators, + doPFlow=True + ) + + metFlags.METAssocConfigs()[cfg_akt4pffe.suffix] = cfg_akt4pffe + metFlags.METAssocOutputList().append(cfg_akt4pffe.suffix) \ No newline at end of file diff --git a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py index 01a0c21dc61..a689ef77774 100644 --- a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py +++ b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py @@ -26,7 +26,6 @@ defaultInputKey = { 'Muon' :'Muons', 'SoftTrk' :'InDetTrackParticles', 'SoftClus' :'CaloCalTopoClusters', - 'SoftPFlow':'JetETMissNeutralParticleFlowObjects', 'PrimaryVx':'PrimaryVertices', 'Truth' :'TruthEvents', 'Calo' :'AllCalo', @@ -42,7 +41,6 @@ defaultOutputKey = { 'Muon' :'Muons', 'SoftTrk' :'SoftTrk', 'SoftClus' :'SoftClus', - 'SoftPFlow':'SoftPFlow', 'Total' :'Final', 'Truth' :'Truth', 'Calo' :'Calo' @@ -86,11 +84,6 @@ def getBuilder(config,suffix,doTracks,doCells,doTriggerMET,doOriginCorrClus): if config.objType.endswith('SoftClus'): tool = CfgMgr.met__METSoftTermsTool('MET_SoftClusTool_'+suffix) tool.InputComposition = 'Clusters' - if config.objType == 'SoftPFlow': - tool = CfgMgr.met__METSoftTermsTool('MET_SoftPFlowTool_'+suffix) - tool.InputComposition = 'PFlow' - pfotool = CfgMgr.CP__RetrievePFOTool('MET_PFOTool_'+suffix) - tool.PFOTool = pfotool if suffix == 'Truth': tool = CfgMgr.met__METTruthTool('MET_TruthTool_'+config.objType) tool.InputComposition = config.objType diff --git a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoFlags.py b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoFlags.py index 462fb16051c..99b0482d404 100644 --- a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoFlags.py +++ b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoFlags.py @@ -16,6 +16,11 @@ class DoPFlow(JobProperty): allowedTypes = ['bool'] StoredValue = True +class UseFlowElements(JobProperty): + statusOn = True + allowedTypes = ['bool'] + StoredValue = False + class UseTracks(JobProperty): statusOn = True allowedTypes = ['bool'] @@ -65,6 +70,7 @@ jobproperties.add_Container(METRecoFlags) jobproperties.METRecoFlags.add_JobProperty(DoRegions) jobproperties.METRecoFlags.add_JobProperty(DoPFlow) +jobproperties.METRecoFlags.add_JobProperty(UseFlowElements) jobproperties.METRecoFlags.add_JobProperty(UseTracks) jobproperties.METRecoFlags.add_JobProperty(DecorateSoftConst) jobproperties.METRecoFlags.add_JobProperty(AllowOverwrite) -- GitLab