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 std::string &fDataFile)
 
 JetCorrectionUncertainty (const JetCorrectorParameters &fParameters)
 
 JetCorrectionUncertainty (const JetCorrectionUncertainty &)=delete
 
JetCorrectionUncertaintyoperator= (const JetCorrectionUncertainty &)=delete
 
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 ()
 

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.

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

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 }
SimpleJetCorrectionUncertainty * mUncertainty

◆ JetCorrectionUncertainty() [2/4]

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

Definition at line 33 of file JetCorrectionUncertainty.cc.

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

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 }
SimpleJetCorrectionUncertainty * mUncertainty

◆ JetCorrectionUncertainty() [3/4]

JetCorrectionUncertainty::JetCorrectionUncertainty ( const JetCorrectorParameters fParameters)

Definition at line 54 of file JetCorrectionUncertainty.cc.

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

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 }
SimpleJetCorrectionUncertainty * mUncertainty

◆ JetCorrectionUncertainty() [4/4]

JetCorrectionUncertainty::JetCorrectionUncertainty ( const JetCorrectionUncertainty )
delete

◆ ~JetCorrectionUncertainty()

JetCorrectionUncertainty::~JetCorrectionUncertainty ( )

Definition at line 75 of file JetCorrectionUncertainty.cc.

References mUncertainty.

75 { delete mUncertainty; }
SimpleJetCorrectionUncertainty * mUncertainty

Member Function Documentation

◆ fillVector()

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

Definition at line 102 of file JetCorrectionUncertainty.cc.

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().

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 }
Log< level::Error, false > LogError

◆ getPtRel()

float JetCorrectionUncertainty::getPtRel ( )
private

Definition at line 173 of file JetCorrectionUncertainty.cc.

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

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 }
Log< level::Error, false > LogError
T sqrt(T t)
Definition: SSEVec.h:19
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
math::XYZVector XYZVector
Definition: RawParticle.h:26

◆ getUncertainty()

float JetCorrectionUncertainty::getUncertainty ( bool  fDirection)

Definition at line 83 of file JetCorrectionUncertainty.cc.

References JetCorrectorParameters::Definitions::binVar(), JetCorrectorParameters::definitions(), fillVector(), mIsJetEMFset, mIsJetEset, mIsJetEtaset, mIsJetPhiset, mIsJetPtset, mIsLepPxset, mIsLepPyset, mIsLepPzset, mUncertainty, SimpleJetCorrectionUncertainty::parameters(), JetCorrectorParameters::Definitions::parVar(), mps_fire::result, SimpleJetCorrectionUncertainty::uncertainty(), run3scouting_cff::vx, and run3scouting_cff::vy.

83  {
84  float result;
85  std::vector<float> vx, vy;
88  result = mUncertainty->uncertainty(vx, vy[0], fDirection);
89  mIsJetEset = false;
90  mIsJetPtset = false;
91  mIsJetPhiset = false;
92  mIsJetEtaset = false;
93  mIsJetEMFset = false;
94  mIsLepPxset = false;
95  mIsLepPyset = false;
96  mIsLepPzset = false;
97  return result;
98 }
SimpleJetCorrectionUncertainty * mUncertainty
std::vector< std::string > binVar() const
std::vector< std::string > parVar() const
const Definitions & definitions() const
const JetCorrectorParameters & parameters() const
std::vector< float > fillVector(const std::vector< std::string > &fNames)
float uncertainty(const std::vector< float > &fX, float fY, bool fDirection) const

◆ operator=()

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

◆ setAddLepToJet()

void JetCorrectionUncertainty::setAddLepToJet ( bool  fAddLepToJet)
inline

Definition at line 29 of file JetCorrectionUncertainty.h.

References mAddLepToJet.

29 { mAddLepToJet = fAddLepToJet; }

◆ setJetE()

void JetCorrectionUncertainty::setJetE ( float  fE)

Definition at line 219 of file JetCorrectionUncertainty.cc.

References mIsJetEset, and mJetE.

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

◆ setJetEMF()

void JetCorrectionUncertainty::setJetEMF ( float  fEMF)

◆ setJetEta()

void JetCorrectionUncertainty::setJetEta ( float  fEta)

Definition at line 204 of file JetCorrectionUncertainty.cc.

References mIsJetEtaset, and mJetEta.

204  {
205  mJetEta = fEta;
206  mIsJetEtaset = true;
207 }

◆ setJetPhi()

void JetCorrectionUncertainty::setJetPhi ( float  fE)

Definition at line 214 of file JetCorrectionUncertainty.cc.

References mIsJetPhiset, and mJetPhi.

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

◆ setJetPt()

void JetCorrectionUncertainty::setJetPt ( float  fPt)

Definition at line 209 of file JetCorrectionUncertainty.cc.

References mIsJetPtset, and mJetPt.

209  {
210  mJetPt = fPt;
211  mIsJetPtset = true;
212 }

◆ setLepPx()

void JetCorrectionUncertainty::setLepPx ( float  fLepPx)

Definition at line 229 of file JetCorrectionUncertainty.cc.

References mIsLepPxset, and mLepPx.

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

◆ setLepPy()

void JetCorrectionUncertainty::setLepPy ( float  fLepPy)

Definition at line 234 of file JetCorrectionUncertainty.cc.

References mIsLepPyset, and mLepPy.

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

◆ setLepPz()

void JetCorrectionUncertainty::setLepPz ( float  fLepPz)

Definition at line 239 of file JetCorrectionUncertainty.cc.

References mIsLepPzset, and mLepPz.

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

◆ setParameters()

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

Definition at line 77 of file JetCorrectionUncertainty.cc.

References mUncertainty.

77  {
78  //---- delete the mParameters pointer before setting the new address ---
79  delete mUncertainty;
81 }
SimpleJetCorrectionUncertainty * 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