From 7174e335d5a1c7081c9e8ad7628518ec282bd89b Mon Sep 17 00:00:00 2001 From: Nurfikri Norjoharuddeen Date: Mon, 13 Feb 2023 07:22:01 +0100 Subject: [PATCH] Make photon protection for existing puppi weights an option. Default is switched off. --- CommonTools/PileupAlgos/plugins/PuppiProducer.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc index ff386726f54c4..515fd2b1e125b 100644 --- a/CommonTools/PileupAlgos/plugins/PuppiProducer.cc +++ b/CommonTools/PileupAlgos/plugins/PuppiProducer.cc @@ -80,6 +80,7 @@ class PuppiProducer : public edm::stream::EDProducer<> { uint fNumOfPUVtxsForCharged; double fDZCutForChargedFromPUVtxs; bool fUseExistingWeights; + bool fApplyPhotonProtectionForExistingWeights; bool fClonePackedCands; int fVtxNdofCut; double fVtxZCut; @@ -104,6 +105,7 @@ PuppiProducer::PuppiProducer(const edm::ParameterSet& iConfig) { fNumOfPUVtxsForCharged = iConfig.getParameter("NumOfPUVtxsForCharged"); fDZCutForChargedFromPUVtxs = iConfig.getParameter("DeltaZCutForChargedFromPUVtxs"); fUseExistingWeights = iConfig.getParameter("useExistingWeights"); + fApplyPhotonProtectionForExistingWeights = iConfig.getParameter("applyPhotonProtectionForExistingWeights"); fClonePackedCands = iConfig.getParameter("clonePackedCands"); fVtxNdofCut = iConfig.getParameter("vtxNdofCut"); fVtxZCut = iConfig.getParameter("vtxZCut"); @@ -363,9 +365,9 @@ void PuppiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { curpupweight = lPack->puppiWeight(); } } - // Protect high pT photons (important for gamma to hadronic recoil balance) - if ((fPtMaxPhotons > 0) && (lPack->pdgId() == 22) && (std::abs(lPack->eta()) < fEtaMaxPhotons) && - (lPack->pt() > fPtMaxPhotons)) + // Optional: Protect high pT photons (important for gamma to hadronic recoil balance) for existing weights. + if (fApplyPhotonProtectionForExistingWeights && (fPtMaxPhotons > 0) && (lPack->pdgId() == 22) && + (std::abs(lPack->eta()) < fEtaMaxPhotons) && (lPack->pt() > fPtMaxPhotons)) curpupweight = 1; lWeights.push_back(curpupweight); lPackCtr++; @@ -511,6 +513,7 @@ void PuppiProducer::fillDescriptions(edm::ConfigurationDescriptions& description desc.add("NumOfPUVtxsForCharged", 0); desc.add("DeltaZCutForChargedFromPUVtxs", 0.2); desc.add("useExistingWeights", false); + desc.add("applyPhotonProtectionForExistingWeights", false); desc.add("clonePackedCands", false); desc.add("vtxNdofCut", 4); desc.add("vtxZCut", 24);