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=nullptr) const
 
reco::Candidate::LorentzVector operator() (const T &rawJet, const std::string &jetCorrLabel, double jetCorrEtaMax=9.9, const reco::Candidate::LorentzVector *const rawJetP4_specified=nullptr) 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 42 of file JetCorrExtractorT.h.

Member Function Documentation

◆ getCorrection()

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

Definition at line 92 of file JetCorrExtractorT.h.

References reco::JetCorrector::correction(), and metsig::jet.

Referenced by JetReCalibrator.JetReCalibrator::correct(), and JetCorrExtractorT< T >::operator()().

92 { return jetCorr->correction(jet); }
double correction(const LorentzVector &fJet) const
get correction using Jet information only
Definition: JetCorrector.h:46

◆ operator()() [1/2]

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 = nullptr 
) const
inline

Definition at line 44 of file JetCorrExtractorT.h.

References JetCorrExtractorT< T >::getCorrection(), HLT_2022v15_cff::jetCorrEtaMax, and jetcorrextractor::sign().

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

◆ operator()() [2/2]

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 = nullptr 
) const
inline

Definition at line 78 of file JetCorrExtractorT.h.

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