Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

EvtValError Class Reference

#include <EvtValError.hh>

List of all members.

Public Member Functions

double error () const
int errorKnown () const
 EvtValError (const EvtValError &other)
 EvtValError (double val, double err)
 EvtValError (double val)
 EvtValError ()
void operator *= (double c)
void operator *= (const EvtValError &other)
void operator+= (const EvtValError &other)
void operator/= (const EvtValError &other)
void operator= (const EvtValError &other)
double prec () const
void print (std::ostream &) const
double value () const
int valueKnown () const
 ~EvtValError ()

Private Attributes

double _err
int _errKnown
double _val
int _valKnown


Constructor & Destructor Documentation

EvtValError::EvtValError  ) 
 

00019   : _valKnown(0), _val(0.), _errKnown(0), _err(0.)
00020 {}

EvtValError::EvtValError double  val  ) 
 

00023   : _valKnown(1), _val(val), _errKnown(0), _err(0.)
00024 {}

EvtValError::EvtValError double  val,
double  err
 

00027   : _valKnown(1), _val(val), _errKnown(1), _err(err)
00028 {}

EvtValError::EvtValError const EvtValError other  ) 
 

EvtValError::~EvtValError  ) 
 

00036 {}


Member Function Documentation

double EvtValError::error  )  const [inline]
 

00033 { assert(_errKnown); return _err; }

int EvtValError::errorKnown  )  const [inline]
 

00032 { return _errKnown; }

void EvtValError::operator *= double  c  ) 
 

00107                                      {
00108   
00109   assert(_valKnown);
00110   _val *= c;
00111   if(_errKnown) _err*=c;
00112 }

void EvtValError::operator *= const EvtValError other  ) 
 

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  ) 
 

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  ) 
 

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  ) 
 

00045 {
00046   _valKnown = other._valKnown;
00047   _val = other._val;
00048   _errKnown = other._errKnown;
00049   _err = other._err;
00050 }

double EvtValError::prec  )  const
 

00039 { 
00040   assert(_valKnown && _errKnown); 
00041   return ( _val != 0) ? _err/_val : 0; 
00042 }

void EvtValError::print std::ostream  )  const
 

00080 {
00081   if(_valKnown) os << _val;
00082   else os << "Undef";
00083   os << " +/- ";
00084   if(_errKnown) os << _err;
00085   else os << "Undef";
00086   os << endl;
00087 }

double EvtValError::value  )  const [inline]
 

00031 { assert(_valKnown); return _val; }

int EvtValError::valueKnown  )  const [inline]
 

00030 { return _valKnown; }


Member Data Documentation

double EvtValError::_err [private]
 

int EvtValError::_errKnown [private]
 

double EvtValError::_val [private]
 

int EvtValError::_valKnown [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:12:34 2011 for BOSS6.5.5 by  doxygen 1.3.9.1