ValueErr< T > Class Template Reference

#include <ValueErr.h>

List of all members.

Public Member Functions

 ValueErr (T value=0, T err=0)
 ValueErr (const ValueErr< T > &rhs)
virtual ~ValueErr ()
void Set (T value, T err=0)
void Set (const ValueErr< T > &rhs)
void SetValueError2 (T value, T err2)
void SetValue (T value)
void SetError (T error)
void SetError2 (T error2)
void SetFracError (T frac)
operator() () const
GetValue () const
GetValue2 () const
Get () const
GetError () const
GetError2 () const
GetFracError () const
GetFracError2 () const
GetPosError () const
GetNegError () const
ValueErr< T > operator= (const T &value)
 operator T () const
ValueErr< T > & operator++ ()
ValueErr< T > operator++ (int)
ValueErr< T > & operator-- ()
ValueErr< T > operator-- (int)
ValueErr< T > & operator+= (const ValueErr< T > &x)
ValueErr< T > & operator-= (const ValueErr< T > &x)
ValueErr< T > & operator*= (const ValueErr< T > &x)
ValueErr< T > & operator/= (const ValueErr< T > &x)
void Print (Option_t *option="") const
const char * AsString (Option_t *option="") const
 ValueErr (T value=0, T err=0)
 ValueErr (const ValueErr< T > &rhs)
virtual ~ValueErr ()
void Set (T value, T err=0)
void Set (const ValueErr< T > &rhs)
void SetValueError2 (T value, T err2)
void SetValue (T value)
void SetError (T error)
void SetError2 (T error2)
void SetFracError (T frac)
operator() () const
GetValue () const
GetValue2 () const
Get () const
GetError () const
GetError2 () const
GetFracError () const
GetFracError2 () const
GetPosError () const
GetNegError () const
ValueErr< T > operator= (const T &value)
 operator T () const
ValueErr< T > & operator++ ()
ValueErr< T > operator++ (int)
ValueErr< T > & operator-- ()
ValueErr< T > operator-- (int)
ValueErr< T > & operator+= (const ValueErr< T > &x)
ValueErr< T > & operator-= (const ValueErr< T > &x)
ValueErr< T > & operator*= (const ValueErr< T > &x)
ValueErr< T > & operator/= (const ValueErr< T > &x)
void Print (Option_t *option="") const
const char * AsString (Option_t *option="") const

Static Private Member Functions

static ValueErr< T > valueErr2 (T value, T err2)
static ValueErr< T > valueErr2 (T value, T err2)

Private Attributes

fValue
fError2

Friends

template<class L >
ValueErr< L > operator+ (const L &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator+ (const ValueErr< L > &lhs, const L &rhs)
template<class L >
ValueErr< L > operator+ (const ValueErr< L > &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator- (const L &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator- (const ValueErr< L > &lhs, const L &rhs)
template<class L >
ValueErr< L > operator- (const ValueErr< L > &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator* (const L &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator* (const ValueErr< L > &lhs, const L &rhs)
template<class L >
ValueErr< L > operator* (const ValueErr< L > &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator/ (const L &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator/ (const ValueErr< L > &lhs, const L &rhs)
template<class L >
ValueErr< L > operator/ (const ValueErr< L > &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator+ (const L &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator+ (const ValueErr< L > &lhs, const L &rhs)
template<class L >
ValueErr< L > operator+ (const ValueErr< L > &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator- (const L &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator- (const ValueErr< L > &lhs, const L &rhs)
template<class L >
ValueErr< L > operator- (const ValueErr< L > &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator* (const L &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator* (const ValueErr< L > &lhs, const L &rhs)
template<class L >
ValueErr< L > operator* (const ValueErr< L > &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator/ (const L &lhs, const ValueErr< L > &rhs)
template<class L >
ValueErr< L > operator/ (const ValueErr< L > &lhs, const L &rhs)
template<class L >
ValueErr< L > operator/ (const ValueErr< L > &lhs, const ValueErr< L > &rhs)

Detailed Description

template<class T>
class ValueErr< T >

Definition at line 29 of file Calibrator/HEAD/ValueErr.h.


Constructor & Destructor Documentation

template<class T>
ValueErr< T >::ValueErr ( value = 0,
err = 0 
) [inline]

Definition at line 37 of file Calibrator/HEAD/ValueErr.h.

00037 { Set(value,err); };

template<class T>
ValueErr< T >::ValueErr ( const ValueErr< T > &  rhs  )  [inline]

Definition at line 38 of file Calibrator/HEAD/ValueErr.h.

00038 : fValue(rhs.fValue), fError2(rhs.fError2) {};

template<class T>
virtual ValueErr< T >::~ValueErr (  )  [inline, virtual]

Definition at line 39 of file Calibrator/HEAD/ValueErr.h.

00039 {};

template<class T>
ValueErr< T >::ValueErr ( value = 0,
err = 0 
) [inline]

Definition at line 37 of file RootUtil/HEAD/ValueErr.h.

00037 { Set(value,err); };

template<class T>
ValueErr< T >::ValueErr ( const ValueErr< T > &  rhs  )  [inline]

Definition at line 38 of file RootUtil/HEAD/ValueErr.h.

00038 : fValue(rhs.fValue), fError2(rhs.fError2) {};

template<class T>
virtual ValueErr< T >::~ValueErr (  )  [inline, virtual]

Definition at line 39 of file RootUtil/HEAD/ValueErr.h.

00039 {};


Member Function Documentation

template<class T>
const char* ValueErr< T >::AsString ( Option_t *  option = ""  )  const
template<class T >
const char * ValueErr< T >::AsString ( Option_t *  option = ""  )  const [inline]

Definition at line 41 of file Calibrator/HEAD/ValueErr.cxx.

References ValueErr< T >::GetError(), ValueErr< T >::GetValue(), and kPlusMinus.

Referenced by MuonDriftCalScheme::DoReset().

00042 {
00043   static char buffer[100];
00044   sprintf(buffer,"%f%s%f",GetValue(), kPlusMinus, GetError());
00045   return buffer;
00046 }

template<class T>
T ValueErr< T >::Get ( void   )  const [inline]

Definition at line 51 of file RootUtil/HEAD/ValueErr.h.

00051 { return fValue; };

template<class T>
T ValueErr< T >::Get (  )  const [inline]

Definition at line 51 of file Calibrator/HEAD/ValueErr.h.

00051 { return fValue; };

template<class T>
T ValueErr< T >::GetError (  )  const [inline]

Definition at line 52 of file RootUtil/HEAD/ValueErr.h.

00052 { return TMath::Sqrt(fError2); };

template<class T>
T ValueErr< T >::GetError (  )  const [inline]
template<class T>
T ValueErr< T >::GetError2 (  )  const [inline]

Definition at line 53 of file RootUtil/HEAD/ValueErr.h.

00053 { return fError2; };

template<class T>
T ValueErr< T >::GetError2 (  )  const [inline]
template<class T>
T ValueErr< T >::GetFracError (  )  const [inline]

Definition at line 54 of file RootUtil/HEAD/ValueErr.h.

00054 { if(GetValue()!=0) return GetError()/GetValue(); else return kValueErr_Big; };

template<class T>
T ValueErr< T >::GetFracError (  )  const [inline]
template<class T>
T ValueErr< T >::GetFracError2 (  )  const [inline]

Definition at line 55 of file RootUtil/HEAD/ValueErr.h.

00055 { if(GetValue()!=0) return GetError2()/GetValue2(); else return kValueErr_Big; };

template<class T>
T ValueErr< T >::GetFracError2 (  )  const [inline]

Definition at line 55 of file Calibrator/HEAD/ValueErr.h.

Referenced by operator*().

00055 { if(GetValue()!=0) return GetError2()/GetValue2(); else return kValueErr_Big; };

template<class T>
T ValueErr< T >::GetNegError (  )  const [inline]

Definition at line 57 of file RootUtil/HEAD/ValueErr.h.

00057 { return GetError(); };

template<class T>
T ValueErr< T >::GetNegError (  )  const [inline]

Definition at line 57 of file Calibrator/HEAD/ValueErr.h.

00057 { return GetError(); };

template<class T>
T ValueErr< T >::GetPosError (  )  const [inline]

Definition at line 56 of file RootUtil/HEAD/ValueErr.h.

00056 { return GetError(); };

template<class T>
T ValueErr< T >::GetPosError (  )  const [inline]

Definition at line 56 of file Calibrator/HEAD/ValueErr.h.

00056 { return GetError(); };

template<class T>
T ValueErr< T >::GetValue (  )  const [inline]

Definition at line 49 of file RootUtil/HEAD/ValueErr.h.

00049 { return fValue; };

template<class T>
T ValueErr< T >::GetValue (  )  const [inline]
template<class T>
T ValueErr< T >::GetValue2 (  )  const [inline]

Definition at line 50 of file RootUtil/HEAD/ValueErr.h.

00050 { return fValue*fValue; };

template<class T>
T ValueErr< T >::GetValue2 (  )  const [inline]
template<class T>
ValueErr< T >::operator T (  )  const [inline]

Definition at line 63 of file RootUtil/HEAD/ValueErr.h.

References ValueErr< T >::GetValue().

00063 { return GetValue(); };

template<class T>
ValueErr< T >::operator T (  )  const [inline]

Definition at line 63 of file Calibrator/HEAD/ValueErr.h.

References ValueErr< T >::GetValue().

00063 { return GetValue(); };

template<class T>
T ValueErr< T >::operator() ( void   )  const [inline]

Definition at line 48 of file RootUtil/HEAD/ValueErr.h.

00048 { return fValue; };

template<class T>
T ValueErr< T >::operator() (  )  const [inline]

Definition at line 48 of file Calibrator/HEAD/ValueErr.h.

00048 { return fValue; };

template<class T>
ValueErr<T>& ValueErr< T >::operator*= ( const ValueErr< T > &  x  ) 
template<class T>
ValueErr< T > & ValueErr< T >::operator*= ( const ValueErr< T > &  x  )  [inline]

Definition at line 60 of file Calibrator/HEAD/ValueErr.cxx.

References err(), ValueErr< T >::GetError2(), ValueErr< T >::GetValue(), ValueErr< T >::GetValue2(), kValueErr_Big, and ValueErr< T >::Set().

00061 {
00062   T x = this->GetValue() * rhs.GetValue();
00063   T err;
00064   if(x!=0) 
00065     err = TMath::Abs(x) * TMath::Sqrt((this->GetError2()/this->GetValue2()) + (rhs.GetError2()/rhs.GetValue2()));
00066   else 
00067     err = kValueErr_Big;
00068   Set(x,err);
00069   return *this;
00070 }

template<class T>
ValueErr<T> ValueErr< T >::operator++ ( int   ) 
template<class T>
ValueErr<T>& ValueErr< T >::operator++ (  ) 
template<class T >
ValueErr< T > ValueErr< T >::operator++ ( int   )  [inline]

Definition at line 207 of file Calibrator/HEAD/ValueErr.h.

References ValueErr< T >::fValue.

00208 { ValueErr<T> ans = *this; ++fValue; return ans; }

template<class T >
ValueErr< T > & ValueErr< T >::operator++ (  )  [inline]

Definition at line 205 of file Calibrator/HEAD/ValueErr.h.

References ValueErr< T >::fValue.

00206 { ++fValue; return *this; }

template<class T>
ValueErr<T>& ValueErr< T >::operator+= ( const ValueErr< T > &  x  ) 
template<class T>
ValueErr< T > & ValueErr< T >::operator+= ( const ValueErr< T > &  x  )  [inline]

Definition at line 220 of file Calibrator/HEAD/ValueErr.h.

References ValueErr< T >::GetError2(), ValueErr< T >::GetValue(), ValueErr< T >::SetError2(), and ValueErr< T >::SetValue().

00221 {
00222   this->SetValue(this->GetValue() + rhs.GetValue());
00223   this->SetError2(this->GetError2() + rhs.GetError2());
00224   return *this;
00225 }

template<class T>
ValueErr<T> ValueErr< T >::operator-- ( int   ) 
template<class T>
ValueErr<T>& ValueErr< T >::operator-- (  ) 
template<class T >
ValueErr< T > ValueErr< T >::operator-- ( int   )  [inline]

Definition at line 211 of file Calibrator/HEAD/ValueErr.h.

References ValueErr< T >::fValue.

00212 { ValueErr<T> ans = *this; --fValue; return ans; }

template<class T >
ValueErr< T > & ValueErr< T >::operator-- (  )  [inline]

Definition at line 209 of file Calibrator/HEAD/ValueErr.h.

References ValueErr< T >::fValue.

00210 { --fValue; return *this; }

template<class T>
ValueErr<T>& ValueErr< T >::operator-= ( const ValueErr< T > &  x  ) 
template<class T>
ValueErr< T > & ValueErr< T >::operator-= ( const ValueErr< T > &  x  )  [inline]

Definition at line 231 of file Calibrator/HEAD/ValueErr.h.

References ValueErr< T >::GetError2(), ValueErr< T >::GetValue(), ValueErr< T >::SetError2(), and ValueErr< T >::SetValue().

00232 {
00233   this->SetValue ( this->GetValue()  - rhs.GetValue()   );
00234   this->SetError2( this->GetError2() + rhs.GetError2() );
00235   return *this;
00236 }

template<class T>
ValueErr<T>& ValueErr< T >::operator/= ( const ValueErr< T > &  x  ) 
template<class T>
ValueErr< T > & ValueErr< T >::operator/= ( const ValueErr< T > &  x  )  [inline]

Definition at line 247 of file Calibrator/HEAD/ValueErr.h.

References ValueErr< T >::GetError2(), ValueErr< T >::GetValue(), and ValueErr< T >::SetValueError2().

00248 {
00249   // Note: doesn't trap rhs=0.
00250   T x = this->GetValue();
00251   T y = rhs.GetValue();
00252   T f = x/y;
00253   T y2 = y*y;
00254   T x2 = x*x;
00255   // err = x/y * sqrt( dx2/x2 + dy2/y2)    // This works, but has a div-by-zero for x=0
00256   T err2 = ( this->GetError2()/y2 
00257              + rhs.GetError2()*x2/(y2*y2) );
00258   
00259   SetValueError2(f,err2);
00260   return (*this);
00261 }

template<class T>
ValueErr<T> ValueErr< T >::operator= ( const T &  value  )  [inline]

Definition at line 60 of file RootUtil/HEAD/ValueErr.h.

00060 { Set(value,0); return (*this);};

template<class T>
ValueErr<T> ValueErr< T >::operator= ( const T &  value  )  [inline]

Definition at line 60 of file Calibrator/HEAD/ValueErr.h.

00060 { Set(value,0); return (*this);};

template<class T>
void ValueErr< T >::Print ( Option_t *  option = ""  )  const
template<class T >
void ValueErr< T >::Print ( Option_t *  option = ""  )  const [inline]

Definition at line 35 of file Calibrator/HEAD/ValueErr.cxx.

References ValueErr< T >::GetError(), ValueErr< T >::GetValue(), and kPlusMinus.

Referenced by errproptest().

00036 {
00037   cout << "ValueErr: " << GetValue() << kPlusMinus << GetError() << endl;
00038 }

template<class T>
void ValueErr< T >::Set ( const ValueErr< T > &  rhs  )  [inline]

Definition at line 42 of file RootUtil/HEAD/ValueErr.h.

00042 { fValue=rhs.fValue; fError2=rhs.fError2; };

template<class T>
void ValueErr< T >::Set ( value,
err = 0 
) [inline]

Definition at line 41 of file RootUtil/HEAD/ValueErr.h.

00041 { fValue=value; fError2=err*err; };

template<class T>
void ValueErr< T >::Set ( const ValueErr< T > &  rhs  )  [inline]

Definition at line 42 of file Calibrator/HEAD/ValueErr.h.

00042 { fValue=rhs.fValue; fError2=rhs.fError2; };

template<class T>
void ValueErr< T >::Set ( value,
err = 0 
) [inline]
template<class T>
void ValueErr< T >::SetError ( error  )  [inline]

Definition at line 45 of file RootUtil/HEAD/ValueErr.h.

00045 { fError2 = error*error; };

template<class T>
void ValueErr< T >::SetError ( error  )  [inline]
template<class T>
void ValueErr< T >::SetError2 ( error2  )  [inline]

Definition at line 46 of file RootUtil/HEAD/ValueErr.h.

00046 { fError2 = error2; };

template<class T>
void ValueErr< T >::SetError2 ( error2  )  [inline]
template<class T>
void ValueErr< T >::SetFracError ( frac  )  [inline]

Definition at line 47 of file RootUtil/HEAD/ValueErr.h.

00047 { fError2 = frac*frac*GetValue2(); };

template<class T>
void ValueErr< T >::SetFracError ( frac  )  [inline]

Definition at line 47 of file Calibrator/HEAD/ValueErr.h.

00047 { fError2 = frac*frac*GetValue2(); };

template<class T>
void ValueErr< T >::SetValue ( value  )  [inline]

Definition at line 44 of file RootUtil/HEAD/ValueErr.h.

00044 { fValue = value; };

template<class T>
void ValueErr< T >::SetValue ( value  )  [inline]

Definition at line 44 of file Calibrator/HEAD/ValueErr.h.

Referenced by ValueErr< T >::operator+=(), and ValueErr< T >::operator-=().

00044 { fValue = value; };

template<class T>
void ValueErr< T >::SetValueError2 ( value,
err2 
) [inline]

Definition at line 43 of file RootUtil/HEAD/ValueErr.h.

00043 { fValue = value; fError2=err2; };

template<class T>
void ValueErr< T >::SetValueError2 ( value,
err2 
) [inline]
template<class T>
static ValueErr<T> ValueErr< T >::valueErr2 ( value,
err2 
) [inline, static, private]

Definition at line 34 of file RootUtil/HEAD/ValueErr.h.

00034 { ValueErr<T> result(value); result.SetError2(err2); return result; };

template<class T>
static ValueErr<T> ValueErr< T >::valueErr2 ( value,
err2 
) [inline, static, private]

Definition at line 34 of file Calibrator/HEAD/ValueErr.h.

Referenced by operator*(), operator+(), operator-(), and operator/().

00034 { ValueErr<T> result(value); result.SetError2(err2); return result; };


Friends And Related Function Documentation

template<class T>
template<class L >
ValueErr<L> operator* ( const ValueErr< L > &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator* ( const ValueErr< L > &  lhs,
const L &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator* ( const L &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator* ( const ValueErr< L > &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator* ( const ValueErr< L > &  lhs,
const L &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator* ( const L &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator+ ( const ValueErr< L > &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator+ ( const ValueErr< L > &  lhs,
const L &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator+ ( const L &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator+ ( const ValueErr< L > &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator+ ( const ValueErr< L > &  lhs,
const L &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator+ ( const L &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator- ( const ValueErr< L > &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator- ( const ValueErr< L > &  lhs,
const L &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator- ( const L &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator- ( const ValueErr< L > &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator- ( const ValueErr< L > &  lhs,
const L &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator- ( const L &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator/ ( const ValueErr< L > &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator/ ( const ValueErr< L > &  lhs,
const L &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator/ ( const L &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator/ ( const ValueErr< L > &  lhs,
const ValueErr< L > &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator/ ( const ValueErr< L > &  lhs,
const L &  rhs 
) [friend]
template<class T>
template<class L >
ValueErr<L> operator/ ( const L &  lhs,
const ValueErr< L > &  rhs 
) [friend]

Member Data Documentation

template<class T>
T ValueErr< T >::fError2 [private]
template<class T>
T ValueErr< T >::fValue [private]

The documentation for this class was generated from the following files:

Generated on 24 Jul 2017 for loon by  doxygen 1.6.1