YODA is hosted by Hepforge, IPPP Durham
YODA::Error< N > Class Template Reference

An N-dimensional error to be contained in a Point<N> More...

#include <ErrorND.h>

Public Types

typedef Utils::ndarray< double, N > NdVal
 
typedef Utils::ndarray
< std::pair< double, double >
, N > 
NdValPair
 

Public Member Functions

Constructors
 Error (const std::string &name="")
 
 Error (const NdValPair &err, const std::string &name="")
 Constructor from ND array of error pairs. More...
 
 Error (const NdVal &errsymm, const std::string &name="")
 Constructor of a symmetric error from one ND array of values. More...
 
 Error (const NdVal &errminus, const NdVal &errplus, const std::string &name="")
 Constructor of an asymmetric error from two ND arrays of values. More...
 
Modifiers and accessors
const std::string & name () const
 Clear the point values and errors. More...
 
void setName (const std::string &name)
 Clear the point values and errors. More...
 
void clear ()
 Clear the point values and errors. More...
 
std::pair< double, double > & err (size_t dim)
 Access the error pair in dimension dim. More...
 
const std::pair< double, double > & err (size_t dim) const
 Get the error pair in dimension dim (const version) More...
 
std::pair< double, double > & operator[] (size_t dim)
 Access the error pair in dimension dim. More...
 
const std::pair< double, double > & operator[] (size_t dim) const
 Get the error pair in dimension dim (const version) More...
 
double errMinus (size_t dim) const
 Get the minus error in dimension dim. More...
 
double errPlus (size_t dim) const
 Get the plus error in dimension dim. More...
 
double errAvg (size_t dim) const
 Get the mean error in dimension dim. More...
 
Scaling and transformations
void scale (const NdVal &scales)
 Uniform scaling. More...
 

Detailed Description

template<int N>
class YODA::Error< N >

An N-dimensional error to be contained in a Point<N>

Definition at line 21 of file ErrorND.h.

Member Typedef Documentation

template<int N>
typedef Utils::ndarray<double, N> YODA::Error< N >::NdVal

Definition at line 24 of file ErrorND.h.

template<int N>
typedef Utils::ndarray<std::pair<double,double>, N> YODA::Error< N >::NdValPair

Definition at line 25 of file ErrorND.h.

Constructor & Destructor Documentation

template<int N>
YODA::Error< N >::Error ( const std::string &  name = "")
inline

Definition at line 32 of file ErrorND.h.

References YODA::Error< N >::clear().

33  : _name(name)
34  {
35  clear();
36  }
const std::string & name() const
Clear the point values and errors.
Definition: ErrorND.h:71
void clear()
Clear the point values and errors.
Definition: ErrorND.h:81
template<int N>
YODA::Error< N >::Error ( const NdValPair err,
const std::string &  name = "" 
)
inline

Constructor from ND array of error pairs.

Definition at line 40 of file ErrorND.h.

41  : _name(name), _val(err)
42  { }
const std::string & name() const
Clear the point values and errors.
Definition: ErrorND.h:71
std::pair< double, double > & err(size_t dim)
Access the error pair in dimension dim.
Definition: ErrorND.h:96
template<int N>
YODA::Error< N >::Error ( const NdVal errsymm,
const std::string &  name = "" 
)
inline

Constructor of a symmetric error from one ND array of values.

Definition at line 46 of file ErrorND.h.

47  : _name(name)
48  {
49  for (size_t i = 0; i < N; ++i) {
50  _val[i] = std::make_pair(errsymm[i], errsymm[i]);
51  }
52  }
const std::string & name() const
Clear the point values and errors.
Definition: ErrorND.h:71
template<int N>
YODA::Error< N >::Error ( const NdVal errminus,
const NdVal errplus,
const std::string &  name = "" 
)
inline

Constructor of an asymmetric error from two ND arrays of values.

Definition at line 56 of file ErrorND.h.

57  : _name(name)
58  {
59  for (size_t i = 0; i < N; ++i) {
60  _val[i] = std::make_pair(errminus[i], errplus[i]);
61  }
62  }
const std::string & name() const
Clear the point values and errors.
Definition: ErrorND.h:71

Member Function Documentation

template<int N>
void YODA::Error< N >::clear ( )
inline

Clear the point values and errors.

Definition at line 81 of file ErrorND.h.

Referenced by YODA::Error< N >::Error().

81  {
82  _val.clear();
83  }
template<int N>
std::pair<double,double>& YODA::Error< N >::err ( size_t  dim)
inline

Access the error pair in dimension dim.

Definition at line 96 of file ErrorND.h.

96  {
97  return _val[dim];
98  }
template<int N>
const std::pair<double,double>& YODA::Error< N >::err ( size_t  dim) const
inline

Get the error pair in dimension dim (const version)

Definition at line 101 of file ErrorND.h.

101  {
102  return _val[dim];
103  }
template<int N>
double YODA::Error< N >::errAvg ( size_t  dim) const
inline

Get the mean error in dimension dim.

Definition at line 126 of file ErrorND.h.

126  {
127  return (_val[dim].first + _val[dim].second)/2.0;
128  }
template<int N>
double YODA::Error< N >::errMinus ( size_t  dim) const
inline

Get the minus error in dimension dim.

Definition at line 116 of file ErrorND.h.

Referenced by YODA::operator==().

116  {
117  return _val[dim].first;
118  }
template<int N>
double YODA::Error< N >::errPlus ( size_t  dim) const
inline

Get the plus error in dimension dim.

Definition at line 121 of file ErrorND.h.

Referenced by YODA::operator==().

121  {
122  return _val[dim].second;
123  }
template<int N>
const std::string& YODA::Error< N >::name ( ) const
inline

Clear the point values and errors.

Definition at line 71 of file ErrorND.h.

Referenced by YODA::operator==(), and YODA::Error< N >::setName().

71  {
72  return _name;
73  }
template<int N>
std::pair<double,double>& YODA::Error< N >::operator[] ( size_t  dim)
inline

Access the error pair in dimension dim.

Definition at line 106 of file ErrorND.h.

106  {
107  return _val[dim];
108  }
template<int N>
const std::pair<double,double>& YODA::Error< N >::operator[] ( size_t  dim) const
inline

Get the error pair in dimension dim (const version)

Definition at line 111 of file ErrorND.h.

111  {
112  return _val[dim];
113  }
template<int N>
void YODA::Error< N >::scale ( const NdVal scales)
inline

Uniform scaling.

Definition at line 138 of file ErrorND.h.

Referenced by YODA::Point< N >::scale().

138  {
139  for (size_t i = 0; i < N; ++i) {
140  _val[i].first *= scales[i];
141  _val[i].second *= scales[i];
142  }
143  }
template<int N>
void YODA::Error< N >::setName ( const std::string &  name)
inline

Clear the point values and errors.

Definition at line 76 of file ErrorND.h.

References YODA::Error< N >::name().

76  {
77  _name = name;
78  }
const std::string & name() const
Clear the point values and errors.
Definition: ErrorND.h:71

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