CMS 3D CMS Logo

Public Member Functions

JetCorrExtractorT< T > Class Template Reference

#include <JetCorrExtractorT.h>

List of all members.

Public Member Functions

reco::Candidate::LorentzVector operator() (const T &rawJet, const std::string &jetCorrLabel, const edm::Event *evt=0, const edm::EventSetup *es=0, double jetCorrEtaMax=9.9, const reco::Candidate::LorentzVector *rawJetP4_specified=0)

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
Version:
Revision:
1.4
Id:
JetCorrExtractorT.h,v 1.4 2011/11/20 10:25:47 veelken Exp

Definition at line 52 of file JetCorrExtractorT.h.


Member Function Documentation

template<typename T >
reco::Candidate::LorentzVector JetCorrExtractorT< T >::operator() ( const T rawJet,
const std::string &  jetCorrLabel,
const edm::Event evt = 0,
const edm::EventSetup es = 0,
double  jetCorrEtaMax = 9.9,
const reco::Candidate::LorentzVector rawJetP4_specified = 0 
) [inline]

Definition at line 56 of file JetCorrExtractorT.h.

  {
    // "general" implementation requires access to edm::Event and edm::EventSetup,
    // only specialization for pat::Jets doesn't
    assert(evt && es);

    // allow to specify four-vector to be used as "raw" (uncorrected) jet momentum,
    // call 'rawJet.p4()' in case four-vector not specified explicitely
    reco::Candidate::LorentzVector rawJetP4 = ( rawJetP4_specified ) ?
      (*rawJetP4_specified) : rawJet.p4();

    // restrict computation of JEC factors to region |eta| < 4.7,
    // to work around problem with CMSSW_4_2_x JEC factors at high eta,
    // reported in
    //  https://hypernews.cern.ch/HyperNews/CMS/get/jes/270.html
    //  https://hypernews.cern.ch/HyperNews/CMS/get/JetMET/1259/1.html
    double jetCorrFactor = 1.;
    if ( fabs(rawJetP4.eta()) < jetCorrEtaMax ) {      
      jetCorrFactor = getCorrection(rawJet, jetCorrLabel, *evt, *es);
    } else {
      reco::Candidate::PolarLorentzVector modJetPolarP4(rawJetP4);
      modJetPolarP4.SetEta(sign(rawJetP4.eta())*jetCorrEtaMax);
      
      reco::Candidate::LorentzVector modJetP4(modJetPolarP4);
      
      T modJet(rawJet);
      modJet.setP4(modJetP4);
      
      jetCorrFactor = getCorrection(modJet, jetCorrLabel, *evt, *es);
    }

    reco::Candidate::LorentzVector corrJetP4 = rawJetP4;
    corrJetP4 *= jetCorrFactor;

    return corrJetP4;
  }