YODA is hosted by Hepforge, IPPP Durham
YODA::Point1D Class Reference

A 1D data point to be contained in a Scatter1D. More...

#include <Point1D.h>

Public Types

typedef std::pair< double, double > ValuePair
 

Public Member Functions

Constructors
 Point1D ()
 
 Point1D (double x, double ex=0.0)
 Constructor from values with optional symmetric errors. More...
 
 Point1D (double x, double exminus, double explus)
 Constructor from values with explicit asymmetric errors. More...
 
 Point1D (double x, const std::pair< double, double > &ex)
 Constructor from values with asymmetric errors. More...
 
 Point1D (const Point1D &p)
 Copy constructor. More...
 
Point1Doperator= (const Point1D &p)
 Copy assignment. More...
 
Value accessors
double x () const
 Get x value. More...
 
void setX (double x)
 Set x value. More...
 
x error accessors
Todo:
Uniform "coords" accessor across all Scatters: returning fixed-size tuple?
const std::pair< double, double > & xErrs () const
 Get x-error values. More...
 
double xErrMinus () const
 Get negative x-error value. More...
 
double xErrPlus () const
 Get positive x-error value. More...
 
double xErrAvg () const
 Get average x-error value. More...
 
void setXErrMinus (double exminus)
 Set negative x error. More...
 
void setXErrPlus (double explus)
 Set positive x error. More...
 
void setXErr (double ex)
 Set symmetric x error. More...
 
void setXErr (double exminus, double explus)
 Set asymmetric x error. More...
 
void setXErr (std::pair< double, double > ex)
 Set asymmetric x error. More...
 
double xMin () const
 
double xMax () const
 
Combined x value and error setters
Todo:
Support multiple errors
void setX (double x, double ex)
 Set x value and symmetric error. More...
 
void setX (double x, double exminus, double explus)
 Set x value and asymmetric error. More...
 
void setX (double x, std::pair< double, double > ex)
 Set x value and asymmetric error. More...
 
void scaleX (double scalex)
 Scaling of x axis. More...
 

Detailed Description

A 1D data point to be contained in a Scatter1D.

Definition at line 17 of file Point1D.h.

Member Typedef Documentation

typedef std::pair<double,double> YODA::Point1D::ValuePair

Definition at line 20 of file Point1D.h.

Constructor & Destructor Documentation

YODA::Point1D::Point1D ( )
inline

Definition at line 27 of file Point1D.h.

27 { }
YODA::Point1D::Point1D ( double  x,
double  ex = 0.0 
)
inline

Constructor from values with optional symmetric errors.

Definition at line 31 of file Point1D.h.

32  : _x(x)
33  {
34  _ex = std::make_pair(ex, ex);
35  }
double x() const
Get x value.
Definition: Point1D.h:74
YODA::Point1D::Point1D ( double  x,
double  exminus,
double  explus 
)
inline

Constructor from values with explicit asymmetric errors.

Definition at line 39 of file Point1D.h.

40  : _x(x)
41  {
42  _ex = std::make_pair(exminus, explus);
43  }
double x() const
Get x value.
Definition: Point1D.h:74
YODA::Point1D::Point1D ( double  x,
const std::pair< double, double > &  ex 
)
inline

Constructor from values with asymmetric errors.

Definition at line 47 of file Point1D.h.

48  : _x(x), _ex(ex)
49  { }
double x() const
Get x value.
Definition: Point1D.h:74
YODA::Point1D::Point1D ( const Point1D p)
inline

Copy constructor.

Definition at line 53 of file Point1D.h.

54  : _x(p._x), _ex(p._ex)
55  { }

Member Function Documentation

Point1D& YODA::Point1D::operator= ( const Point1D p)
inline

Copy assignment.

Definition at line 59 of file Point1D.h.

59  {
60  _x = p._x;
61  _ex = p._ex;
62  return *this;
63  }
void YODA::Point1D::scaleX ( double  scalex)
inline

Scaling of x axis.

Definition at line 194 of file Point1D.h.

References setX(), setXErr(), x(), xErrMinus(), and xErrPlus().

Referenced by YODA::Scatter1D::scaleX().

194  {
195  setX(x()*scalex);
196  setXErr(xErrMinus()*scalex, xErrPlus()*scalex);
197  }
double xErrMinus() const
Get negative x-error value.
Definition: Point1D.h:93
double xErrPlus() const
Get positive x-error value.
Definition: Point1D.h:98
void setXErr(double ex)
Set symmetric x error.
Definition: Point1D.h:118
double x() const
Get x value.
Definition: Point1D.h:74
void setX(double x)
Set x value.
Definition: Point1D.h:77
void YODA::Point1D::setX ( double  x)
inline

Set x value.

Definition at line 77 of file Point1D.h.

References x().

Referenced by YODA::efficiency(), scaleX(), setX(), and YODA::transformX().

77 { _x = x; }
double x() const
Get x value.
Definition: Point1D.h:74
void YODA::Point1D::setX ( double  x,
double  ex 
)
inline

Set x value and symmetric error.

Definition at line 170 of file Point1D.h.

References setX(), and setXErr().

170  {
171  setX(x);
172  setXErr(ex);
173  }
void setXErr(double ex)
Set symmetric x error.
Definition: Point1D.h:118
double x() const
Get x value.
Definition: Point1D.h:74
void setX(double x)
Set x value.
Definition: Point1D.h:77
void YODA::Point1D::setX ( double  x,
double  exminus,
double  explus 
)
inline

Set x value and asymmetric error.

Definition at line 176 of file Point1D.h.

References setX(), and setXErr().

176  {
177  setX(x);
178  setXErr(exminus, explus);
179  }
void setXErr(double ex)
Set symmetric x error.
Definition: Point1D.h:118
double x() const
Get x value.
Definition: Point1D.h:74
void setX(double x)
Set x value.
Definition: Point1D.h:77
void YODA::Point1D::setX ( double  x,
std::pair< double, double >  ex 
)
inline

Set x value and asymmetric error.

Definition at line 182 of file Point1D.h.

References setX(), and setXErr().

182  {
183  setX(x);
184  setXErr(ex);
185  }
void setXErr(double ex)
Set symmetric x error.
Definition: Point1D.h:118
double x() const
Get x value.
Definition: Point1D.h:74
void setX(double x)
Set x value.
Definition: Point1D.h:77
void YODA::Point1D::setXErr ( double  ex)
inline

Set symmetric x error.

Definition at line 118 of file Point1D.h.

References setXErrMinus(), and setXErrPlus().

Referenced by scaleX(), and setX().

118  {
119  setXErrMinus(ex);
120  setXErrPlus(ex);
121  }
void setXErrPlus(double explus)
Set positive x error.
Definition: Point1D.h:113
void setXErrMinus(double exminus)
Set negative x error.
Definition: Point1D.h:108
void YODA::Point1D::setXErr ( double  exminus,
double  explus 
)
inline

Set asymmetric x error.

Definition at line 124 of file Point1D.h.

References setXErrMinus(), and setXErrPlus().

124  {
125  setXErrMinus(exminus);
126  setXErrPlus(explus);
127  }
void setXErrPlus(double explus)
Set positive x error.
Definition: Point1D.h:113
void setXErrMinus(double exminus)
Set negative x error.
Definition: Point1D.h:108
void YODA::Point1D::setXErr ( std::pair< double, double >  ex)
inline

Set asymmetric x error.

Definition at line 130 of file Point1D.h.

130  {
131  _ex = ex;
132  }
void YODA::Point1D::setXErrMinus ( double  exminus)
inline

Set negative x error.

Definition at line 108 of file Point1D.h.

Referenced by setXErr(), and YODA::transformX().

108  {
109  _ex.first = exminus;
110  }
void YODA::Point1D::setXErrPlus ( double  explus)
inline

Set positive x error.

Definition at line 113 of file Point1D.h.

Referenced by setXErr(), and YODA::transformX().

113  {
114  _ex.second = explus;
115  }
double YODA::Point1D::x ( ) const
inline
double YODA::Point1D::xErrAvg ( ) const
inline

Get average x-error value.

Definition at line 103 of file Point1D.h.

103  {
104  return (_ex.first + _ex.second)/2.0;
105  }
double YODA::Point1D::xErrMinus ( ) const
inline

Get negative x-error value.

Definition at line 93 of file Point1D.h.

Referenced by YODA::operator<(), YODA::operator==(), scaleX(), YODA::WriterYODA::writeScatter1D(), and YODA::WriterFLAT::writeScatter1D().

93  {
94  return _ex.first;
95  }
double YODA::Point1D::xErrPlus ( ) const
inline

Get positive x-error value.

Definition at line 98 of file Point1D.h.

Referenced by YODA::operator<(), YODA::operator==(), scaleX(), and YODA::WriterFLAT::writeScatter1D().

98  {
99  return _ex.second;
100  }
const std::pair<double,double>& YODA::Point1D::xErrs ( ) const
inline

Get x-error values.

Definition at line 88 of file Point1D.h.

88  {
89  return _ex;
90  }
double YODA::Point1D::xMax ( ) const
inline

Get value plus positive x-error

Todo:
Remove (or extend) when multiple errors are supported

Definition at line 142 of file Point1D.h.

Referenced by YODA::transformX().

142  {
143  return _x + _ex.second;
144  }
double YODA::Point1D::xMin ( ) const
inline

Get value minus negative x-error

Todo:
Remove (or extend) when multiple errors are supported

Definition at line 136 of file Point1D.h.

Referenced by YODA::transformX().

136  {
137  return _x - _ex.first;
138  }

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