CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

JetCorrectionUncertainty Class Reference

#include <JetCorrectionUncertainty.h>

List of all members.

Public Member Functions

float getUncertainty (bool fDirection)
 JetCorrectionUncertainty (const std::string &fDataFile)
 JetCorrectionUncertainty ()
 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.

{
  mJetEta = -9999;
  mJetPt  = -9999;
  mJetPhi = -9999;
  mJetE   = -9999;
  mJetEMF = -9999;
  mLepPx  = -9999;
  mLepPy  = -9999;
  mLepPz  = -9999;
  mIsJetEset   = false;
  mIsJetPtset  = false;
  mIsJetPhiset = false;
  mIsJetEtaset = false;
  mIsJetEMFset = false;
  mIsLepPxset  = false;
  mIsLepPyset  = false;
  mIsLepPzset  = false;
  mAddLepToJet = false;
  mUncertainty = new SimpleJetCorrectionUncertainty();
}
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.

{
  mJetEta = -9999;
  mJetPt  = -9999;
  mJetPhi = -9999;
  mJetE   = -9999;
  mJetEMF = -9999;
  mLepPx  = -9999;
  mLepPy  = -9999;
  mLepPz  = -9999;
  mIsJetEset   = false;
  mIsJetPtset  = false;
  mIsJetPhiset = false;
  mIsJetEtaset = false;
  mIsJetEMFset = false;
  mIsLepPxset  = false;
  mIsLepPyset  = false;
  mIsLepPzset  = false;
  mAddLepToJet = false;
  mUncertainty = new SimpleJetCorrectionUncertainty(fDataFile);
}
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.

{
  mJetEta = -9999;
  mJetPt  = -9999;
  mJetPhi = -9999;
  mJetE   = -9999;
  mJetEMF = -9999;
  mLepPx  = -9999;
  mLepPy  = -9999;
  mLepPz  = -9999;
  mIsJetEset   = false;
  mIsJetPtset  = false;
  mIsJetPhiset = false;
  mIsJetEtaset = false;
  mIsJetEMFset = false;
  mIsLepPxset  = false;
  mIsLepPyset  = false;
  mIsLepPzset  = false;
  mAddLepToJet = false;
  mUncertainty = new SimpleJetCorrectionUncertainty(fParameters);
}
JetCorrectionUncertainty::~JetCorrectionUncertainty ( )

Definition at line 78 of file JetCorrectionUncertainty.cc.

References mUncertainty.

{
  delete 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 Exception, i, mIsJetEMFset, mIsJetEset, mIsJetEtaset, mIsJetPhiset, mIsJetPtset, mIsLepPxset, mIsLepPyset, mIsLepPzset, mJetE, mJetEMF, mJetEta, mJetPt, mLepPx, mLepPy, mLepPz, and query::result.

Referenced by getUncertainty().

{
  std::vector<float> result;
  for(unsigned i=0;i<fNames.size();i++)
    {
      if (fNames[i] == "JetEta")
        {
          if (!mIsJetEtaset)
            throw cms::Exception("JetCorrectionUncertainty::")<<" jet eta is not set";
          result.push_back(mJetEta);
        }
      else if (fNames[i] == "JetPt")
        {
          if (!mIsJetPtset)
            throw cms::Exception("JetCorrectionUncertainty::")<<" jet pt is not set";  
          result.push_back(mJetPt);
        }
      else if (fNames[i] == "JetPhi")
        {
          if (!mIsJetPhiset)
            throw cms::Exception("JetCorrectionUncertainty::")<<" jet phi is not set";  
          result.push_back(mJetPt);
        }
      else if (fNames[i] == "JetE")
        {
          if (!mIsJetEset)
            throw cms::Exception("JetCorrectionUncertainty::")<<" jet energy is not set";
          result.push_back(mJetE);
        }
      else if (fNames[i] == "JetEMF")
        {
          if (!mIsJetEMFset)
            throw cms::Exception("JetCorrectionUncertainty::")<<" jet emf is not set";
          result.push_back(mJetEMF);
        } 
      else if (fNames[i] == "LepPx")
        {
          if (!mIsLepPxset)
            throw cms::Exception("JetCorrectionUncertainty::")<<" lepton px is not set";  
          result.push_back(mLepPx);
        }
      else if (fNames[i] == "LepPy")
        {
          if (!mIsLepPyset)
            throw cms::Exception("JetCorrectionUncertainty::")<<" lepton py is not set";  
          result.push_back(mLepPy);
        }
      else if (fNames[i] == "LepPz")
        {
          if (!mIsLepPzset)
            throw cms::Exception("JetCorrectionUncertainty::")<<" lepton pz is not set";  
          result.push_back(mLepPz);
        }
      else
        throw cms::Exception("JetCorrectionUncertainty::")<<" unknown parameter "<<fNames[i];
    }     
  return result;      
}
float JetCorrectionUncertainty::getPtRel ( ) [private]

Definition at line 171 of file JetCorrectionUncertainty.cc.

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

{
  typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiE4D<float> > PtEtaPhiELorentzVector;
  typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float> > XYZVector;
  PtEtaPhiELorentzVector jet;
  XYZVector lep;
  jet.SetPt(mJetPt);
  jet.SetEta(mJetEta);
  jet.SetPhi(mJetPhi);
  jet.SetE(mJetE);
  lep.SetXYZ(mLepPx,mLepPy,mLepPz);
  float lj_x = (mAddLepToJet) ? lep.X()+jet.Px() : jet.Px();
  float lj_y = (mAddLepToJet) ? lep.Y()+jet.Py() : jet.Py();
  float lj_z = (mAddLepToJet) ? lep.Z()+jet.Pz() : jet.Pz();
  // absolute values squared
  float lj2  = lj_x*lj_x+lj_y*lj_y+lj_z*lj_z;
  if (!(lj2 > 0))
    throw cms::Exception("JetCorrectionUncertainty")<<" not positive lepton-jet momentum: "<<lj2;
  float lep2 = lep.X()*lep.X()+lep.Y()*lep.Y()+lep.Z()*lep.Z();
  // projection vec(mu) to lepjet axis
  float lepXlj = lep.X()*lj_x+lep.Y()*lj_y+lep.Z()*lj_z;
  // absolute value squared and normalized
  float pLrel2 = lepXlj*lepXlj/lj2;
  // lep2 = pTrel2 + pLrel2
  float pTrel2 = lep2-pLrel2;
  return (pTrel2 > 0) ? std::sqrt(pTrel2) : 0.0;
}
float JetCorrectionUncertainty::getUncertainty ( bool  fDirection)
JetCorrectionUncertainty& JetCorrectionUncertainty::operator= ( const JetCorrectionUncertainty ) [private]
void JetCorrectionUncertainty::setAddLepToJet ( bool  fAddLepToJet) [inline]

Definition at line 26 of file JetCorrectionUncertainty.h.

References mAddLepToJet.

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

Definition at line 219 of file JetCorrectionUncertainty.cc.

References mIsJetEset, and mJetE.

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

Definition at line 225 of file JetCorrectionUncertainty.cc.

References mIsJetEMFset, and mJetEMF.

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

Definition at line 213 of file JetCorrectionUncertainty.cc.

References mIsJetPhiset, and mJetPhi.

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

Definition at line 231 of file JetCorrectionUncertainty.cc.

References mIsLepPxset, and mLepPx.

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

Definition at line 237 of file JetCorrectionUncertainty.cc.

References mIsLepPyset, and mLepPy.

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

Definition at line 243 of file JetCorrectionUncertainty.cc.

References mIsLepPzset, and mLepPz.

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

Definition at line 83 of file JetCorrectionUncertainty.cc.

References mUncertainty.

{
  //---- delete the mParameters pointer before setting the new address ---
  delete mUncertainty; 
  mUncertainty = new SimpleJetCorrectionUncertainty(fDataFile);
}

Member Data Documentation

Definition at line 43 of file JetCorrectionUncertainty.h.

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

Definition at line 35 of file JetCorrectionUncertainty.h.

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

Definition at line 39 of file JetCorrectionUncertainty.h.

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

Definition at line 38 of file JetCorrectionUncertainty.h.

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