#include <EvtValError.hh>
Public Member Functions | |
EvtValError () | |
EvtValError (double val) | |
EvtValError (double val, double err) | |
EvtValError (const EvtValError &other) | |
~EvtValError () | |
int | valueKnown () const |
double | value () const |
int | errorKnown () const |
double | error () const |
double | prec () const |
void | operator= (const EvtValError &other) |
void | operator *= (const EvtValError &other) |
void | operator/= (const EvtValError &other) |
void | operator+= (const EvtValError &other) |
void | operator *= (double c) |
void | print (std::ostream &) const |
Private Attributes | |
int | _valKnown |
double | _val |
int | _errKnown |
double | _err |
Definition at line 20 of file EvtValError.hh.
EvtValError::EvtValError | ( | ) |
EvtValError::EvtValError | ( | double | val | ) |
EvtValError::EvtValError | ( | double | val, | |
double | err | |||
) |
EvtValError::EvtValError | ( | const EvtValError & | other | ) |
EvtValError::~EvtValError | ( | ) |
double EvtValError::error | ( | ) | const [inline] |
int EvtValError::errorKnown | ( | ) | const [inline] |
void EvtValError::operator *= | ( | double | c | ) |
void EvtValError::operator *= | ( | const EvtValError & | other | ) |
Definition at line 52 of file EvtValError.cc.
References _err, _errKnown, _val, _valKnown, EvtCyclic3::other(), and prec().
00053 { 00054 assert(_valKnown && other._valKnown); 00055 00056 // Relative errors add in quadrature 00057 if(_errKnown && other._errKnown) 00058 _err = _val * other._val * sqrt(prec()*prec() + other.prec() * other.prec()); 00059 else _errKnown = 0; 00060 00061 // Modify the value 00062 _val *= other._val; 00063 }
void EvtValError::operator+= | ( | const EvtValError & | other | ) |
Definition at line 90 of file EvtValError.cc.
References _err, _errKnown, _valKnown, and EvtCyclic3::other().
00091 { 00092 assert(_valKnown); assert(other._valKnown); 00093 _val += other._val; 00094 00095 // add errors in quadrature 00096 00097 if(_errKnown && other._errKnown) { 00098 00099 _err = sqrt(_err*_err + other._err*other._err); 00100 } 00101 else { 00102 00103 _errKnown = 0; 00104 } 00105 }
void EvtValError::operator/= | ( | const EvtValError & | other | ) |
Definition at line 65 of file EvtValError.cc.
References _err, _errKnown, _val, _valKnown, EvtCyclic3::other(), and prec().
00066 { 00067 assert(_valKnown && other._valKnown && other._val != 0.); 00068 00069 // Relative errors add in quadrature 00070 if(_errKnown && other._errKnown) 00071 _err = _val/other._val * sqrt(prec()*prec() + other.prec() * other.prec()); 00072 else _errKnown = 0; 00073 00074 // Modify the value 00075 _val /= other._val; 00076 }
void EvtValError::operator= | ( | const EvtValError & | other | ) |
double EvtValError::prec | ( | ) | const |
Definition at line 38 of file EvtValError.cc.
References _err, _errKnown, _val, and _valKnown.
Referenced by operator *=(), and operator/=().
void EvtValError::print | ( | std::ostream & | ) | const |
double EvtValError::value | ( | ) | const [inline] |
Definition at line 31 of file EvtValError.hh.
References _val, and _valKnown.
Referenced by EvtPdfSum< T >::randomPoint().
int EvtValError::valueKnown | ( | ) | const [inline] |
Definition at line 30 of file EvtValError.hh.
References _valKnown.
Referenced by EvtPdf< EvtPoint1D >::getItg(), and EvtPdfSum< T >::randomPoint().
00030 { return _valKnown; }
double EvtValError::_err [private] |
Definition at line 49 of file EvtValError.hh.
Referenced by error(), operator *=(), operator+=(), operator/=(), operator=(), and prec().
int EvtValError::_errKnown [private] |
Definition at line 48 of file EvtValError.hh.
Referenced by error(), errorKnown(), operator *=(), operator+=(), operator/=(), operator=(), and prec().
double EvtValError::_val [private] |
Definition at line 47 of file EvtValError.hh.
Referenced by operator *=(), operator/=(), operator=(), prec(), and value().
int EvtValError::_valKnown [private] |
Definition at line 46 of file EvtValError.hh.
Referenced by operator *=(), operator+=(), operator/=(), operator=(), prec(), value(), and valueKnown().