CMS 3D CMS Logo

List of all members | Public Member Functions | Static Private Member Functions
PATJetCorrExtractor Class Reference

#include <PATJetCorrExtractor.h>

Public Member Functions

reco::Candidate::LorentzVector operator() (const pat::Jet rawJet, const reco::JetCorrector *jetCorr, double jetCorrEtaMax=9.9, const reco::Candidate::LorentzVector *const rawJetP4_specified=nullptr) const
 
reco::Candidate::LorentzVector operator() (const pat::Jet &jet, const std::string &jetCorrLabel, double jetCorrEtaMax=9.9, const reco::Candidate::LorentzVector *const rawJetP4_specified=nullptr) const
 

Static Private Member Functions

static std::string format_vstring (const std::vector< std::string > &v)
 

Detailed Description

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

NOTE: this specialization of the "generic" template defined in JetMETCorrections/Type1MET/interface/JetCorrExtractorT.h is to be used for pat::Jets only

Author
Christian Veelken, LLR

Definition at line 32 of file PATJetCorrExtractor.h.

Member Function Documentation

◆ format_vstring()

static std::string PATJetCorrExtractor::format_vstring ( const std::vector< std::string > &  v)
inlinestaticprivate

Definition at line 74 of file PATJetCorrExtractor.h.

References a, alignCSCRings::s, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and findQualityFiles::v.

Referenced by operator()().

74  {
75  std::string retVal;
76  auto ss = std::accumulate(v.begin(), v.end(), 0, [](int a, std::string const& s) { return a + s.length() + 2; });
77  retVal.reserve(ss);
78  for_each(v.begin(), v.end(), [&](std::string const& s) { retVal += (retVal.empty() ? "" : ", ") + s; });
79  return retVal;
80  }
double a
Definition: hdecay.h:119

◆ operator()() [1/2]

reco::Candidate::LorentzVector PATJetCorrExtractor::operator() ( const pat::Jet  rawJet,
const reco::JetCorrector jetCorr,
double  jetCorrEtaMax = 9.9,
const reco::Candidate::LorentzVector *const  rawJetP4_specified = nullptr 
) const
inline

Definition at line 34 of file PATJetCorrExtractor.h.

References HLT_2022v12_cff::jetCorrEtaMax.

38  {
39  JetCorrExtractorT<pat::Jet> jetCorrExtractor;
40  return jetCorrExtractor(rawJet, jetCorr, jetCorrEtaMax, rawJetP4_specified);
41  }

◆ operator()() [2/2]

reco::Candidate::LorentzVector PATJetCorrExtractor::operator() ( const pat::Jet jet,
const std::string &  jetCorrLabel,
double  jetCorrEtaMax = 9.9,
const reco::Candidate::LorentzVector *const  rawJetP4_specified = nullptr 
) const
inline

Definition at line 43 of file PATJetCorrExtractor.h.

References Exception, format_vstring(), metsig::jet, and jetMETDQMOfflineSource_cff::jetCorrLabel.

47  {
49 
50  try {
51  corrJetP4 = jet.correctedP4(jetCorrLabel);
52  if (rawJetP4_specified != nullptr) {
53  //MM: compensate for potential removal of constituents (as muons)
54  //similar effect in JetMETCorrection/Type1MET/interface/JetCorrExtractor.h
55  reco::Candidate::LorentzVector rawJetP4 = jet.correctedP4("Uncorrected");
56  double corrFactor = corrJetP4.pt() / rawJetP4.pt();
57  corrJetP4 = (*rawJetP4_specified);
58  corrJetP4 *= corrFactor;
59  if (corrFactor < 0) {
60  edm::LogWarning("PATJetCorrExtractor") << "Negative jet energy scale correction noticed"
61  << ".\n";
62  }
63  }
64  } catch (cms::Exception const&) {
65  throw cms::Exception("InvalidRequest")
66  << "The JEC level " << jetCorrLabel << " does not exist !!\n"
67  << "Available levels = { " << format_vstring(jet.availableJECLevels()) << " }.\n";
68  }
69 
70  return corrJetP4;
71  }
static std::string format_vstring(const std::vector< std::string > &v)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
Log< level::Warning, false > LogWarning