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

Referenced by setAddLepToJet().

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::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::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::~JetCorrectionUncertainty ( )

Definition at line 75 of file JetCorrectionUncertainty.cc.

References mUncertainty.

75 { delete mUncertainty; }
SimpleJetCorrectionUncertainty * mUncertainty
JetCorrectionUncertainty::JetCorrectionUncertainty ( const JetCorrectionUncertainty )
privatedelete

Member Function Documentation

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, mJetPt, mLepPx, mLepPy, mLepPz, and mps_fire::result.

Referenced by getUncertainty(), and setAddLepToJet().

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(mJetPt);
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 }
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().

Referenced by setAddLepToJet().

173  {
174  typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiE4D<float> > PtEtaPhiELorentzVector;
175  typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float> > XYZVector;
176  PtEtaPhiELorentzVector jet;
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 }
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
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, and SimpleJetCorrectionUncertainty::uncertainty().

Referenced by JetCorrectorDemo::analyze(), ShiftedPFCandidateProducerForPFNoPUMEt::produce(), ShiftedPFCandidateProducerForNoPileUpPFMEt::produce(), ShiftedJetProducerT< T, Textractor >::produce(), and setAddLepToJet().

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
const Definitions & definitions() const
std::vector< std::string > parVar() const
float uncertainty(const std::vector< float > &fX, float fY, bool fDirection) const
std::vector< float > fillVector(const std::vector< std::string > &fNames)
std::vector< std::string > binVar() const
const JetCorrectorParameters & parameters() const
JetCorrectionUncertainty& JetCorrectionUncertainty::operator= ( const JetCorrectionUncertainty )
privatedelete

Referenced by setAddLepToJet().

void JetCorrectionUncertainty::setAddLepToJet ( bool  fAddLepToJet)
inline
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 }
void JetCorrectionUncertainty::setJetEMF ( float  fEMF)
void JetCorrectionUncertainty::setJetEta ( float  fEta)
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 }
void JetCorrectionUncertainty::setJetPt ( float  fPt)
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 }
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 }
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 }
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

bool JetCorrectionUncertainty::mAddLepToJet
private

Definition at line 44 of file JetCorrectionUncertainty.h.

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

bool JetCorrectionUncertainty::mIsJetEMFset
private
bool JetCorrectionUncertainty::mIsJetEset
private
bool JetCorrectionUncertainty::mIsJetEtaset
private
bool JetCorrectionUncertainty::mIsJetPhiset
private
bool JetCorrectionUncertainty::mIsJetPtset
private
bool JetCorrectionUncertainty::mIsLepPxset
private
bool JetCorrectionUncertainty::mIsLepPyset
private
bool JetCorrectionUncertainty::mIsLepPzset
private
float JetCorrectionUncertainty::mJetE
private

Definition at line 36 of file JetCorrectionUncertainty.h.

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

float JetCorrectionUncertainty::mJetEMF
private

Definition at line 40 of file JetCorrectionUncertainty.h.

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

float JetCorrectionUncertainty::mJetEta
private
float JetCorrectionUncertainty::mJetPhi
private

Definition at line 39 of file JetCorrectionUncertainty.h.

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

float JetCorrectionUncertainty::mJetPt
private
float JetCorrectionUncertainty::mLepPx
private
float JetCorrectionUncertainty::mLepPy
private
float JetCorrectionUncertainty::mLepPz
private
SimpleJetCorrectionUncertainty* JetCorrectionUncertainty::mUncertainty
private