CMS 3D CMS Logo

List of all members | Public Member Functions | Static Private Member Functions
JetCorrExtractorT< T > Class Template Reference

#include <JetCorrExtractorT.h>

Public Member Functions

reco::Candidate::LorentzVector operator() (const T &rawJet, const reco::JetCorrector *jetCorr, double jetCorrEtaMax=9.9, const reco::Candidate::LorentzVector *const rawJetP4_specified=0) const
 
reco::Candidate::LorentzVector operator() (const T &rawJet, const std::string &jetCorrLabel, double jetCorrEtaMax=9.9, const reco::Candidate::LorentzVector *const rawJetP4_specified=0) const
 

Static Private Member Functions

static double getCorrection (const T &jet, const reco::JetCorrector *jetCorr)
 

Detailed Description

template<typename T>
class JetCorrExtractorT< T >

Retrieve jet energy correction factor for o reco::CaloJets o reco::PFJets o pat::Jets (of either PF-type or Calo-type)

NOTE: this "general" implementation is to be used for reco::CaloJets and reco::PFJets, not for pat::Jets

Author
Christian Veelken, LLR

Definition at line 41 of file JetCorrExtractorT.h.

Member Function Documentation

template<typename T>
static double JetCorrExtractorT< T >::getCorrection ( const T jet,
const reco::JetCorrector jetCorr 
)
inlinestaticprivate

Definition at line 93 of file JetCorrExtractorT.h.

References reco::JetCorrector::correction().

Referenced by JetReCalibrator.JetReCalibrator::correct().

94  {
95  return jetCorr->correction(jet);
96  }
double correction(const LorentzVector &fJet) const
get correction using Jet information only
Definition: JetCorrector.h:47
template<typename T>
reco::Candidate::LorentzVector JetCorrExtractorT< T >::operator() ( const T rawJet,
const reco::JetCorrector jetCorr,
double  jetCorrEtaMax = 9.9,
const reco::Candidate::LorentzVector *const  rawJetP4_specified = 0 
) const
inline

Definition at line 45 of file JetCorrExtractorT.h.

References patCaloMETCorrections_cff::jetCorrEtaMax, and jetcorrextractor::sign().

48  {
49 
50  // allow to specify four-vector to be used as "raw" (uncorrected) jet momentum,
51  // call 'rawJet.p4()' in case four-vector not specified explicitely
52  reco::Candidate::LorentzVector rawJetP4 = ( rawJetP4_specified ) ?
53  (*rawJetP4_specified) : rawJet.p4();
54 
55  double jetCorrFactor = 1.;
56  if ( fabs(rawJetP4.eta()) < jetCorrEtaMax ) {
57  jetCorrFactor = getCorrection(rawJet, jetCorr);
58  } else {
59  reco::Candidate::PolarLorentzVector modJetPolarP4(rawJetP4);
60  modJetPolarP4.SetEta(jetcorrextractor::sign(rawJetP4.eta())*jetCorrEtaMax);
61 
62  reco::Candidate::LorentzVector modJetP4(modJetPolarP4);
63 
64  T modJet(rawJet);
65  modJet.setP4(modJetP4);
66 
67  jetCorrFactor = getCorrection(modJet, jetCorr);
68  if(jetCorrFactor<0) {
69  edm::LogWarning("JetCorrExtractor") << "Negative jet energy scale correction noticed" << ".\n";
70  }
71  }
72 
73  reco::Candidate::LorentzVector corrJetP4 = rawJetP4;
74  corrJetP4 *= jetCorrFactor;
75 
76  return corrJetP4;
77  }
double sign(double x)
static double getCorrection(const T &jet, const reco::JetCorrector *jetCorr)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
long double T
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39
template<typename T>
reco::Candidate::LorentzVector JetCorrExtractorT< T >::operator() ( const T rawJet,
const std::string &  jetCorrLabel,
double  jetCorrEtaMax = 9.9,
const reco::Candidate::LorentzVector *const  rawJetP4_specified = 0 
) const
inline

Definition at line 79 of file JetCorrExtractorT.h.

82  {
83  edm::LogWarning("JetCorrExtractor") << "JetCorrExtractorT<T>::operator(const T&, const std::string&, ...) is deprecated.\n"
84  << "Please use JetCorrExtractorT<T>::operator(const T&, const reco::JetCorrector*, ...) instead.\n"
85  << "Jet remains uncorrected!";
86  reco::Candidate::LorentzVector rawJetP4 = ( rawJetP4_specified ) ?
87  (*rawJetP4_specified) : rawJet.p4();
88  return rawJetP4;
89  }
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37