From f249c97cde4de487715f0c8f74b30a66733e89f7 Mon Sep 17 00:00:00 2001 From: Andreas Hinzmann Date: Fri, 31 Jan 2020 23:07:53 +0100 Subject: [PATCH] add customizer --- .../python/customizePuppiTune_cff.py | 40 +++++++++++++++++++ PhysicsTools/NanoAOD/python/custom_jme_cff.py | 39 ------------------ 2 files changed, 40 insertions(+), 39 deletions(-) create mode 100644 CommonTools/PileupAlgos/python/customizePuppiTune_cff.py diff --git a/CommonTools/PileupAlgos/python/customizePuppiTune_cff.py b/CommonTools/PileupAlgos/python/customizePuppiTune_cff.py new file mode 100644 index 0000000000000..1db1946587647 --- /dev/null +++ b/CommonTools/PileupAlgos/python/customizePuppiTune_cff.py @@ -0,0 +1,40 @@ +import FWCore.ParameterSet.Config as cms + +def UpdatePuppiTuneV13(process): + # + # Adapt for re-running PUPPI + # + print("customizePuppiTune_cff::UpdatePuppiTuneV13: Recomputing PUPPI with Tune v13, slimmedJetsPuppi and slimmedMETsPuppi") + from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask + task = getPatAlgosToolsTask(process) + from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD + makePuppiesFromMiniAOD(process,True) + process.puppi.useExistingWeights = False + process.puppiNoLep.useExistingWeights = False + from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD + runMetCorAndUncFromMiniAOD(process,isData=False,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi",recoMetFromPFCs=True,pfCandColl=cms.InputTag("puppiForMET")) + from PhysicsTools.PatAlgos.patPuppiJetSpecificProducer_cfi import patPuppiJetSpecificProducer + addToProcessAndTask('patPuppiJetSpecificProducer', patPuppiJetSpecificProducer.clone(src=cms.InputTag("patJetsPuppi")), process, task) + from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection + updateJetCollection( + process, + labelName = 'PuppiJetSpecific', + jetSource = cms.InputTag('patJetsPuppi'), + ) + process.updatedPatJetsPuppiJetSpecific.userData.userFloats.src = ['patPuppiJetSpecificProducer:puppiMultiplicity', 'patPuppiJetSpecificProducer:neutralPuppiMultiplicity', 'patPuppiJetSpecificProducer:neutralHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:photonPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFEMPuppiMultiplicity' ] + addToProcessAndTask('slimmedJetsPuppi', process.updatedPatJetsPuppiJetSpecific.clone(), process, task) + del process.updatedPatJetsPuppiJetSpecific + process.puppiSequence = cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi+process.patPuppiJetSpecificProducer+process.slimmedJetsPuppi) + # + # Adapt for PUPPI tune V13 + # + process.puppi.UseFromPVLooseTight = False + process.puppi.UseDeltaZCut = False + process.puppi.PtMaxCharged = 20. + process.puppi.EtaMaxCharged = 2.5 + process.puppi.PtMaxNeutralsStartSlope = 20. + process.puppiNoLep.UseFromPVLooseTight = False + process.puppiNoLep.UseDeltaZCut = False + process.puppiNoLep.PtMaxCharged = 20. + process.puppiNoLep.EtaMaxCharged = 2.5 + process.puppiNoLep.PtMaxNeutralsStartSlope = 20. diff --git a/PhysicsTools/NanoAOD/python/custom_jme_cff.py b/PhysicsTools/NanoAOD/python/custom_jme_cff.py index 1025de9fbf5e2..8c4396a42eed4 100644 --- a/PhysicsTools/NanoAOD/python/custom_jme_cff.py +++ b/PhysicsTools/NanoAOD/python/custom_jme_cff.py @@ -487,42 +487,3 @@ def PrepJMECustomNanoAOD(process): process.nanoSequenceMC += recoJA.getSequence(process) process.nanoSequenceMC += tableRecoJA.getSequence(process) - -def UpdatePuppiTuneV13(process): - # - # Adapt for re-running PUPPI - # - print("custom_jme_cff::UpdatePuppiTuneV13: Recomputing PUPPI with Tune v13, slimmedJetsPuppi and slimmedMETsPuppi") - from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD - makePuppiesFromMiniAOD(process,True) - process.puppi.useExistingWeights = False - process.puppiNoLep.useExistingWeights = False - from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD - runMetCorAndUncFromMiniAOD(process,isData=False,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi",recoMetFromPFCs=True,pfCandColl=cms.InputTag("puppiForMET")) - process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(process.jetSequence),cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi)) - from PhysicsTools.PatAlgos.patPuppiJetSpecificProducer_cfi import patPuppiJetSpecificProducer - process.patPuppiJetSpecificProducer = patPuppiJetSpecificProducer.clone( - src=cms.InputTag("patJetsPuppi"), - ) - from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection - updateJetCollection( - process, - labelName = 'PuppiJetSpecific', - jetSource = cms.InputTag('patJetsPuppi'), - ) - process.updatedPatJetsPuppiJetSpecific.userData.userFloats.src = ['patPuppiJetSpecificProducer:puppiMultiplicity', 'patPuppiJetSpecificProducer:neutralPuppiMultiplicity', 'patPuppiJetSpecificProducer:neutralHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:photonPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFEMPuppiMultiplicity' ] - process.slimmedJetsPuppi = process.updatedPatJetsPuppiJetSpecific.clone() - process.jetSequence.insert(0, cms.Sequence(process.patPuppiJetSpecificProducer+process.slimmedJetsPuppi)) - # - # Adapt for PUPPI tune V13 - # - process.puppi.UseFromPVLooseTight = False - process.puppi.UseDeltaZCut = False - process.puppi.PtMaxCharged = 20. - process.puppi.EtaMaxCharged = 2.5 - process.puppi.PtMaxNeutralsStartSlope = 20. - process.puppiNoLep.UseFromPVLooseTight = False - process.puppiNoLep.UseDeltaZCut = False - process.puppiNoLep.PtMaxCharged = 20. - process.puppiNoLep.EtaMaxCharged = 2.5 - process.puppiNoLep.PtMaxNeutralsStartSlope = 20.