Skip to content

Commit

Permalink
Merge pull request #1 from nurfikri89/from1300pre4_fromJihoon_pujetid…
Browse files Browse the repository at this point in the history
…_fix_withpuppiproducerfix

Make photon protection for existing weights an option
  • Loading branch information
jshin96 committed Feb 13, 2023
2 parents 703a7cd + 7174e33 commit fbcf9bc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CommonTools/PileupAlgos/plugins/PuppiProducer.cc
Expand Up @@ -80,6 +80,7 @@ class PuppiProducer : public edm::stream::EDProducer<> {
uint fNumOfPUVtxsForCharged;
double fDZCutForChargedFromPUVtxs;
bool fUseExistingWeights;
bool fApplyPhotonProtectionForExistingWeights;
bool fClonePackedCands;
int fVtxNdofCut;
double fVtxZCut;
Expand All @@ -104,6 +105,7 @@ PuppiProducer::PuppiProducer(const edm::ParameterSet& iConfig) {
fNumOfPUVtxsForCharged = iConfig.getParameter<uint>("NumOfPUVtxsForCharged");
fDZCutForChargedFromPUVtxs = iConfig.getParameter<double>("DeltaZCutForChargedFromPUVtxs");
fUseExistingWeights = iConfig.getParameter<bool>("useExistingWeights");
fApplyPhotonProtectionForExistingWeights = iConfig.getParameter<bool>("applyPhotonProtectionForExistingWeights");
fClonePackedCands = iConfig.getParameter<bool>("clonePackedCands");
fVtxNdofCut = iConfig.getParameter<int>("vtxNdofCut");
fVtxZCut = iConfig.getParameter<double>("vtxZCut");
Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -511,6 +513,7 @@ void PuppiProducer::fillDescriptions(edm::ConfigurationDescriptions& description
desc.add<uint>("NumOfPUVtxsForCharged", 0);
desc.add<double>("DeltaZCutForChargedFromPUVtxs", 0.2);
desc.add<bool>("useExistingWeights", false);
desc.add<bool>("applyPhotonProtectionForExistingWeights", false);
desc.add<bool>("clonePackedCands", false);
desc.add<int>("vtxNdofCut", 4);
desc.add<double>("vtxZCut", 24);
Expand Down

0 comments on commit fbcf9bc

Please sign in to comment.