CMS 3D CMS Logo

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

#include <JetCorrectionUncertainty.h>

Public Member Functions

float getUncertainty (bool fDirection)
 
 JetCorrectionUncertainty ()
 
 JetCorrectionUncertainty (const JetCorrectorParameters &fParameters)
 
 JetCorrectionUncertainty (const std::string &fDataFile)
 
void setAddLepToJet (bool fAddLepToJet)
 
void setJetE (float fE)
 
void setJetEMF (float fEMF)
 
void setJetEta (float fEta)
 
void setJetPhi (float fE)
 
void setJetPt (float fPt)
 
void setLepPx (float fLepPx)
 
void setLepPy (float fLepPy)
 
void setLepPz (float fLepPz)
 
void setParameters (const std::string &fDataFile)
 
 ~JetCorrectionUncertainty ()
 

Private Member Functions

std::vector< float > fillVector (const std::vector< std::string > &fNames)
 
float getPtRel ()
 
 JetCorrectionUncertainty (const JetCorrectionUncertainty &)=delete
 
JetCorrectionUncertaintyoperator= (const JetCorrectionUncertainty &)=delete
 

Private Attributes

bool mAddLepToJet
 
bool mIsJetEMFset
 
bool mIsJetEset
 
bool mIsJetEtaset
 
bool mIsJetPhiset
 
bool mIsJetPtset
 
bool mIsLepPxset
 
bool mIsLepPyset
 
bool mIsLepPzset
 
float mJetE
 
float mJetEMF
 
float mJetEta
 
float mJetPhi
 
float mJetPt
 
float mLepPx
 
float mLepPy
 
float mLepPz
 
SimpleJetCorrectionUncertaintymUncertainty
 

Detailed Description

Definition at line 11 of file JetCorrectionUncertainty.h.

Constructor & Destructor Documentation

◆ JetCorrectionUncertainty() [1/4]

JetCorrectionUncertainty::JetCorrectionUncertainty ( )

Definition at line 12 of file JetCorrectionUncertainty.cc.

12  {
13  mJetEta = -9999;
14  mJetPt = -9999;
15  mJetPhi = -9999;
16  mJetE = -9999;
17  mJetEMF = -9999;
18  mLepPx = -9999;
19  mLepPy = -9999;
20  mLepPz = -9999;
21  mIsJetEset = false;
22  mIsJetPtset = false;
23  mIsJetPhiset = false;
24  mIsJetEtaset = false;
25  mIsJetEMFset = false;
26  mIsLepPxset = false;
27  mIsLepPyset = false;
28  mIsLepPzset = false;
29  mAddLepToJet = false;
31 }

References mAddLepToJet, mIsJetEMFset, mIsJetEset, mIsJetEtaset, mIsJetPhiset, mIsJetPtset, mIsLepPxset, mIsLepPyset, mIsLepPzset, mJetE, mJetEMF, mJetEta, mJetPhi, mJetPt, mLepPx, mLepPy, mLepPz, and mUncertainty.

◆ JetCorrectionUncertainty() [2/4]

JetCorrectionUncertainty::JetCorrectionUncertainty ( const std::string &  fDataFile)

Definition at line 33 of file JetCorrectionUncertainty.cc.

33  {
34  mJetEta = -9999;
35  mJetPt = -9999;
36  mJetPhi = -9999;
37  mJetE = -9999;
38  mJetEMF = -9999;
39  mLepPx = -9999;
40  mLepPy = -9999;
41  mLepPz = -9999;
42  mIsJetEset = false;
43  mIsJetPtset = false;
44  mIsJetPhiset = false;
45  mIsJetEtaset = false;
46  mIsJetEMFset = false;
47  mIsLepPxset = false;
48  mIsLepPyset = false;
49  mIsLepPzset = false;
50  mAddLepToJet = false;
52 }

References mAddLepToJet, mIsJetEMFset, mIsJetEset, mIsJetEtaset, mIsJetPhiset, mIsJetPtset, mIsLepPxset, mIsLepPyset, mIsLepPzset, mJetE, mJetEMF, mJetEta, mJetPhi, mJetPt, mLepPx, mLepPy, mLepPz, and mUncertainty.

◆ JetCorrectionUncertainty() [3/4]

JetCorrectionUncertainty::JetCorrectionUncertainty ( const JetCorrectorParameters fParameters)

Definition at line 54 of file JetCorrectionUncertainty.cc.

54  {
55  mJetEta = -9999;
56  mJetPt = -9999;
57  mJetPhi = -9999;
58  mJetE = -9999;
59  mJetEMF = -9999;
60  mLepPx = -9999;
61  mLepPy = -9999;
62  mLepPz = -9999;
63  mIsJetEset = false;
64  mIsJetPtset = false;
65  mIsJetPhiset = false;
66  mIsJetEtaset = false;
67  mIsJetEMFset = false;
68  mIsLepPxset = false;
69  mIsLepPyset = false;
70  mIsLepPzset = false;
71  mAddLepToJet = false;
73 }

References mAddLepToJet, mIsJetEMFset, mIsJetEset, mIsJetEtaset, mIsJetPhiset, mIsJetPtset, mIsLepPxset, mIsLepPyset, mIsLepPzset, mJetE, mJetEMF, mJetEta, mJetPhi, mJetPt, mLepPx, mLepPy, mLepPz, and mUncertainty.

◆ ~JetCorrectionUncertainty()

JetCorrectionUncertainty::~JetCorrectionUncertainty ( )

Definition at line 75 of file JetCorrectionUncertainty.cc.

75 { delete mUncertainty; }

References mUncertainty.

◆ JetCorrectionUncertainty() [4/4]

JetCorrectionUncertainty::JetCorrectionUncertainty ( const JetCorrectionUncertainty )
privatedelete

Member Function Documentation

◆ fillVector()

std::vector< float > JetCorrectionUncertainty::fillVector ( const std::vector< std::string > &  fNames)
private

Definition at line 102 of file JetCorrectionUncertainty.cc.

102  {
103  std::vector<float> result;
104  for (unsigned i = 0; i < fNames.size(); i++) {
105  if (fNames[i] == "JetEta") {
106  if (!mIsJetEtaset) {
107  edm::LogError("JetCorrectionUncertainty::") << " jet eta is not set";
108  result.push_back(-999.0);
109  } else {
110  result.push_back(mJetEta);
111  }
112  } else if (fNames[i] == "JetPt") {
113  if (!mIsJetPtset) {
114  edm::LogError("JetCorrectionUncertainty::") << " jet pt is not set";
115  result.push_back(-999.0);
116  } else {
117  result.push_back(mJetPt);
118  }
119  } else if (fNames[i] == "JetPhi") {
120  if (!mIsJetPhiset) {
121  edm::LogError("JetCorrectionUncertainty::") << " jet phi is not set";
122  result.push_back(-999.0);
123  } else {
124  result.push_back(mJetPhi);
125  }
126  } else if (fNames[i] == "JetE") {
127  if (!mIsJetEset) {
128  edm::LogError("JetCorrectionUncertainty::") << " jet energy is not set";
129  result.push_back(-999.0);
130  } else {
131  result.push_back(mJetE);
132  }
133  } else if (fNames[i] == "JetEMF") {
134  if (!mIsJetEMFset) {
135  edm::LogError("JetCorrectionUncertainty::") << " jet emf is not set";
136  result.push_back(-999.0);
137  } else {
138  result.push_back(mJetEMF);
139  }
140  } else if (fNames[i] == "LepPx") {
141  if (!mIsLepPxset) {
142  edm::LogError("JetCorrectionUncertainty::") << " lepton px is not set";
143  result.push_back(-999.0);
144  } else {
145  result.push_back(mLepPx);
146  }
147  } else if (fNames[i] == "LepPy") {
148  if (!mIsLepPyset) {
149  edm::LogError("JetCorrectionUncertainty::") << " lepton py is not set";
150  result.push_back(-999.0);
151  } else {
152  result.push_back(mLepPy);
153  }
154  } else if (fNames[i] == "LepPz") {
155  if (!mIsLepPzset) {
156  edm::LogError("JetCorrectionUncertainty::") << " lepton pz is not set";
157  result.push_back(-999.0);
158  } else {
159  result.push_back(mLepPz);
160  }
161  }
162 
163  else {
164  edm::LogError("JetCorrectionUncertainty::") << " unknown parameter " << fNames[i];
165  result.push_back(-999.0);
166  }
167  }
168  return result;
169 }

References mps_fire::i, mIsJetEMFset, mIsJetEset, mIsJetEtaset, mIsJetPhiset, mIsJetPtset, mIsLepPxset, mIsLepPyset, mIsLepPzset, mJetE, mJetEMF, mJetEta, mJetPhi, mJetPt, mLepPx, mLepPy, mLepPz, and mps_fire::result.

Referenced by getUncertainty().

◆ getPtRel()

float JetCorrectionUncertainty::getPtRel ( )
private

Definition at line 173 of file JetCorrectionUncertainty.cc.

173  {
174  typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiE4D<float> > PtEtaPhiELorentzVector;
175  typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float> > XYZVector;
177  XYZVector lep;
178  jet.SetPt(mJetPt);
179  jet.SetEta(mJetEta);
180  jet.SetPhi(mJetPhi);
181  jet.SetE(mJetE);
182  lep.SetXYZ(mLepPx, mLepPy, mLepPz);
183  float lj_x = (mAddLepToJet) ? lep.X() + jet.Px() : jet.Px();
184  float lj_y = (mAddLepToJet) ? lep.Y() + jet.Py() : jet.Py();
185  float lj_z = (mAddLepToJet) ? lep.Z() + jet.Pz() : jet.Pz();
186  // absolute values squared
187  float lj2 = lj_x * lj_x + lj_y * lj_y + lj_z * lj_z;
188  float pTrel2 = -999.0;
189  if (lj2 > 0) {
190  float lep2 = lep.X() * lep.X() + lep.Y() * lep.Y() + lep.Z() * lep.Z();
191  // projection vec(mu) to lepjet axis
192  float lepXlj = lep.X() * lj_x + lep.Y() * lj_y + lep.Z() * lj_z;
193  // absolute value squared and normalized
194  float pLrel2 = lepXlj * lepXlj / lj2;
195  // lep2 = pTrel2 + pLrel2
196  pTrel2 = lep2 - pLrel2;
197  } else
198  edm::LogError("JetCorrectionUncertainty") << " not positive lepton-jet momentum: " << lj2;
199  return (pTrel2 > 0) ? std::sqrt(pTrel2) : 0.0;
200 }

References metsig::jet, RazorAnalyzer::lep2, mAddLepToJet, mJetE, mJetEta, mJetPhi, mJetPt, mLepPx, mLepPy, mLepPz, and mathSSE::sqrt().

◆ getUncertainty()

float JetCorrectionUncertainty::getUncertainty ( bool  fDirection)

◆ operator=()

JetCorrectionUncertainty& JetCorrectionUncertainty::operator= ( const JetCorrectionUncertainty )
privatedelete

◆ setAddLepToJet()

void JetCorrectionUncertainty::setAddLepToJet ( bool  fAddLepToJet)
inline

Definition at line 27 of file JetCorrectionUncertainty.h.

27 { mAddLepToJet = fAddLepToJet; }

References mAddLepToJet.

◆ setJetE()

void JetCorrectionUncertainty::setJetE ( float  fE)

Definition at line 219 of file JetCorrectionUncertainty.cc.

219  {
220  mJetE = fE;
221  mIsJetEset = true;
222 }

References mIsJetEset, and mJetE.

◆ setJetEMF()

void JetCorrectionUncertainty::setJetEMF ( float  fEMF)

Definition at line 224 of file JetCorrectionUncertainty.cc.

224  {
225  mJetEMF = fEMF;
226  mIsJetEMFset = true;
227 }

References JetMETHLTOfflineSource_cfi::fEMF, mIsJetEMFset, and mJetEMF.

◆ setJetEta()

void JetCorrectionUncertainty::setJetEta ( float  fEta)

◆ setJetPhi()

void JetCorrectionUncertainty::setJetPhi ( float  fE)

Definition at line 214 of file JetCorrectionUncertainty.cc.

214  {
215  mJetPhi = fPhi;
216  mIsJetPhiset = true;
217 }

References mIsJetPhiset, and mJetPhi.

◆ setJetPt()

void JetCorrectionUncertainty::setJetPt ( float  fPt)

◆ setLepPx()

void JetCorrectionUncertainty::setLepPx ( float  fLepPx)

Definition at line 229 of file JetCorrectionUncertainty.cc.

229  {
230  mLepPx = fPx;
231  mIsLepPxset = true;
232 }

References mIsLepPxset, and mLepPx.

◆ setLepPy()

void JetCorrectionUncertainty::setLepPy ( float  fLepPy)

Definition at line 234 of file JetCorrectionUncertainty.cc.

234  {
235  mLepPy = fPy;
236  mIsLepPyset = true;
237 }

References mIsLepPyset, and mLepPy.

◆ setLepPz()

void JetCorrectionUncertainty::setLepPz ( float  fLepPz)

Definition at line 239 of file JetCorrectionUncertainty.cc.

239  {
240  mLepPz = fPz;
241  mIsLepPzset = true;
242 }

References mIsLepPzset, and mLepPz.

◆ setParameters()

void JetCorrectionUncertainty::setParameters ( const std::string &  fDataFile)

Definition at line 77 of file JetCorrectionUncertainty.cc.

77  {
78  //---- delete the mParameters pointer before setting the new address ---
79  delete mUncertainty;
81 }

References mUncertainty.

Member Data Documentation

◆ mAddLepToJet

bool JetCorrectionUncertainty::mAddLepToJet
private

Definition at line 44 of file JetCorrectionUncertainty.h.

Referenced by getPtRel(), JetCorrectionUncertainty(), and setAddLepToJet().

◆ mIsJetEMFset

bool JetCorrectionUncertainty::mIsJetEMFset
private

◆ mIsJetEset

bool JetCorrectionUncertainty::mIsJetEset
private

◆ mIsJetEtaset

bool JetCorrectionUncertainty::mIsJetEtaset
private

◆ mIsJetPhiset

bool JetCorrectionUncertainty::mIsJetPhiset
private

◆ mIsJetPtset

bool JetCorrectionUncertainty::mIsJetPtset
private

◆ mIsLepPxset

bool JetCorrectionUncertainty::mIsLepPxset
private

◆ mIsLepPyset

bool JetCorrectionUncertainty::mIsLepPyset
private

◆ mIsLepPzset

bool JetCorrectionUncertainty::mIsLepPzset
private

◆ mJetE

float JetCorrectionUncertainty::mJetE
private

Definition at line 36 of file JetCorrectionUncertainty.h.

Referenced by fillVector(), getPtRel(), JetCorrectionUncertainty(), and setJetE().

◆ mJetEMF

float JetCorrectionUncertainty::mJetEMF
private

Definition at line 40 of file JetCorrectionUncertainty.h.

Referenced by fillVector(), JetCorrectionUncertainty(), and setJetEMF().

◆ mJetEta

float JetCorrectionUncertainty::mJetEta
private

◆ mJetPhi

float JetCorrectionUncertainty::mJetPhi
private

◆ mJetPt

float JetCorrectionUncertainty::mJetPt
private

◆ mLepPx

float JetCorrectionUncertainty::mLepPx
private

◆ mLepPy

float JetCorrectionUncertainty::mLepPy
private

◆ mLepPz

float JetCorrectionUncertainty::mLepPz
private

◆ mUncertainty

SimpleJetCorrectionUncertainty* JetCorrectionUncertainty::mUncertainty
private
JetCorrectionUncertainty::mAddLepToJet
bool mAddLepToJet
Definition: JetCorrectionUncertainty.h:44
mps_fire.i
i
Definition: mps_fire.py:428
JetCorrectorParameters::Definitions::binVar
std::vector< std::string > binVar() const
Definition: JetCorrectorParameters.h:44
JetCorrectionUncertainty::mIsLepPzset
bool mIsLepPzset
Definition: JetCorrectionUncertainty.h:52
JetCorrectionUncertainty::mIsJetPtset
bool mIsJetPtset
Definition: JetCorrectionUncertainty.h:46
JetCorrectorParameters::definitions
const Definitions & definitions() const
Definition: JetCorrectorParameters.h:122
math::PtEtaPhiELorentzVector
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
JetCorrectionUncertainty::mUncertainty
SimpleJetCorrectionUncertainty * mUncertainty
Definition: JetCorrectionUncertainty.h:53
XYZVector
math::XYZVector XYZVector
Definition: RawParticle.h:26
JetMETHLTOfflineSource_cfi.fEMF
fEMF
Definition: JetMETHLTOfflineSource_cfi.py:29
JetCorrectionUncertainty::mIsJetPhiset
bool mIsJetPhiset
Definition: JetCorrectionUncertainty.h:47
JetCorrectionUncertainty::mIsJetEset
bool mIsJetEset
Definition: JetCorrectionUncertainty.h:45
SimpleJetCorrectionUncertainty::parameters
const JetCorrectorParameters & parameters() const
Definition: SimpleJetCorrectionUncertainty.h:16
JetCorrectionUncertainty::mLepPz
float mLepPz
Definition: JetCorrectionUncertainty.h:43
JetCorrectionUncertainty::fillVector
std::vector< float > fillVector(const std::vector< std::string > &fNames)
Definition: JetCorrectionUncertainty.cc:102
JetCorrectionUncertainty::mJetEta
float mJetEta
Definition: JetCorrectionUncertainty.h:37
JetCorrectionUncertainty::mJetE
float mJetE
Definition: JetCorrectionUncertainty.h:36
JetCorrectorParameters::Definitions::parVar
std::vector< std::string > parVar() const
Definition: JetCorrectorParameters.h:43
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
JetCorrectionUncertainty::mIsJetEtaset
bool mIsJetEtaset
Definition: JetCorrectionUncertainty.h:48
JetCorrectionUncertainty::mJetPt
float mJetPt
Definition: JetCorrectionUncertainty.h:38
JetCorrectionUncertainty::mIsJetEMFset
bool mIsJetEMFset
Definition: JetCorrectionUncertainty.h:49
JetCorrectionUncertainty::mJetEMF
float mJetEMF
Definition: JetCorrectionUncertainty.h:40
JetCorrectionUncertainty::mIsLepPyset
bool mIsLepPyset
Definition: JetCorrectionUncertainty.h:51
JetCorrectionUncertainty::mLepPx
float mLepPx
Definition: JetCorrectionUncertainty.h:41
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SimpleJetCorrectionUncertainty
Definition: SimpleJetCorrectionUncertainty.h:10
JetCorrectionUncertainty::mJetPhi
float mJetPhi
Definition: JetCorrectionUncertainty.h:39
metsig::jet
Definition: SignAlgoResolutions.h:47
JetCorrectionUncertainty::mLepPy
float mLepPy
Definition: JetCorrectionUncertainty.h:42
mps_fire.result
result
Definition: mps_fire.py:311
JetCorrectionUncertainty::mIsLepPxset
bool mIsLepPxset
Definition: JetCorrectionUncertainty.h:50
SimpleJetCorrectionUncertainty::uncertainty
float uncertainty(const std::vector< float > &fX, float fY, bool fDirection) const
Definition: SimpleJetCorrectionUncertainty.cc:20
RazorAnalyzer.lep2
lep2
Definition: RazorAnalyzer.py:262