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

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 i, mIsJetEMFset, mIsJetEset, mIsJetEtaset, mIsJetPhiset, mIsJetPtset, mIsLepPxset, mIsLepPyset, mIsLepPzset, mJetE, mJetEMF, mJetEta, mJetPt, mLepPx, mLepPy, mLepPz, and mps_fire::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  edm::LogError("JetCorrectionUncertainty::")<<" jet eta is not set";
119  result.push_back(-999.0);
120  } else {
121  result.push_back(mJetEta);
122  }
123  }
124  else if (fNames[i] == "JetPt")
125  {
126  if (!mIsJetPtset){
127  edm::LogError("JetCorrectionUncertainty::")<<" jet pt is not set";
128  result.push_back(-999.0);
129  } else {
130  result.push_back(mJetPt);
131  }
132  }
133  else if (fNames[i] == "JetPhi")
134  {
135  if (!mIsJetPhiset) {
136  edm::LogError("JetCorrectionUncertainty::")<<" jet phi is not set";
137  result.push_back(-999.0);
138  } else {
139  result.push_back(mJetPt);
140  }
141  }
142  else if (fNames[i] == "JetE")
143  {
144  if (!mIsJetEset) {
145  edm::LogError("JetCorrectionUncertainty::")<<" jet energy is not set";
146  result.push_back(-999.0);
147  } else {
148  result.push_back(mJetE);
149  }
150  }
151  else if (fNames[i] == "JetEMF")
152  {
153  if (!mIsJetEMFset) {
154  edm::LogError("JetCorrectionUncertainty::")<<" jet emf is not set";
155  result.push_back(-999.0);
156  } else {
157  result.push_back(mJetEMF);
158  }
159  }
160  else if (fNames[i] == "LepPx")
161  {
162  if (!mIsLepPxset){
163  edm::LogError("JetCorrectionUncertainty::")<<" lepton px is not set";
164  result.push_back(-999.0);
165  } else {
166  result.push_back(mLepPx);
167  }
168  }
169  else if (fNames[i] == "LepPy")
170  {
171  if (!mIsLepPyset){
172  edm::LogError("JetCorrectionUncertainty::")<<" lepton py is not set";
173  result.push_back(-999.0);
174  } else {
175  result.push_back(mLepPy);
176  }
177  }
178  else if (fNames[i] == "LepPz")
179  {
180  if (!mIsLepPzset){
181  edm::LogError("JetCorrectionUncertainty::")<<" lepton pz is not set";
182  result.push_back(-999.0);
183  } else {
184  result.push_back(mLepPz);
185  }
186  }
187 
188  else {
189  edm::LogError("JetCorrectionUncertainty::")<<" unknown parameter "<<fNames[i];
190  result.push_back(-999.0);
191  }
192  }
193  return result;
194 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: mps_fire.py:83
float JetCorrectionUncertainty::getPtRel ( )
private

Definition at line 198 of file JetCorrectionUncertainty.cc.

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

199 {
200  typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiE4D<float> > PtEtaPhiELorentzVector;
201  typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float> > XYZVector;
202  PtEtaPhiELorentzVector jet;
203  XYZVector lep;
204  jet.SetPt(mJetPt);
205  jet.SetEta(mJetEta);
206  jet.SetPhi(mJetPhi);
207  jet.SetE(mJetE);
208  lep.SetXYZ(mLepPx,mLepPy,mLepPz);
209  float lj_x = (mAddLepToJet) ? lep.X()+jet.Px() : jet.Px();
210  float lj_y = (mAddLepToJet) ? lep.Y()+jet.Py() : jet.Py();
211  float lj_z = (mAddLepToJet) ? lep.Z()+jet.Pz() : jet.Pz();
212  // absolute values squared
213  float lj2 = lj_x*lj_x+lj_y*lj_y+lj_z*lj_z;
214  float pTrel2 = -999.0;
215  if (lj2 > 0) {
216  float lep2 = lep.X()*lep.X()+lep.Y()*lep.Y()+lep.Z()*lep.Z();
217  // projection vec(mu) to lepjet axis
218  float lepXlj = lep.X()*lj_x+lep.Y()*lj_y+lep.Z()*lj_z;
219  // absolute value squared and normalized
220  float pLrel2 = lepXlj*lepXlj/lj2;
221  // lep2 = pTrel2 + pLrel2
222  pTrel2 = lep2-pLrel2;
223  } else
224  edm::LogError("JetCorrectionUncertainty")<<" not positive lepton-jet momentum: "<<lj2;
225  return (pTrel2 > 0) ? std::sqrt(pTrel2) : 0.0;
226 }
T sqrt(T t)
Definition: SSEVec.h:18
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
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(), mps_fire::result, and SimpleJetCorrectionUncertainty::uncertainty().

Referenced by JetCorrectorDemo::analyze(), ShiftedPFCandidateProducerForPFNoPUMEt::produce(), 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: mps_fire.py:83
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 )
private
void JetCorrectionUncertainty::setAddLepToJet ( bool  fAddLepToJet)
inline

Definition at line 28 of file JetCorrectionUncertainty.h.

References mAddLepToJet.

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

Definition at line 248 of file JetCorrectionUncertainty.cc.

References mIsJetEset, and mJetE.

249 {
250  mJetE = fE;
251  mIsJetEset = true;
252 }
void JetCorrectionUncertainty::setJetEMF ( float  fEMF)

Definition at line 254 of file JetCorrectionUncertainty.cc.

References mIsJetEMFset, and mJetEMF.

255 {
256  mJetEMF = fEMF;
257  mIsJetEMFset = true;
258 }
void JetCorrectionUncertainty::setJetEta ( float  fEta)
void JetCorrectionUncertainty::setJetPhi ( float  fE)

Definition at line 242 of file JetCorrectionUncertainty.cc.

References mIsJetPhiset, and mJetPhi.

243 {
244  mJetPhi = fPhi;
245  mIsJetPhiset = true;
246 }
void JetCorrectionUncertainty::setJetPt ( float  fPt)
void JetCorrectionUncertainty::setLepPx ( float  fLepPx)

Definition at line 260 of file JetCorrectionUncertainty.cc.

References mIsLepPxset, and mLepPx.

261 {
262  mLepPx = fPx;
263  mIsLepPxset = true;
264 }
void JetCorrectionUncertainty::setLepPy ( float  fLepPy)

Definition at line 266 of file JetCorrectionUncertainty.cc.

References mIsLepPyset, and mLepPy.

267 {
268  mLepPy = fPy;
269  mIsLepPyset = true;
270 }
void JetCorrectionUncertainty::setLepPz ( float  fLepPz)

Definition at line 272 of file JetCorrectionUncertainty.cc.

References mIsLepPzset, and mLepPz.

273 {
274  mLepPz = fPz;
275  mIsLepPzset = true;
276 }
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 45 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 37 of file JetCorrectionUncertainty.h.

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

float JetCorrectionUncertainty::mJetEMF
private

Definition at line 41 of file JetCorrectionUncertainty.h.

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

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

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