CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
L1JPTOffsetCorrector Class Reference

#include <L1JPTOffsetCorrector.h>

Inheritance diagram for L1JPTOffsetCorrector:
JetCorrector

Public Member Functions

virtual double correction (const LorentzVector &fJet) const
 get correction using Jet information only More...
 
virtual double correction (const reco::Jet &fJet) const
 apply correction using Jet information only More...
 
virtual double correction (const reco::Jet &fJet, const edm::Event &fEvent, const edm::EventSetup &fSetup) const
 apply correction using all event information More...
 
virtual bool eventRequired () const
 if correction needs event information More...
 
 L1JPTOffsetCorrector (const JetCorrectorParameters &fConfig, const edm::ParameterSet &fParameters)
 
virtual bool refRequired () const
 if correction needs the jet reference More...
 
virtual ~L1JPTOffsetCorrector ()
 
- Public Member Functions inherited from JetCorrector
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 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 Attributes

FactorizedJetCorrectormCorrector
 
bool mIsOffsetSet
 
std::string mOffsetService
 

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 17 of file L1JPTOffsetCorrector.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file L1JPTOffsetCorrector.cc.

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

25 {
26  mOffsetService = fConfig.getParameter<std::string>("offsetService");
27  mIsOffsetSet = false;
28  if (mOffsetService != "")
29  mIsOffsetSet = true;
30  if (fParam.definitions().level() != "L1JPTOffset")
31  throw cms::Exception("L1OffsetCorrector")<<" correction level: "<<fParam.definitions().level()<<" is not L1JPTOffset";
32  vector<JetCorrectorParameters> vParam;
33  vParam.push_back(fParam);
34  mCorrector = new FactorizedJetCorrector(vParam);
35 }
FactorizedJetCorrector * mCorrector
L1JPTOffsetCorrector::~L1JPTOffsetCorrector ( )
virtual

Definition at line 39 of file L1JPTOffsetCorrector.cc.

40 {
41  delete mCorrector;
42 }
FactorizedJetCorrector * mCorrector

Member Function Documentation

double L1JPTOffsetCorrector::correction ( const LorentzVector fJet) const
virtual

get correction using Jet information only

Implements JetCorrector.

Definition at line 46 of file L1JPTOffsetCorrector.cc.

References edm::hlt::Exception.

47 {
48  throw cms::Exception("EventRequired")
49  <<"Wrong interface correction(LorentzVector), event required!";
50  return 1.0;
51 }
double L1JPTOffsetCorrector::correction ( const reco::Jet fJet) const
virtual

apply correction using Jet information only

Implements JetCorrector.

Definition at line 55 of file L1JPTOffsetCorrector.cc.

References edm::hlt::Exception.

56 {
57  throw cms::Exception("EventRequired")
58  <<"Wrong interface correction(reco::Jet), event required!";
59  return 1.0;
60 }
double L1JPTOffsetCorrector::correction ( const reco::Jet fJet,
const edm::Event fEvent,
const edm::EventSetup fSetup 
) const
virtual

apply correction using all event information

Reimplemented from JetCorrector.

Definition at line 64 of file L1JPTOffsetCorrector.cc.

References JetCorrector::correction(), reco::LeafCandidate::energy(), reco::JPTJet::getCaloJetRef(), JetCorrector::getJetCorrector(), evf::evtn::offset(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), reco::LeafCandidate::pz(), and query::result.

67 {
68  double result = 1.;
69  const reco::JPTJet& jptjet = dynamic_cast <const reco::JPTJet&> (fJet);
70  edm::RefToBase<reco::Jet> jptjetRef = jptjet.getCaloJetRef();
71  reco::CaloJet const * rawcalojet = dynamic_cast<reco::CaloJet const *>( &* jptjetRef);
72  //------ access the offset correction service ----------------
73  double offset = 1.0;
74  if (mIsOffsetSet) {
75  const JetCorrector* OffsetCorrector = JetCorrector::getJetCorrector(mOffsetService,fSetup);
76  offset = OffsetCorrector->correction(*rawcalojet,fEvent,fSetup);
77  }
78  //------ calculate the correction for the JPT jet ------------
79  TLorentzVector JPTrawP4(rawcalojet->px(),rawcalojet->py(),rawcalojet->pz(),rawcalojet->energy());
80  mCorrector->setJPTrawP4(JPTrawP4);
81  mCorrector->setJPTrawOff(offset);
82  mCorrector->setJetE(fJet.energy());
83  result = mCorrector->getCorrection();
84  return result;
85 }
Jets made from CaloTowers.
Definition: CaloJet.h:30
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
const edm::RefToBase< reco::Jet > & getCaloJetRef() const
Definition: JPTJet.h:130
virtual double energy() const
energy
void setJPTrawP4(TLorentzVector fJPTrawP4)
Jets made from CaloJets corrected for ZSP and tracks.
Definition: JPTJet.h:29
tuple result
Definition: query.py:137
void setJPTrawOff(float fJPTrawOff)
unsigned int offset(bool)
virtual double px() const
x coordinate of momentum vector
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
Definition: JetCorrector.cc:51
virtual double pz() const
z coordinate of momentum vector
FactorizedJetCorrector * mCorrector
virtual double py() const
y coordinate of momentum vector
virtual bool L1JPTOffsetCorrector::eventRequired ( ) const
inlinevirtual

if correction needs event information

Implements JetCorrector.

Definition at line 37 of file L1JPTOffsetCorrector.h.

37 {return true;}
virtual bool L1JPTOffsetCorrector::refRequired ( ) const
inlinevirtual

if correction needs the jet reference

Implements JetCorrector.

Definition at line 38 of file L1JPTOffsetCorrector.h.

38 {return false;}

Member Data Documentation

FactorizedJetCorrector* L1JPTOffsetCorrector::mCorrector
private

Definition at line 44 of file L1JPTOffsetCorrector.h.

bool L1JPTOffsetCorrector::mIsOffsetSet
private

Definition at line 43 of file L1JPTOffsetCorrector.h.

std::string L1JPTOffsetCorrector::mOffsetService
private

Definition at line 42 of file L1JPTOffsetCorrector.h.