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

RootUtil/ValueErr.h File Reference

#include <Rtypes.h>
#include <TMath.h>
#include <iostream>
#include <fstream>

Go to the source code of this file.

Classes

class  ValueErr< T >

Typedefs

typedef ValueErr< double > DoubleErr
typedef ValueErr< float > FloatErr

Functions

template<class T>
std::ifstream & operator>> (std::ifstream &ins, ValueErr< T > &x)
template<class T>
std::ostream & operator<< (std::ostream &outs, const ValueErr< T > &x)
template<class T>
ValueErr< T > operator+ (const T &lhs, const ValueErr< T > &rhs)
template<class T>
ValueErr< T > operator+ (const ValueErr< T > &lhs, const T &rhs)
template<class T>
ValueErr< T > operator+ (const ValueErr< T > &lhs, const ValueErr< T > &rhs)
template<class T>
ValueErr< T > operator- (const T &lhs, const ValueErr< T > &rhs)
template<class T>
ValueErr< T > operator- (const ValueErr< T > &lhs, const T &rhs)
template<class T>
ValueErr< T > operator- (const ValueErr< T > &lhs, const ValueErr< T > &rhs)
template<class T>
ValueErr< T > operator * (const T &lhs, const ValueErr< T > &rhs)
template<class T>
ValueErr< T > operator * (const ValueErr< T > &lhs, const T &rhs)
template<class T>
ValueErr< T > operator * (const ValueErr< T > &lhs, const ValueErr< T > &rhs)
template<class T>
ValueErr< T > operator/ (const T &lhs, const ValueErr< T > &rhs)
template<class T>
ValueErr< T > operator/ (const ValueErr< T > &lhs, const T &rhs)
template<class T>
ValueErr< T > operator/ (const ValueErr< T > &lhs, const ValueErr< T > &rhs)

Variables

const float kValueErr_Big = 1e19


Typedef Documentation

typedef ValueErr<double> DoubleErr
 

Definition at line 117 of file RootUtil/ValueErr.h.

Referenced by PulserTimeCalScheme::CalibrateByMuon(), PulserTimeCalScheme::CalibrateByPulser(), PulserTimeCalScheme::CalibrateShield(), Calibrator::GetAttenCorrected(), SimpleCalScheme::GetCalibratedTime(), Calibrator::GetDriftCorrected(), Calibrator::GetLinearized(), Calibrator::GetLinearizedVA(), Calibrator::GetMIP(), Calibrator::GetPhotoElectrons(), and Calibrator::GetStripToStripCorrected().

typedef ValueErr<float> FloatErr
 

Definition at line 118 of file RootUtil/ValueErr.h.

Referenced by PulserSigLinCalScheme::ApplyBendyCalib(), PulserSigLinCalScheme::ApplyCalib(), PulserSigLinCalScheme::ApplyCalibFar(), PhotonStatSummarizer::ComputePmtDrifts(), StripAttenCalScheme::DecalAttenCorrected(), SimpleCalScheme::DecalAttenCorrected(), SimpleCalScheme::DecalDrift(), PulserDriftCalScheme::DecalDrift(), SimpleCalScheme::DecalLinearity(), PulserLinearityCalScheme::DecalLinFar(), SimpleCalScheme::DecalMIP(), StripToStripCalScheme::DecalStripToStrip(), SimpleCalScheme::DecalStripToStrip(), TimeCalScheme::DecalTime(), VaLinearityCalScheme::DecalVALinearity(), MuonDriftCalScheme::DoReset(), StripAttenCalScheme::GetAttenCorrected(), SimpleCalScheme::GetAttenCorrected(), TimeCalScheme::GetCalibratedTime(), PmtDriftCalScheme::GetDrift(), PulserDriftCalScheme::GetDriftCorrected(), PulserDriftCalScheme::GetDriftPinDiodeValue(), VaLinearityCalScheme::GetLinearizedVA(), SimpleCalScheme::GetLinearizedVA(), PulserLinearityCalScheme::GetLinFar(), SimpleCalScheme::GetMIP(), PEGainCalScheme::GetPhotoElectrons(), PEGainAggCalScheme::GetPhotoElectrons(), PmtDriftCalScheme::GetPixelCorrection(), StripToStripCalScheme::GetStripToStripCorrected(), SimpleCalScheme::GetStripToStripCorrected(), GetWeightedMean(), PhotonStatSummarizer::LoadDataFromDB(), and MinosCompactEvent::MinosCompactEvent().


Function Documentation

template<class T>
ValueErr<T> operator * const ValueErr< T > &  lhs,
const ValueErr< T > &  rhs
[inline]
 

Definition at line 167 of file RootUtil/ValueErr.h.

References ValueErr< T >::GetFracError2(), ValueErr< T >::GetValue(), and ValueErr< T >::valueErr2().

00168 {
00169   T x = lhs.GetValue() * rhs.GetValue();
00170   T err2;
00171   if(x!=0) 
00172     err2 = x*x * ( lhs.GetFracError2() + rhs.GetFracError2() );
00173   else 
00174     err2 = kValueErr_Big;  // FIXME: could use some presciption here.
00175   return ValueErr<T>::valueErr2(x,err2);
00176 }

template<class T>
ValueErr<T> operator * const ValueErr< T > &  lhs,
const T &  rhs
[inline]
 

Definition at line 163 of file RootUtil/ValueErr.h.

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

00164 { return ValueErr<T>::valueErr2(lhs.GetValue() * rhs, lhs.GetError()*rhs*rhs); }

template<class T>
ValueErr<T> operator * const T &  lhs,
const ValueErr< T > &  rhs
[inline]
 

Definition at line 159 of file RootUtil/ValueErr.h.

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

00160 { return ValueErr<T>::valueErr2(lhs * rhs.GetValue(), rhs.GetError2()*lhs*lhs); }

template<class T>
ValueErr<T> operator+ const ValueErr< T > &  lhs,
const ValueErr< T > &  rhs
[inline]
 

Definition at line 133 of file RootUtil/ValueErr.h.

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

00134 {
00135   T value = ( lhs.GetValue()  + rhs.GetValue());
00136   T err2  = ( lhs.GetError2() + rhs.GetError2() );
00137   return ValueErr<T>::valueErr2(value,err2);
00138 }

template<class T>
ValueErr<T> operator+ const ValueErr< T > &  lhs,
const T &  rhs
[inline]
 

Definition at line 129 of file RootUtil/ValueErr.h.

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

00130 { return ValueErr<T>::valueErr2(lhs.GetValue() + rhs, lhs.GetError2()); }

template<class T>
ValueErr<T> operator+ const T &  lhs,
const ValueErr< T > &  rhs
[inline]
 

Definition at line 125 of file RootUtil/ValueErr.h.

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

00126 { return ValueErr<T>::valueErr2(lhs + rhs.GetValue(), rhs.GetError2()); }

template<class T>
ValueErr<T> operator- const ValueErr< T > &  lhs,
const ValueErr< T > &  rhs
[inline]
 

Definition at line 150 of file RootUtil/ValueErr.h.

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

00151 {
00152   T value = ( lhs.GetValue() - rhs.GetValue() );
00153   T err2  = ( lhs.GetError2() + rhs.GetError2());
00154   return ValueErr<T>::valueErr2(value,err2);
00155 }

template<class T>
ValueErr<T> operator- const ValueErr< T > &  lhs,
const T &  rhs
[inline]
 

Definition at line 146 of file RootUtil/ValueErr.h.

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

00147 { return ValueErr<T>::valueErr2(lhs.GetValue() - rhs, lhs.GetError2()); }

template<class T>
ValueErr<T> operator- const T &  lhs,
const ValueErr< T > &  rhs
[inline]
 

Definition at line 142 of file RootUtil/ValueErr.h.

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

00143 { return ValueErr<T>::valueErr2(lhs - rhs.GetValue(), rhs.GetError2()); }

template<class T>
ValueErr<T> operator/ const ValueErr< T > &  lhs,
const ValueErr< T > &  rhs
[inline]
 

Definition at line 189 of file RootUtil/ValueErr.h.

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

00190 {
00191   // Note: doesn't trap rhs=0 (i.e. divide-by-zero)
00192   T x = lhs.GetValue();
00193   T y = rhs.GetValue();
00194   T f = x/y;
00195   T y2 = y*y;
00196   T x2 = x*x;
00197   // err = x/y * sqrt( dx2/x2 + dy2/y2)    // This works, but has a div-by-zero for x=0
00198   T err2 = ( lhs.GetError2()/y2  + rhs.GetError2()*x2/(y2*y2) ); // This is ok for y!=0
00199 
00200   return ValueErr<T>::valueErr2(f,err2);
00201 }

template<class T>
ValueErr<T> operator/ const ValueErr< T > &  lhs,
const T &  rhs
[inline]
 

Definition at line 185 of file RootUtil/ValueErr.h.

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

00186 { return ValueErr<T>::valueErr2(lhs.GetValue() / rhs, lhs.GetError2()/(rhs*rhs)); }

template<class T>
ValueErr<T> operator/ const T &  lhs,
const ValueErr< T > &  rhs
[inline]
 

Definition at line 181 of file RootUtil/ValueErr.h.

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

00182 { return ValueErr<T>::valueErr2(lhs / rhs.GetValue(), lhs * lhs * rhs.GetError2() / (rhs.GetValue2()*rhs.GetValue2() )); }

template<class T>
std::ostream& operator<< std::ostream &  outs,
const ValueErr< T > &  x
 

Definition at line 28 of file Calibrator/ValueErr.cxx.

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

00029 {
00030   outs << x.GetValue() << kPlusMinus << x.GetError();
00031   return outs;
00032 }

template<class T>
std::ifstream& operator>> std::ifstream &  ins,
ValueErr< T > &  x
 

Definition at line 17 of file Calibrator/ValueErr.cxx.

References ValueErr< T >::Set().

00018 {
00019   T value;
00020   T error;
00021   ins >> value >> error;
00022   x.Set(value,error);
00023   return ins;
00024 }


Variable Documentation

const float kValueErr_Big = 1e19
 

Definition at line 26 of file RootUtil/ValueErr.h.


Generated on Mon Feb 15 11:08:15 2010 for loon by  doxygen 1.3.9.1