CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

L6SLBCorrector Class Reference

#include <L6SLBCorrector.h>

Inheritance diagram for L6SLBCorrector:
JetCorrector

List of all members.

Public Member Functions

virtual double correction (const LorentzVector &fJet) const
 apply 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 > &refToRawJet, const edm::Event &fEvent, const edm::EventSetup &fSetup) const
 apply correction using all event information
virtual bool eventRequired () const
 if correction needs event information
 L6SLBCorrector (const JetCorrectorParameters &fParam, const edm::ParameterSet &fConfig)
virtual bool refRequired () const
 if correction needs the jet reference
virtual ~L6SLBCorrector ()

Private Member Functions

int getBTagInfoIndex (const edm::RefToBase< reco::Jet > &refToRawJet, const std::vector< reco::SoftLeptonTagInfo > &tags) const

Private Attributes

bool addMuonToJet_
FactorizedJetCorrectorcorrector_
edm::InputTag srcBTagInfoElec_
edm::InputTag srcBTagInfoMuon_
std::string tagName_

Detailed Description

Definition at line 19 of file L6SLBCorrector.h.


Constructor & Destructor Documentation

L6SLBCorrector::L6SLBCorrector ( const JetCorrectorParameters fParam,
const edm::ParameterSet fConfig 
)

Definition at line 31 of file L6SLBCorrector.cc.

References corrector_.

  : addMuonToJet_(fConfig.getParameter<bool>("addMuonToJet"))
  , srcBTagInfoElec_(fConfig.getParameter<edm::InputTag>("srcBTagInfoElectron"))
  , srcBTagInfoMuon_(fConfig.getParameter<edm::InputTag>("srcBTagInfoMuon"))
  , corrector_(0)
{
  vector<JetCorrectorParameters> vParam;
  vParam.push_back(fParam);
  corrector_ = new FactorizedJetCorrector(vParam);
}
L6SLBCorrector::~L6SLBCorrector ( ) [virtual]

Definition at line 43 of file L6SLBCorrector.cc.

References corrector_.

{
  delete corrector_;
} 

Member Function Documentation

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

apply correction using Jet information only

Implements JetCorrector.

Definition at line 54 of file L6SLBCorrector.cc.

References Exception.

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

apply correction using Jet information only

Implements JetCorrector.

Definition at line 63 of file L6SLBCorrector.cc.

References Exception.

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

apply correction using all event information

Reimplemented from JetCorrector.

Definition at line 72 of file L6SLBCorrector.cc.

References addMuonToJet_, corrector_, reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), getBTagInfoIndex(), edm::Event::getByLabel(), FactorizedJetCorrector::getCorrection(), reco::SoftLeptonTagInfo::lepton(), reco::SoftLeptonTagInfo::leptons(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), FactorizedJetCorrector::setAddLepToJet(), FactorizedJetCorrector::setJetE(), FactorizedJetCorrector::setJetEta(), FactorizedJetCorrector::setJetPhi(), FactorizedJetCorrector::setJetPt(), FactorizedJetCorrector::setLepPx(), FactorizedJetCorrector::setLepPy(), FactorizedJetCorrector::setLepPz(), srcBTagInfoElec_, and srcBTagInfoMuon_.

{
  corrector_->setJetPt(fJet.pt());
  corrector_->setJetEta(fJet.eta());
  corrector_->setJetPhi(fJet.phi());
  corrector_->setJetE(fJet.energy());
  
  edm::Handle< vector<reco::SoftLeptonTagInfo> > muoninfos;
  fEvent.getByLabel(srcBTagInfoMuon_,muoninfos);
  
  const reco::SoftLeptonTagInfo& sltMuon =
    (*muoninfos)[getBTagInfoIndex(refToRawJet,*muoninfos)];
  if (sltMuon.leptons()>0) {
    edm::RefToBase<reco::Track> trackRef = sltMuon.lepton(0);
    corrector_->setLepPx(trackRef->px());
    corrector_->setLepPy(trackRef->py());
    corrector_->setLepPz(trackRef->pz());
    corrector_->setAddLepToJet(addMuonToJet_);
    return corrector_->getCorrection();
  }
  else {
    edm::Handle< vector<reco::SoftLeptonTagInfo> > elecinfos;
    fEvent.getByLabel(srcBTagInfoElec_,elecinfos);
    const reco::SoftLeptonTagInfo& sltElec =
      (*elecinfos)[getBTagInfoIndex(refToRawJet,*elecinfos)];
    if (sltElec.leptons()>0) {
      edm::RefToBase<reco::Track> trackRef = sltElec.lepton(0);
      corrector_->setLepPx(trackRef->px());
      corrector_->setLepPy(trackRef->py());
      corrector_->setLepPz(trackRef->pz());
      corrector_->setAddLepToJet(false);
      return corrector_->getCorrection();
    }
  }
  return 1.0;
}
virtual bool L6SLBCorrector::eventRequired ( ) const [inline, virtual]

if correction needs event information

Implements JetCorrector.

Definition at line 44 of file L6SLBCorrector.h.

{return true;} 
int L6SLBCorrector::getBTagInfoIndex ( const edm::RefToBase< reco::Jet > &  refToRawJet,
const std::vector< reco::SoftLeptonTagInfo > &  tags 
) const [private]

Definition at line 118 of file L6SLBCorrector.cc.

References edm::RefToBase< T >::get(), i, and metsig::jet.

Referenced by correction().

{
  for (unsigned int i=0;i<tags.size();i++)
    if (tags[i].jet().get()==refToRawJet.get()) return i;
  return -1;
}
virtual bool L6SLBCorrector::refRequired ( ) const [inline, virtual]

if correction needs the jet reference

Implements JetCorrector.

Definition at line 47 of file L6SLBCorrector.h.

{return true;} 

Member Data Documentation

Definition at line 62 of file L6SLBCorrector.h.

Referenced by correction().

Definition at line 65 of file L6SLBCorrector.h.

Referenced by correction(), L6SLBCorrector(), and ~L6SLBCorrector().

Definition at line 63 of file L6SLBCorrector.h.

Referenced by correction().

Definition at line 64 of file L6SLBCorrector.h.

Referenced by correction().

std::string L6SLBCorrector::tagName_ [private]

Definition at line 61 of file L6SLBCorrector.h.