Skip to content

Commit

Permalink
puppi v14
Browse files Browse the repository at this point in the history
  • Loading branch information
ahinzmann committed Apr 28, 2020
1 parent ee772d4 commit e76e650
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
6 changes: 4 additions & 2 deletions CommonTools/PileupAlgos/plugins/PuppiProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ PuppiProducer::PuppiProducer(const edm::ParameterSet& iConfig) {
fUseFromPVLooseTight = iConfig.getParameter<bool>("UseFromPVLooseTight");
fUseDZ = iConfig.getParameter<bool>("UseDeltaZCut");
fDZCut = iConfig.getParameter<double>("DeltaZCut");
fEtaMinUseDZ = iConfig.getParameter<double>("EtaMinUseDeltaZ");
fPtMaxCharged = iConfig.getParameter<double>("PtMaxCharged");
fEtaMaxCharged = iConfig.getParameter<double>("EtaMaxCharged");
fUseExistingWeights = iConfig.getParameter<bool>("useExistingWeights");
Expand Down Expand Up @@ -154,7 +155,7 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
pReco.id = 1;
else if (std::abs(pReco.eta) > fEtaMaxCharged)
pReco.id = 1;
else if (fUseDZ)
else if ((fUseDZ) && (std::abs(pReco.eta) >= fEtaMinUseDZ))
pReco.id = (std::abs(pDZ) < fDZCut) ? 1 : 2;
else if (fUseFromPVLooseTight && tmpFromPV == 1)
pReco.id = 2;
Expand All @@ -180,7 +181,7 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
pReco.id = 1;
else if (std::abs(pReco.eta) > fEtaMaxCharged)
pReco.id = 1;
else if (fUseDZ)
else if ((fUseDZ) && (std::abs(pReco.eta) >= fEtaMinUseDZ))
pReco.id = (std::abs(pDZ) < fDZCut) ? 1 : 2;
else if (fUseFromPVLooseTight && lPack->fromPV() == (pat::PackedCandidate::PVLoose))
pReco.id = 2;
Expand Down Expand Up @@ -355,6 +356,7 @@ void PuppiProducer::fillDescriptions(edm::ConfigurationDescriptions& description
desc.add<bool>("UseFromPVLooseTight", false);
desc.add<bool>("UseDeltaZCut", true);
desc.add<double>("DeltaZCut", 0.3);
desc.add<double>("EtaMinUseDeltaZ", 0.);
desc.add<double>("PtMaxCharged", 0.);
desc.add<double>("EtaMaxCharged", 99999.);
desc.add<double>("PtMaxNeutrals", 200.);
Expand Down
1 change: 1 addition & 0 deletions CommonTools/PileupAlgos/plugins/PuppiProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class PuppiProducer : public edm::stream::EDProducer<> {
bool fUseFromPVLooseTight;
bool fUseDZ;
float fDZCut;
double fEtaMinUseDZ;
double fPtMaxCharged;
double fEtaMaxCharged;
bool fUseExistingWeights;
Expand Down
9 changes: 9 additions & 0 deletions CommonTools/PileupAlgos/python/Puppi_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
puppiForLeptons = cms.bool(False),
UseFromPVLooseTight = cms.bool(False),
UseDeltaZCut = cms.bool(True),
EtaMinUseDeltaZ = cms.double(0.),
DeltaZCut = cms.double(0.3),
PtMaxCharged = cms.double(0.),
EtaMaxCharged = cms.double(99999.),
Expand Down Expand Up @@ -114,3 +115,11 @@
)
)
)

from Configuration.Eras.Modifier_run2_miniAOD_devel_cff import run2_miniAOD_devel
run2_miniAOD_devel.toModify(
puppi,
EtaMinUseDeltaZ = 2.4,
PtMaxCharged = 20.,
PtMaxNeutralsStartSlope = 20.
)
14 changes: 5 additions & 9 deletions CommonTools/PileupAlgos/python/customizePuppiTune_cff.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import FWCore.ParameterSet.Config as cms

def UpdatePuppiTuneV13(process):
def UpdatePuppiTuneV14(process):
#
# Adapt for re-running PUPPI
#
print("customizePuppiTune_cff::UpdatePuppiTuneV13: Recomputing PUPPI with Tune v13, slimmedJetsPuppi and slimmedMETsPuppi")
print("customizePuppiTune_cff::UpdatePuppiTuneV14: Recomputing PUPPI with Tune v14, slimmedJetsPuppi and slimmedMETsPuppi")
from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask
task = getPatAlgosToolsTask(process)
from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD
Expand All @@ -26,15 +26,11 @@ def UpdatePuppiTuneV13(process):
del process.updatedPatJetsPuppiJetSpecific
process.puppiSequence = cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi+process.patPuppiJetSpecificProducer+process.slimmedJetsPuppi)
#
# Adapt for PUPPI tune V13
# Adapt for PUPPI tune V14
#
process.puppi.UseFromPVLooseTight = False
process.puppi.UseDeltaZCut = False
process.puppi.PtMaxCharged = 20.
process.puppi.EtaMaxCharged = 2.5
process.puppi.EtaMinUseDeltaZ = 2.4
process.puppi.PtMaxNeutralsStartSlope = 20.
process.puppiNoLep.UseFromPVLooseTight = False
process.puppiNoLep.UseDeltaZCut = False
process.puppiNoLep.PtMaxCharged = 20.
process.puppiNoLep.EtaMaxCharged = 2.5
process.puppiNoLep.EtaMinUseDeltaZ = 2.4
process.puppiNoLep.PtMaxNeutralsStartSlope = 20.

0 comments on commit e76e650

Please sign in to comment.