Go to the documentation of this file.00001 #include "ForIA/TruthJet.hh"
00002 #include <gsl/gsl_cdf.h>
00003 #include <cmath>
00004
00005 #include <stdexcept>
00006
00007 namespace ForIA{
00008
00009 TruthJet::TruthJet(): IFourMomentum(),
00010 m_gotpx(false), m_gotpy(false), m_gotpz(false){
00011 }
00013 double TruthJet::E() const{
00014 return m_E;
00015 }
00017 double TruthJet::ET() const{
00018 double et = E()*sin(theta());
00019 return et;
00020 }
00022 double TruthJet::PT() const{
00023 return m_PT;
00024 }
00026 double TruthJet::theta() const{
00027 double theta = 2*atan(exp(-1.0*m_eta));
00028 return theta;
00029 }
00031 double TruthJet::phi() const{
00032 return m_phi;
00033 }
00035 double TruthJet::eta() const{
00036 return m_eta;
00037 }
00038
00039 double TruthJet::px()const{
00040 if(m_gotpx) return m_px;
00041 m_px = PT()*sin(phi());
00042 m_gotpx = true;
00043 return m_px;
00044 }
00045
00046 double TruthJet::py()const{
00047 if(m_gotpy) return m_py;
00048 m_py = PT()*cos(phi());
00049 m_gotpy = true;
00050 return m_py;
00051 }
00052
00053 double TruthJet::pz()const{
00054 if(m_gotpz) return m_pz;
00055 double tanp = tan(theta());
00056 if(fabs(tanp) < 1.e-12){
00057 throw std::runtime_error("Cannot get pz for truth jet with theta = 0");
00058 }
00059 m_pz = PT() / tanp;
00060 m_gotpz = true;
00061 return m_pz;
00062 }
00063
00065 std::ostream &operator << (std::ostream &out, const TruthJet &truthJet){
00066 out<<"TruthJet: { E: "<<truthJet.m_E;
00067 out<<" , PT: "<<truthJet.m_PT;
00068 out<<" , eta: "<<truthJet.m_eta;
00069 out<<" , phi: "<<truthJet.m_phi;
00070 out<<"}";
00071 return out;
00072 }
00073
00074
00075 }