Skip to content

Commit

Permalink
Merge pull request #44050 from nurfikri89/from1410pre0_puppi_tauTune_…
Browse files Browse the repository at this point in the history
…fromPV2Recovery

[Puppi] Hadronic tau recovery with protection for fromPV==2 charged particles
  • Loading branch information
cmsbuild committed Apr 1, 2024
2 parents f8ce14a + dd92bc9 commit 1b3f760
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CommonTools/PileupAlgos/plugins/PuppiProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class PuppiProducer : public edm::stream::EDProducer<> {
bool fPuppiDiagnostics;
bool fPuppiNoLep;
bool fUseFromPVLooseTight;
bool fUseFromPV2Recovery;
bool fUseDZ;
bool fUseDZforPileup;
double fDZCut;
Expand All @@ -77,6 +78,7 @@ class PuppiProducer : public edm::stream::EDProducer<> {
double fEtaMaxCharged;
double fPtMaxPhotons;
double fEtaMaxPhotons;
double fPtMinForFromPV2Recovery;
uint fNumOfPUVtxsForCharged;
double fDZCutForChargedFromPUVtxs;
bool fUseExistingWeights;
Expand All @@ -94,6 +96,7 @@ PuppiProducer::PuppiProducer(const edm::ParameterSet& iConfig) {
fPuppiDiagnostics = iConfig.getParameter<bool>("puppiDiagnostics");
fPuppiNoLep = iConfig.getParameter<bool>("puppiNoLep");
fUseFromPVLooseTight = iConfig.getParameter<bool>("UseFromPVLooseTight");
fUseFromPV2Recovery = iConfig.getParameter<bool>("UseFromPV2Recovery");
fUseDZ = iConfig.getParameter<bool>("UseDeltaZCut");
fUseDZforPileup = iConfig.getParameter<bool>("UseDeltaZCutForPileup");
fDZCut = iConfig.getParameter<double>("DeltaZCut");
Expand All @@ -102,6 +105,7 @@ PuppiProducer::PuppiProducer(const edm::ParameterSet& iConfig) {
fEtaMaxCharged = iConfig.getParameter<double>("EtaMaxCharged");
fPtMaxPhotons = iConfig.getParameter<double>("PtMaxPhotons");
fEtaMaxPhotons = iConfig.getParameter<double>("EtaMaxPhotons");
fPtMinForFromPV2Recovery = iConfig.getParameter<double>("PtMinForFromPV2Recovery");
fNumOfPUVtxsForCharged = iConfig.getParameter<uint>("NumOfPUVtxsForCharged");
fDZCutForChargedFromPUVtxs = iConfig.getParameter<double>("DeltaZCutForChargedFromPUVtxs");
fUseExistingWeights = iConfig.getParameter<bool>("useExistingWeights");
Expand Down Expand Up @@ -285,6 +289,8 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
pReco.id = 1;
else if ((fUseDZ) && (std::abs(pReco.eta) >= fEtaMinUseDZ) && (std::abs(pDZ) < fDZCut))
pReco.id = 1;
else if (fUseFromPV2Recovery && tmpFromPV == 2 && (pReco.pt > fPtMinForFromPV2Recovery))
pReco.id = 1;
else if ((fUseDZforPileup) && (std::abs(pReco.eta) >= fEtaMinUseDZ) && (std::abs(pDZ) >= fDZCut))
pReco.id = 2;
else if (fUseFromPVLooseTight && tmpFromPV == 1)
Expand Down Expand Up @@ -328,6 +334,9 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
pReco.id = 1;
else if ((fUseDZ) && (std::abs(pReco.eta) >= fEtaMinUseDZ) && (std::abs(pDZ) < fDZCut))
pReco.id = 1;
else if (fUseFromPV2Recovery && lPack->fromPV() == (pat::PackedCandidate::PVTight) &&
(pReco.pt > fPtMinForFromPV2Recovery))
pReco.id = 1;
else if ((fUseDZforPileup) && (std::abs(pReco.eta) >= fEtaMinUseDZ) && (std::abs(pDZ) >= fDZCut))
pReco.id = 2;
else if (fUseFromPVLooseTight && lPack->fromPV() == (pat::PackedCandidate::PVLoose))
Expand Down Expand Up @@ -498,6 +507,7 @@ void PuppiProducer::fillDescriptions(edm::ConfigurationDescriptions& description
desc.add<bool>("puppiDiagnostics", false);
desc.add<bool>("puppiNoLep", false);
desc.add<bool>("UseFromPVLooseTight", false);
desc.add<bool>("UseFromPV2Recovery", false);
desc.add<bool>("UseDeltaZCut", true);
desc.add<bool>("UseDeltaZCutForPileup", true);
desc.add<double>("DeltaZCut", 0.3);
Expand All @@ -508,6 +518,7 @@ void PuppiProducer::fillDescriptions(edm::ConfigurationDescriptions& description
desc.add<double>("EtaMaxPhotons", 2.5);
desc.add<double>("PtMaxNeutrals", 200.);
desc.add<double>("PtMaxNeutralsStartSlope", 0.);
desc.add<double>("PtMinForFromPV2Recovery", 0.);
desc.add<uint>("NumOfPUVtxsForCharged", 0);
desc.add<double>("DeltaZCutForChargedFromPUVtxs", 0.2);
desc.add<bool>("useExistingWeights", false);
Expand Down
2 changes: 2 additions & 0 deletions CommonTools/PileupAlgos/python/Puppi_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
DeltaZCutForChargedFromPUVtxs = primaryVertexAssociationJME.assignment.DzCutForChargedFromPUVtxs,
PtMaxNeutralsStartSlope = 20.,
PtMaxPhotons = 20.,
UseFromPV2Recovery = True,
PtMinForFromPV2Recovery = 4.,
clonePackedCands = False, # should only be set to True for MiniAOD
algos = {
0: dict(
Expand Down

0 comments on commit 1b3f760

Please sign in to comment.