From 8c91f9dd3e3d6ef2ab14d0c80a802af6536ea18c Mon Sep 17 00:00:00 2001 From: lathomasexport Date: Mon, 30 Nov 2020 02:43:24 +0100 Subject: [PATCH 1/2] Reordering modules, fixing boolean assignation for MC --- PhysicsTools/NanoAOD/python/nano_cff.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 89fbe3b2ca22f..9e1d09cfe258b 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -223,7 +223,6 @@ def nanoAOD_recalibrateMETs(process,isData): reclusterJets = cms.untracked.bool(False), ) run2_nanoAOD_106Xv1.toModify(nanoAOD_PuppiV15_switch,recoMetFromPFCs=True,reclusterJets=True) - runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi", recoMetFromPFCs=bool(nanoAOD_PuppiV15_switch.recoMetFromPFCs), reclusterJets=bool(nanoAOD_PuppiV15_switch.reclusterJets)) if nanoAOD_PuppiV15_switch.reclusterJets: from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask @@ -242,11 +241,13 @@ def nanoAOD_recalibrateMETs(process,isData): muSource =cms.InputTag( 'slimmedMuons'), elSource = cms.InputTag('slimmedElectrons'), genParticles= cms.InputTag('prunedGenParticles'), - getJetMCFlavour=False + getJetMCFlavour= not isData ) - process.patJetsPuppi.addGenPartonMatch = cms.bool(False) - process.patJetsPuppi.addGenJetMatch = cms.bool(False) + process.patJetsPuppi.addGenPartonMatch = cms.bool(not isData) + process.patJetsPuppi.addGenJetMatch = cms.bool(not isData) + + runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi", recoMetFromPFCs=bool(nanoAOD_PuppiV15_switch.recoMetFromPFCs), reclusterJets=bool(nanoAOD_PuppiV15_switch.reclusterJets)) process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(process.jetSequence),cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi)) return process From 649b0afad86ada77117c28d91cf0c7a74b2e7e30 Mon Sep 17 00:00:00 2001 From: lathomasexport Date: Mon, 30 Nov 2020 17:33:41 +0100 Subject: [PATCH 2/2] Switching off jet matching for PUPPI --- PhysicsTools/NanoAOD/python/nano_cff.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 9e1d09cfe258b..2b0167f3f48a1 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -241,11 +241,11 @@ def nanoAOD_recalibrateMETs(process,isData): muSource =cms.InputTag( 'slimmedMuons'), elSource = cms.InputTag('slimmedElectrons'), genParticles= cms.InputTag('prunedGenParticles'), - getJetMCFlavour= not isData + getJetMCFlavour= False ) - process.patJetsPuppi.addGenPartonMatch = cms.bool(not isData) - process.patJetsPuppi.addGenJetMatch = cms.bool(not isData) + process.patJetsPuppi.addGenPartonMatch = cms.bool(False) + process.patJetsPuppi.addGenJetMatch = cms.bool(False) runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi", recoMetFromPFCs=bool(nanoAOD_PuppiV15_switch.recoMetFromPFCs), reclusterJets=bool(nanoAOD_PuppiV15_switch.reclusterJets)) process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(process.jetSequence),cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi))