yoda is hosted by Hepforge, IPPP Durham
YODA - Yet more Objects for Data Analysis  1.7.2
YODA::Point< N > Class Template Referenceabstract

Base class for all Point*Ds, providing generic access to their numerical properties. More...

#include <Point.h>

Inheritance diagram for YODA::Point< N >:
YODA::Point1D YODA::Point2D YODA::Point3D

Public Types

typedef std::pair< double, double > ValuePair
 
typedef Utils::ndarray< double, N > NdVal
 
typedef Utils::ndarray< std::pair< double, double >, N > NdValPair
 
typedef Utils::sortedvector< Error< N > > Errors
 

Public Member Functions

virtual ~Point ()
 Virtual destructor for inheritance. More...
 
virtual size_t dim ()=0
 Space dimension of the point. More...
 
virtual const std::map< std::string, std::pair< double, double > > & errMap () const =0
 
virtual double val (size_t i) const =0
 Get the point value for direction i. More...
 
virtual void setVal (size_t i, double val)=0
 Set the point value for direction i. More...
 
virtual const std::pair< double, double > & errs (size_t i, std::string source="") const =0
 Get error values for direction i. More...
 
virtual void setErr (size_t i, double e, std::string source="")=0
 Set symmetric error for direction i. More...
 
virtual void setErrs (size_t i, double e, std::string source="")
 Set symmetric error for direction i (alias) More...
 
virtual void setErrs (size_t i, double eminus, double eplus, std::string source="")=0
 Set asymmetric error for direction i. More...
 
virtual void setErrs (size_t i, std::pair< double, double > &e, std::string source="")=0
 Set asymmetric error for direction i. More...
 
virtual double errMinus (size_t i, std::string source="") const =0
 Get negative error value for direction i. More...
 
virtual void setErrMinus (size_t i, double eminus, std::string source="")=0
 Set negative error for direction i. More...
 
virtual double errPlus (size_t i, std::string source="") const =0
 Get positive error value for direction i. More...
 
virtual void setErrPlus (size_t i, double eplus, std::string source="")=0
 Set positive error for direction i. More...
 
virtual double errAvg (size_t i, std::string source="") const =0
 Get average error value for direction i. More...
 
Combined value and error setters
Todo:
Support multiple errors
virtual void set (size_t i, double val, double e, std::string source="")=0
 Set value and symmetric error for direction i. More...
 
virtual void set (size_t i, double val, double eminus, double eplus, std::string source="")=0
 Set value and asymmetric error for direction i. More...
 
virtual void set (size_t i, double val, std::pair< double, double > &e, std::string source="")=0
 Set value and asymmetric error for direction i. More...
 
Constructors
 Point ()
 
 Point (const NdVal &pos)
 Constructor from position values without errors. More...
 
 Point (const NdVal &pos, const NdValPair &errs)
 Constructor from values with a single set of asymmetric errors. More...
 
 Point (const NdVal &pos, const Error< N > &err)
 Constructor from values and a single Error object. More...
 
 Point (const std::vector< double > &pos, const std::vector< Error< N > > &errs)
 Constructor from values and a collection of Error objects. More...
 
Modifiers
void clear ()
 Clear the point values and errors. More...
 
Coordinate accessors
Todo:
addError, addErrors, setErrors
NdValpos ()
 Get the coordinate vector. More...
 
const NdValpos () const
 Get the coordinate vector (const version) More...
 
void setPos (const NdVal &pos)
 Set the coordinate vector. More...
 
Error accessors
Errorserrs ()
 Get error values. More...
 
const Errorserrs () const
 Get error values (const version) More...
 
void setErrs (const Errors &errs)
 Set the error values. More...
 
Scaling and transformations
void scale (const NdVal &scales)
 Uniform scaling. More...
 

Detailed Description

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

Base class for all Point*Ds, providing generic access to their numerical properties.

An N-dimensional data point to be contained in a Scatter<N>

Definition at line 15 of file Point.h.

Member Typedef Documentation

◆ Errors

template<int N>
typedef Utils::sortedvector< Error<N> > YODA::Point< N >::Errors

Definition at line 28 of file PointND.h.

◆ NdVal

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

Definition at line 26 of file PointND.h.

◆ NdValPair

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

Definition at line 27 of file PointND.h.

◆ ValuePair

template<int N>
typedef std::pair<double,double> YODA::Point< N >::ValuePair

Definition at line 18 of file Point.h.

Constructor & Destructor Documentation

◆ ~Point()

template<int N>
virtual YODA::Point< N >::~Point ( )
inlinevirtual

◆ Point() [1/5]

template<int N>
YODA::Point< N >::Point ( )
inline

Definition at line 35 of file PointND.h.

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

35  {
36  clear();
37  }
void clear()
Clear the point values and errors.
Definition: PointND.h:83

◆ Point() [2/5]

template<int N>
YODA::Point< N >::Point ( const NdVal pos)
inline

Constructor from position values without errors.

Definition at line 41 of file PointND.h.

42  : _pos(pos)
43  { }
NdVal & pos()
Get the coordinate vector.
Definition: PointND.h:99

◆ Point() [3/5]

template<int N>
YODA::Point< N >::Point ( const NdVal pos,
const NdValPair errs 
)
inline

Constructor from values with a single set of asymmetric errors.

Definition at line 56 of file PointND.h.

57  : _pos(pos)
58  {
59  _errs.insert(Error<N>(errs));
60  }
Errors & errs()
Get error values.
Definition: PointND.h:116
NdVal & pos()
Get the coordinate vector.
Definition: PointND.h:99

◆ Point() [4/5]

template<int N>
YODA::Point< N >::Point ( const NdVal pos,
const Error< N > &  err 
)
inline

Constructor from values and a single Error object.

Definition at line 64 of file PointND.h.

65  : _pos(pos)
66  {
67  _errs.insert(err);
68  }
NdVal & pos()
Get the coordinate vector.
Definition: PointND.h:99

◆ Point() [5/5]

template<int N>
YODA::Point< N >::Point ( const std::vector< double > &  pos,
const std::vector< Error< N > > &  errs 
)
inline

Constructor from values and a collection of Error objects.

Definition at line 72 of file PointND.h.

73  : _pos(pos), _errs(errs)
74  { }

Member Function Documentation

◆ clear()

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

Clear the point values and errors.

Definition at line 83 of file PointND.h.

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

83  {
84  for (size_t i = 0; i < N; ++i) _pos[i] = 0;
85  _errs.clear();
86  }

◆ dim()

template<int N>
virtual size_t YODA::Point< N >::dim ( )
pure virtual

Space dimension of the point.

Implemented in YODA::Point2D, YODA::Point3D, and YODA::Point1D.

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

◆ errAvg()

template<int N>
virtual double YODA::Point< N >::errAvg ( size_t  i,
std::string  source = "" 
) const
pure virtual

Get average error value for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

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

◆ errMap()

template<int N>
virtual const std::map< std::string, std::pair<double,double> >& YODA::Point< N >::errMap ( ) const
pure virtual

◆ errMinus()

template<int N>
virtual double YODA::Point< N >::errMinus ( size_t  i,
std::string  source = "" 
) const
pure virtual

Get negative error value for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

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

◆ errPlus()

template<int N>
virtual double YODA::Point< N >::errPlus ( size_t  i,
std::string  source = "" 
) const
pure virtual

Get positive error value for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

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

◆ errs() [1/3]

template<int N>
virtual const std::pair<double,double>& YODA::Point< N >::errs ( size_t  i,
std::string  source = "" 
) const
pure virtual

Get error values for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

◆ errs() [2/3]

template<int N>
Errors& YODA::Point< N >::errs ( )
inline

Get error values.

Definition at line 116 of file PointND.h.

Referenced by YODA::Point< N >::scale(), YODA::Point< N >::setErrs(), and YODA::Point< N >::~Point().

116  {
117  return _errs;
118  }

◆ errs() [3/3]

template<int N>
const Errors& YODA::Point< N >::errs ( ) const
inline

Get error values (const version)

Definition at line 121 of file PointND.h.

121  {
122  return _errs;
123  }

◆ pos() [1/2]

template<int N>
NdVal& YODA::Point< N >::pos ( )
inline

Get the coordinate vector.

Definition at line 99 of file PointND.h.

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

99 { return _pos; }

◆ pos() [2/2]

template<int N>
const NdVal& YODA::Point< N >::pos ( ) const
inline

Get the coordinate vector (const version)

Definition at line 102 of file PointND.h.

102 { return _pos; }

◆ scale()

template<int N>
void YODA::Point< N >::scale ( const NdVal scales)
inline

Uniform scaling.

Definition at line 137 of file PointND.h.

References YODA::Point< N >::errs().

137  {
138  for (size_t i = 0; i < N; ++i) _pos[i] *= scales[i];
139  for (Error<N>& e : errs()) e.scale(scales);
140  }
Errors & errs()
Get error values.
Definition: PointND.h:116

◆ set() [1/3]

template<int N>
virtual void YODA::Point< N >::set ( size_t  i,
double  val,
double  e,
std::string  source = "" 
)
pure virtual

Set value and symmetric error for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

◆ set() [2/3]

template<int N>
virtual void YODA::Point< N >::set ( size_t  i,
double  val,
double  eminus,
double  eplus,
std::string  source = "" 
)
pure virtual

Set value and asymmetric error for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

◆ set() [3/3]

template<int N>
virtual void YODA::Point< N >::set ( size_t  i,
double  val,
std::pair< double, double > &  e,
std::string  source = "" 
)
pure virtual

Set value and asymmetric error for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

◆ setErr()

template<int N>
virtual void YODA::Point< N >::setErr ( size_t  i,
double  e,
std::string  source = "" 
)
pure virtual

Set symmetric error for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

Referenced by YODA::Point< N >::setErrs(), and YODA::Point< N >::~Point().

◆ setErrMinus()

template<int N>
virtual void YODA::Point< N >::setErrMinus ( size_t  i,
double  eminus,
std::string  source = "" 
)
pure virtual

Set negative error for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

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

◆ setErrPlus()

template<int N>
virtual void YODA::Point< N >::setErrPlus ( size_t  i,
double  eplus,
std::string  source = "" 
)
pure virtual

Set positive error for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

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

◆ setErrs() [1/4]

template<int N>
virtual void YODA::Point< N >::setErrs ( size_t  i,
double  e,
std::string  source = "" 
)
inlinevirtual

Set symmetric error for direction i (alias)

Definition at line 41 of file Point.h.

References YODA::Point< N >::errAvg(), YODA::Point< N >::errMinus(), YODA::Point< N >::errPlus(), YODA::Point< N >::setErr(), YODA::Point< N >::setErrMinus(), YODA::Point< N >::setErrPlus(), and YODA::Point< N >::val().

41 { return setErr(i,e, source); }
virtual void setErr(size_t i, double e, std::string source="")=0
Set symmetric error for direction i.

◆ setErrs() [2/4]

template<int N>
virtual void YODA::Point< N >::setErrs ( size_t  i,
double  eminus,
double  eplus,
std::string  source = "" 
)
pure virtual

Set asymmetric error for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

◆ setErrs() [3/4]

template<int N>
virtual void YODA::Point< N >::setErrs ( size_t  i,
std::pair< double, double > &  e,
std::string  source = "" 
)
pure virtual

Set asymmetric error for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

◆ setErrs() [4/4]

template<int N>
void YODA::Point< N >::setErrs ( const Errors errs)
inline

Set the error values.

Definition at line 126 of file PointND.h.

References YODA::Point< N >::errs().

126  {
127  _errs = errs;
128  }
Errors & errs()
Get error values.
Definition: PointND.h:116

◆ setPos()

template<int N>
void YODA::Point< N >::setPos ( const NdVal pos)
inline

Set the coordinate vector.

Definition at line 105 of file PointND.h.

References YODA::Point< N >::pos().

105  {
106  _pos = pos;
107  }
NdVal & pos()
Get the coordinate vector.
Definition: PointND.h:99

◆ setVal()

template<int N>
virtual void YODA::Point< N >::setVal ( size_t  i,
double  val 
)
pure virtual

Set the point value for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

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

◆ val()

template<int N>
virtual double YODA::Point< N >::val ( size_t  i) const
pure virtual

Get the point value for direction i.

Implemented in YODA::Point3D, YODA::Point2D, and YODA::Point1D.

Referenced by YODA::Point< N >::setErrs(), and YODA::Point< N >::~Point().


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