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 &)
 
JetCorrectionUncertaintyoperator= (const JetCorrectionUncertainty &)
 

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

13 {
14  mJetEta = -9999;
15  mJetPt = -9999;
16  mJetPhi = -9999;
17  mJetE = -9999;
18  mJetEMF = -9999;
19  mLepPx = -9999;
20  mLepPy = -9999;
21  mLepPz = -9999;
22  mIsJetEset = false;
23  mIsJetPtset = false;
24  mIsJetPhiset = false;
25  mIsJetEtaset = false;
26  mIsJetEMFset = false;
27  mIsLepPxset = false;
28  mIsLepPyset = false;
29  mIsLepPzset = false;
30  mAddLepToJet = false;
32 }
SimpleJetCorrectionUncertainty * mUncertainty
JetCorrectionUncertainty::JetCorrectionUncertainty ( const std::string &  fDataFile)

Definition at line 34 of file JetCorrectionUncertainty.cc.

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

35 {
36  mJetEta = -9999;
37  mJetPt = -9999;
38  mJetPhi = -9999;
39  mJetE = -9999;
40  mJetEMF = -9999;
41  mLepPx = -9999;
42  mLepPy = -9999;
43  mLepPz = -9999;
44  mIsJetEset = false;
45  mIsJetPtset = false;
46  mIsJetPhiset = false;
47  mIsJetEtaset = false;
48  mIsJetEMFset = false;
49  mIsLepPxset = false;
50  mIsLepPyset = false;
51  mIsLepPzset = false;
52  mAddLepToJet = false;
54 }
SimpleJetCorrectionUncertainty * mUncertainty
JetCorrectionUncertainty::JetCorrectionUncertainty ( const JetCorrectorParameters fParameters)

Definition at line 56 of file JetCorrectionUncertainty.cc.

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

57 {
58  mJetEta = -9999;
59  mJetPt = -9999;
60  mJetPhi = -9999;
61  mJetE = -9999;
62  mJetEMF = -9999;
63  mLepPx = -9999;
64  mLepPy = -9999;
65  mLepPz = -9999;
66  mIsJetEset = false;
67  mIsJetPtset = false;
68  mIsJetPhiset = false;
69  mIsJetEtaset = false;
70  mIsJetEMFset = false;
71  mIsLepPxset = false;
72  mIsLepPyset = false;
73  mIsLepPzset = false;
74  mAddLepToJet = false;
76 }
SimpleJetCorrectionUncertainty * mUncertainty
JetCorrectionUncertainty::~JetCorrectionUncertainty ( )

Definition at line 78 of file JetCorrectionUncertainty.cc.

References mUncertainty.

79 {
80  delete mUncertainty;
81 }
SimpleJetCorrectionUncertainty * mUncertainty
JetCorrectionUncertainty::JetCorrectionUncertainty ( const JetCorrectionUncertainty )
private

Member Function Documentation

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

Definition at line 110 of file JetCorrectionUncertainty.cc.

References edm::hlt::Exception, i, mIsJetEMFset, mIsJetEset, mIsJetEtaset, mIsJetPhiset, mIsJetPtset, mIsLepPxset, mIsLepPyset, mIsLepPzset, mJetE, mJetEMF, mJetEta, mJetPt, mLepPx, mLepPy, mLepPz, and query::result.

Referenced by getUncertainty().

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

Definition at line 171 of file JetCorrectionUncertainty.cc.

References edm::hlt::Exception, metsig::jet, mAddLepToJet, mJetE, mJetEta, mJetPhi, mJetPt, mLepPx, mLepPy, mLepPz, and mathSSE::sqrt().

172 {
173  typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiE4D<float> > PtEtaPhiELorentzVector;
174  typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float> > XYZVector;
175  PtEtaPhiELorentzVector jet;
176  XYZVector lep;
177  jet.SetPt(mJetPt);
178  jet.SetEta(mJetEta);
179  jet.SetPhi(mJetPhi);
180  jet.SetE(mJetE);
181  lep.SetXYZ(mLepPx,mLepPy,mLepPz);
182  float lj_x = (mAddLepToJet) ? lep.X()+jet.Px() : jet.Px();
183  float lj_y = (mAddLepToJet) ? lep.Y()+jet.Py() : jet.Py();
184  float lj_z = (mAddLepToJet) ? lep.Z()+jet.Pz() : jet.Pz();
185  // absolute values squared
186  float lj2 = lj_x*lj_x+lj_y*lj_y+lj_z*lj_z;
187  if (!(lj2 > 0))
188  throw cms::Exception("JetCorrectionUncertainty")<<" not positive lepton-jet momentum: "<<lj2;
189  float lep2 = lep.X()*lep.X()+lep.Y()*lep.Y()+lep.Z()*lep.Z();
190  // projection vec(mu) to lepjet axis
191  float lepXlj = lep.X()*lj_x+lep.Y()*lj_y+lep.Z()*lj_z;
192  // absolute value squared and normalized
193  float pLrel2 = lepXlj*lepXlj/lj2;
194  // lep2 = pTrel2 + pLrel2
195  float pTrel2 = lep2-pLrel2;
196  return (pTrel2 > 0) ? std::sqrt(pTrel2) : 0.0;
197 }
T sqrt(T t)
Definition: SSEVec.h:46
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:28
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
float JetCorrectionUncertainty::getUncertainty ( bool  fDirection)

Definition at line 90 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(), query::result, and SimpleJetCorrectionUncertainty::uncertainty().

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

91 {
92  float result;
93  std::vector<float> vx,vy;
96  result = mUncertainty->uncertainty(vx,vy[0],fDirection);
97  mIsJetEset = false;
98  mIsJetPtset = false;
99  mIsJetPhiset = false;
100  mIsJetEtaset = false;
101  mIsJetEMFset = false;
102  mIsLepPxset = false;
103  mIsLepPyset = false;
104  mIsLepPzset = false;
105  return result;
106 }
SimpleJetCorrectionUncertainty * mUncertainty
const Definitions & definitions() const
std::vector< std::string > parVar() const
tuple result
Definition: query.py:137
float uncertainty(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 )
private
void JetCorrectionUncertainty::setAddLepToJet ( bool  fAddLepToJet)
inline

Definition at line 26 of file JetCorrectionUncertainty.h.

References mAddLepToJet.

26 {mAddLepToJet = fAddLepToJet;}
void JetCorrectionUncertainty::setJetE ( float  fE)

Definition at line 219 of file JetCorrectionUncertainty.cc.

References mIsJetEset, and mJetE.

220 {
221  mJetE = fE;
222  mIsJetEset = true;
223 }
void JetCorrectionUncertainty::setJetEMF ( float  fEMF)

Definition at line 225 of file JetCorrectionUncertainty.cc.

References mIsJetEMFset, and mJetEMF.

226 {
227  mJetEMF = fEMF;
228  mIsJetEMFset = true;
229 }
void JetCorrectionUncertainty::setJetEta ( float  fEta)
void JetCorrectionUncertainty::setJetPhi ( float  fE)

Definition at line 213 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 231 of file JetCorrectionUncertainty.cc.

References mIsLepPxset, and mLepPx.

232 {
233  mLepPx = fPx;
234  mIsLepPxset = true;
235 }
void JetCorrectionUncertainty::setLepPy ( float  fLepPy)

Definition at line 237 of file JetCorrectionUncertainty.cc.

References mIsLepPyset, and mLepPy.

238 {
239  mLepPy = fPy;
240  mIsLepPyset = true;
241 }
void JetCorrectionUncertainty::setLepPz ( float  fLepPz)

Definition at line 243 of file JetCorrectionUncertainty.cc.

References mIsLepPzset, and mLepPz.

244 {
245  mLepPz = fPz;
246  mIsLepPzset = true;
247 }
void JetCorrectionUncertainty::setParameters ( const std::string &  fDataFile)

Definition at line 83 of file JetCorrectionUncertainty.cc.

References mUncertainty.

84 {
85  //---- delete the mParameters pointer before setting the new address ---
86  delete mUncertainty;
88 }
SimpleJetCorrectionUncertainty * mUncertainty

Member Data Documentation

bool JetCorrectionUncertainty::mAddLepToJet
private

Definition at line 43 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 35 of file JetCorrectionUncertainty.h.

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

float JetCorrectionUncertainty::mJetEMF
private

Definition at line 39 of file JetCorrectionUncertainty.h.

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

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

Definition at line 38 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