Skip to content

Commit

Permalink
Merge pull request #15249 from blinkseb/81x_smearedjetproducer_preven…
Browse files Browse the repository at this point in the history
…t_negative_smearing

[8.1.X] Prevent negative jet smearing factor
  • Loading branch information
davidlange6 committed Jul 23, 2016
2 parents df52a40 + b60c120 commit 01526bc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions PhysicsTools/PatUtils/interface/SmearedJetProducerT.h
Expand Up @@ -252,6 +252,17 @@ class SmearedJetProducerT : public edm::stream::EDProducer<> {
std::cout << "Impossible to smear this jet" << std::endl;
}

if (jet.energy() * smearFactor < MIN_JET_ENERGY) {
// Negative or too small smearFactor. We would change direction of the jet
// and this is not what we want.
// Recompute the smearing factor in order to have jet.energy() == MIN_JET_ENERGY
double newSmearFactor = MIN_JET_ENERGY / jet.energy();
if (m_debug) {
std::cout << "The smearing factor (" << smearFactor << ") is either negative or too small. Fixing it to " << newSmearFactor << " to avoid change of direction." << std::endl;
}
smearFactor = newSmearFactor;
}

T smearedJet = jet;
smearedJet.scaleEnergy(smearFactor);

Expand All @@ -269,6 +280,8 @@ class SmearedJetProducerT : public edm::stream::EDProducer<> {
}

private:
static constexpr const double MIN_JET_ENERGY = 1e-2;

edm::EDGetTokenT<JetCollection> m_jets_token;
edm::EDGetTokenT<double> m_rho_token;
bool m_enabled;
Expand Down

0 comments on commit 01526bc

Please sign in to comment.