CMS 3D CMS Logo

Public Member Functions | Private Attributes

L1OffsetCorrector Class Reference

#include <L1OffsetCorrector.h>

Inheritance diagram for L1OffsetCorrector:
JetCorrector

List of all members.

Public Member Functions

virtual double correction (const LorentzVector &fJet) const
 get correction using Jet information only
virtual double correction (const reco::Jet &fJet) const
 apply correction using Jet information only
virtual double correction (const reco::Jet &fJet, const edm::RefToBase< reco::Jet > &fJetRef, const edm::Event &fEvent, const edm::EventSetup &fSetup) const
 apply correction using all event information
virtual bool eventRequired () const
 if correction needs event information
 L1OffsetCorrector (const JetCorrectorParameters &fConfig, const edm::ParameterSet &fParameters)
virtual ~L1OffsetCorrector ()

Private Attributes

FactorizedJetCorrectormCorrector
int mMinVtxNdof
std::string mVertexCollName

Detailed Description

Definition at line 17 of file L1OffsetCorrector.h.


Constructor & Destructor Documentation

L1OffsetCorrector::L1OffsetCorrector ( const JetCorrectorParameters fConfig,
const edm::ParameterSet fParameters 
)

Definition at line 22 of file L1OffsetCorrector.cc.

References JetCorrectorParameters::definitions(), and edm::ParameterSet::getParameter().

{
  mVertexCollName = fConfig.getParameter<std::string>("vertexCollection");
  mMinVtxNdof     = fConfig.getParameter<int>("minVtxNdof");
  if (fParam.definitions().level() != "L1Offset")
    throw cms::Exception("L1OffsetCorrector")<<" correction level: "<<fParam.definitions().level()<<" is not L1Offset"; 
  vector<JetCorrectorParameters> vParam;
  vParam.push_back(fParam);
  mCorrector = new FactorizedJetCorrector(vParam);
}
L1OffsetCorrector::~L1OffsetCorrector ( ) [virtual]

Definition at line 35 of file L1OffsetCorrector.cc.

{
  delete mCorrector;
} 

Member Function Documentation

double L1OffsetCorrector::correction ( const LorentzVector fJet) const [virtual]

get correction using Jet information only

Implements JetCorrector.

Definition at line 42 of file L1OffsetCorrector.cc.

References Exception.

{
  throw cms::Exception("EventRequired")
    <<"Wrong interface correction(LorentzVector), event required!";
  return 1.0;
}
double L1OffsetCorrector::correction ( const reco::Jet fJet) const [virtual]

apply correction using Jet information only

Implements JetCorrector.

Definition at line 51 of file L1OffsetCorrector.cc.

References Exception.

{
  throw cms::Exception("EventRequired")
    <<"Wrong interface correction(reco::Jet), event required!";
  return 1.0;
}
double L1OffsetCorrector::correction ( const reco::Jet fJet,
const edm::RefToBase< reco::Jet > &  fJetRef,
const edm::Event fEvent,
const edm::EventSetup fSetup 
) const [virtual]

apply correction using all event information

Reimplemented from JetCorrector.

Definition at line 60 of file L1OffsetCorrector.cc.

References reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), edm::Event::getByLabel(), and query::result.

{
  double result = 1.;
  edm::Handle<reco::VertexCollection> recVtxs;
  fEvent.getByLabel(mVertexCollName,recVtxs);
  int NPV(0);
  for(unsigned int ind=0;ind<recVtxs->size();ind++) {
    if (!((*recVtxs)[ind].isFake()) && (*recVtxs)[ind].ndof() > mMinVtxNdof) {
      NPV++;
    }
  } 
  if (NPV > 0) {
    mCorrector->setJetEta(fJet.eta());
    mCorrector->setJetE(fJet.energy());
    mCorrector->setNPV(NPV);
    result = mCorrector->getCorrection();
  }
  return result;
}
virtual bool L1OffsetCorrector::eventRequired ( ) const [inline, virtual]

if correction needs event information

Implements JetCorrector.

Definition at line 39 of file L1OffsetCorrector.h.

{return true;} 

Member Data Documentation

Definition at line 45 of file L1OffsetCorrector.h.

Definition at line 44 of file L1OffsetCorrector.h.

std::string L1OffsetCorrector::mVertexCollName [private]

Definition at line 43 of file L1OffsetCorrector.h.