CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L6SLBCorrector Class Reference

#include <L6SLBCorrector.h>

Inheritance diagram for L6SLBCorrector:
JetCorrector

Public Member Functions

double correction (const LorentzVector &fJet) const override
 apply correction using Jet information only More...
 
double correction (const reco::Jet &fJet) const override
 apply correction using Jet information only More...
 
double correction (const reco::Jet &fJet, const edm::RefToBase< reco::Jet > &refToRawJet, const edm::Event &fEvent, const edm::EventSetup &fSetup) const override
 apply correction using all event information More...
 
bool eventRequired () const override
 if correction needs event information More...
 
 L6SLBCorrector (const JetCorrectorParameters &fParam, const edm::ParameterSet &fConfig)
 
bool refRequired () const override
 if correction needs the jet reference More...
 
 ~L6SLBCorrector () override
 
- Public Member Functions inherited from JetCorrector
virtual double correction (const reco::Jet &fJet, const edm::Event &fEvent, const edm::EventSetup &fSetup) const
 apply correction using all event information More...
 
virtual double correction (const reco::Jet &fJet, const edm::RefToBase< reco::Jet > &fJetRef, const edm::Event &fEvent, const edm::EventSetup &fSetup, LorentzVector &corrected) const
 Apply vectorial correction using all event information. More...
 
 JetCorrector ()
 
virtual bool vectorialCorrection () const
 if vectorial correction is provided More...
 
virtual ~JetCorrector ()
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Public Types inherited from JetCorrector
typedef reco::Particle::LorentzVector LorentzVector
 
- Static Public Member Functions inherited from JetCorrector
static const JetCorrectorgetJetCorrector (const std::string &fName, const edm::EventSetup &fSetup)
 retrieve corrector from the event setup. troughs exception if something is missing More...
 

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_.

32  : addMuonToJet_(fConfig.getParameter<bool>("addMuonToJet"))
33  , srcBTagInfoElec_(fConfig.getParameter<edm::InputTag>("srcBTagInfoElectron"))
34  , srcBTagInfoMuon_(fConfig.getParameter<edm::InputTag>("srcBTagInfoMuon"))
35  , corrector_(nullptr)
36 {
37  vector<JetCorrectorParameters> vParam;
38  vParam.push_back(fParam);
40 }
T getParameter(std::string const &) const
FactorizedJetCorrectorCalculator * corrector_
edm::InputTag srcBTagInfoMuon_
edm::InputTag srcBTagInfoElec_
L6SLBCorrector::~L6SLBCorrector ( )
override

Definition at line 43 of file L6SLBCorrector.cc.

References corrector_.

44 {
45  delete corrector_;
46 }
FactorizedJetCorrectorCalculator * corrector_

Member Function Documentation

double L6SLBCorrector::correction ( const LorentzVector fJet) const
overridevirtual

apply correction using Jet information only

Implements JetCorrector.

Definition at line 54 of file L6SLBCorrector.cc.

References Exception.

55 {
56  throw cms::Exception("EventRequired")
57  <<"Wrong interface correction(LorentzVector), event required!";
58  return 1.0;
59 }
double L6SLBCorrector::correction ( const reco::Jet fJet) const
overridevirtual

apply correction using Jet information only

Implements JetCorrector.

Definition at line 63 of file L6SLBCorrector.cc.

References Exception.

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

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(), FactorizedJetCorrectorCalculator::getCorrection(), reco::TemplatedSoftLeptonTagInfo< REF >::lepton(), reco::TemplatedSoftLeptonTagInfo< REF >::leptons(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), FactorizedJetCorrectorCalculator::VariableValues::setAddLepToJet(), FactorizedJetCorrectorCalculator::VariableValues::setJetE(), FactorizedJetCorrectorCalculator::VariableValues::setJetEta(), FactorizedJetCorrectorCalculator::VariableValues::setJetPhi(), FactorizedJetCorrectorCalculator::VariableValues::setJetPt(), FactorizedJetCorrectorCalculator::VariableValues::setLepPx(), FactorizedJetCorrectorCalculator::VariableValues::setLepPy(), FactorizedJetCorrectorCalculator::VariableValues::setLepPz(), srcBTagInfoElec_, srcBTagInfoMuon_, and MuonErrorMatrixValues_cff::values.

76 {
78  values.setJetPt(fJet.pt());
79  values.setJetEta(fJet.eta());
80  values.setJetPhi(fJet.phi());
81  values.setJetE(fJet.energy());
82 
84  fEvent.getByLabel(srcBTagInfoMuon_,muoninfos);
85 
86  const reco::SoftLeptonTagInfo& sltMuon =
87  (*muoninfos)[getBTagInfoIndex(refToRawJet,*muoninfos)];
88  if (sltMuon.leptons()>0) {
89  const edm::RefToBase<reco::Track>& trackRef = sltMuon.lepton(0);
90  values.setLepPx(trackRef->px());
91  values.setLepPy(trackRef->py());
92  values.setLepPz(trackRef->pz());
94  return corrector_->getCorrection(values);
95  }
96  else {
98  fEvent.getByLabel(srcBTagInfoElec_,elecinfos);
99  const reco::SoftLeptonTagInfo& sltElec =
100  (*elecinfos)[getBTagInfoIndex(refToRawJet,*elecinfos)];
101  if (sltElec.leptons()>0) {
102  const edm::RefToBase<reco::Track>& trackRef = sltElec.lepton(0);
103  values.setLepPx(trackRef->px());
104  values.setLepPy(trackRef->py());
105  values.setLepPz(trackRef->pz());
106  values.setAddLepToJet(false);
107  return corrector_->getCorrection(values);
108  }
109  }
110  return 1.0;
111 }
double eta() const final
momentum pseudorapidity
double pt() const final
transverse momentum
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:627
FactorizedJetCorrectorCalculator * corrector_
double energy() const final
energy
edm::InputTag srcBTagInfoMuon_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:535
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:639
int getBTagInfoIndex(const edm::RefToBase< reco::Jet > &refToRawJet, const std::vector< reco::SoftLeptonTagInfo > &tags) const
edm::InputTag srcBTagInfoElec_
double phi() const final
momentum azimuthal angle
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:633
bool L6SLBCorrector::eventRequired ( ) const
inlineoverridevirtual

if correction needs event information

Implements JetCorrector.

Definition at line 44 of file L6SLBCorrector.h.

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

Definition at line 119 of file L6SLBCorrector.cc.

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

Referenced by correction(), and refRequired().

122 {
123  for (unsigned int i=0;i<tags.size();i++)
124  if (tags[i].jet().get()==refToRawJet.get()) return i;
125  return -1;
126 }
value_type const * get() const
Definition: RefToBase.h:234
bool L6SLBCorrector::refRequired ( ) const
inlineoverridevirtual

if correction needs the jet reference

Implements JetCorrector.

Definition at line 47 of file L6SLBCorrector.h.

References getBTagInfoIndex().

47 {return true;}

Member Data Documentation

bool L6SLBCorrector::addMuonToJet_
private

Definition at line 62 of file L6SLBCorrector.h.

Referenced by correction().

FactorizedJetCorrectorCalculator* L6SLBCorrector::corrector_
private

Definition at line 65 of file L6SLBCorrector.h.

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

edm::InputTag L6SLBCorrector::srcBTagInfoElec_
private

Definition at line 63 of file L6SLBCorrector.h.

Referenced by correction().

edm::InputTag L6SLBCorrector::srcBTagInfoMuon_
private

Definition at line 64 of file L6SLBCorrector.h.

Referenced by correction().

std::string L6SLBCorrector::tagName_
private

Definition at line 61 of file L6SLBCorrector.h.