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

A 2D data point to be contained in a Scatter2D. More...

#include <Point2D.h>

Public Types

typedef std::pair< double, double > ValuePair
 

Public Member Functions

Constructors
 Point2D ()
 
 Point2D (double x, double y, double ex=0.0, double ey=0.0)
 Constructor from values with optional symmetric errors. More...
 
 Point2D (double x, double y, double exminus, double explus, double eyminus, double eyplus)
 Constructor from values with explicit asymmetric errors. More...
 
 Point2D (double x, double y, const std::pair< double, double > &ex, const std::pair< double, double > &ey)
 Constructor from values with asymmetric errors on both x and y. More...
 
 Point2D (const Point2D &p)
 Copy constructor. More...
 
Point2Doperator= (const Point2D &p)
 Copy assignment. More...
 
Value accessors
double x () const
 Get x value. More...
 
void setX (double x)
 Set x value. More...
 
double y () const
 Get y value. More...
 
void setY (double y)
 Set y value. More...
 
std::pair< double, double > xy () const
 Get x,y value pair. More...
 
void setXY (double x, double y)
 Set x and y values. More...
 
void setXY (std::pair< double, double > xy)
 Set x and y values. More...
 
x error accessors
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
 
y error accessors
const std::pair< double, double > & yErrs () const
 Get y-error values. More...
 
double yErrMinus () const
 Get negative y-error value. More...
 
double yErrPlus () const
 Get positive y-error value. More...
 
double yErrAvg () const
 Get average y-error value. More...
 
void setYErrMinus (double eyminus)
 Set negative y error. More...
 
void setYErrPlus (double eyplus)
 Set positive y error. More...
 
void setYErr (double ey)
 Set symmetric y error. More...
 
void setYErr (double eyminus, double eyplus)
 Set asymmetric y error. More...
 
void setYErr (std::pair< double, double > ey)
 Set asymmetric y error. More...
 
double yMin () const
 
double yMax () const
 
Combined x/y 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 setY (double y, double ey)
 Set y value and symmetric error. More...
 
void setY (double y, double eyminus, double eyplus)
 Set y value and asymmetric error. More...
 
void setY (double y, std::pair< double, double > ey)
 Set y value and asymmetric error. More...
 
void scaleX (double scalex)
 Scaling of x axis. More...
 
void scaleY (double scaley)
 Scaling of y axis. More...
 
void scaleXY (double scalex, double scaley)
 Scaling of both axes. More...
 
void scale (double scalex, double scaley)
 

Detailed Description

A 2D data point to be contained in a Scatter2D.

Definition at line 17 of file Point2D.h.

Member Typedef Documentation

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

Definition at line 20 of file Point2D.h.

Constructor & Destructor Documentation

YODA::Point2D::Point2D ( )
inline

Definition at line 27 of file Point2D.h.

27 { }
YODA::Point2D::Point2D ( double  x,
double  y,
double  ex = 0.0,
double  ey = 0.0 
)
inline

Constructor from values with optional symmetric errors.

Definition at line 31 of file Point2D.h.

32  : _x(x), _y(y)
33  {
34  _ex = std::make_pair(ex, ex);
35  _ey = std::make_pair(ey, ey);
36  }
double x() const
Get x value.
Definition: Point2D.h:99
double y() const
Get y value.
Definition: Point2D.h:105
YODA::Point2D::Point2D ( double  x,
double  y,
double  exminus,
double  explus,
double  eyminus,
double  eyplus 
)
inline

Constructor from values with explicit asymmetric errors.

Definition at line 40 of file Point2D.h.

45  : _x(x), _y(y)
46  {
47  _ex = std::make_pair(exminus, explus);
48  _ey = std::make_pair(eyminus, eyplus);
49  }
double x() const
Get x value.
Definition: Point2D.h:99
double y() const
Get y value.
Definition: Point2D.h:105
YODA::Point2D::Point2D ( double  x,
double  y,
const std::pair< double, double > &  ex,
const std::pair< double, double > &  ey 
)
inline

Constructor from values with asymmetric errors on both x and y.

Definition at line 69 of file Point2D.h.

70  : _x(x), _y(y), _ex(ex), _ey(ey)
71  { }
double x() const
Get x value.
Definition: Point2D.h:99
double y() const
Get y value.
Definition: Point2D.h:105
YODA::Point2D::Point2D ( const Point2D p)
inline

Copy constructor.

Definition at line 75 of file Point2D.h.

76  : _x(p._x), _y(p._y),
77  _ex(p._ex), _ey(p._ey)
78  { }

Member Function Documentation

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

Copy assignment.

Definition at line 82 of file Point2D.h.

82  {
83  _x = p._x;
84  _y = p._y;
85  _ex = p._ex;
86  _ey = p._ey;
87  return *this;
88  }
void YODA::Point2D::scale ( double  scalex,
double  scaley 
)
inline

Scaling of both axes

Deprecated:
Use scaleXY

Definition at line 351 of file Point2D.h.

References scaleXY().

351  {
352  scaleXY(scalex, scaley);
353  }
void scaleXY(double scalex, double scaley)
Scaling of both axes.
Definition: Point2D.h:344
void YODA::Point2D::scaleX ( double  scalex)
inline

Scaling of x axis.

Definition at line 332 of file Point2D.h.

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

Referenced by YODA::Scatter2D::scaleX(), and scaleXY().

332  {
333  setX(x()*scalex);
334  setXErr(xErrMinus()*scalex, xErrPlus()*scalex);
335  }
void setXErr(double ex)
Set symmetric x error.
Definition: Point2D.h:158
double xErrPlus() const
Get positive x-error value.
Definition: Point2D.h:138
double x() const
Get x value.
Definition: Point2D.h:99
void setX(double x)
Set x value.
Definition: Point2D.h:102
double xErrMinus() const
Get negative x-error value.
Definition: Point2D.h:133
void YODA::Point2D::scaleXY ( double  scalex,
double  scaley 
)
inline

Scaling of both axes.

Definition at line 344 of file Point2D.h.

References scaleX(), and scaleY().

Referenced by scale(), and YODA::Scatter2D::scaleXY().

344  {
345  scaleX(scalex);
346  scaleY(scaley);
347  }
void scaleX(double scalex)
Scaling of x axis.
Definition: Point2D.h:332
void scaleY(double scaley)
Scaling of y axis.
Definition: Point2D.h:338
void YODA::Point2D::scaleY ( double  scaley)
inline

Scaling of y axis.

Definition at line 338 of file Point2D.h.

References setY(), setYErr(), y(), yErrMinus(), and yErrPlus().

Referenced by scaleXY(), and YODA::Scatter2D::scaleY().

338  {
339  setY(y()*scaley);
340  setYErr(yErrMinus()*scaley, yErrPlus()*scaley);
341  }
void setY(double y)
Set y value.
Definition: Point2D.h:108
void setYErr(double ey)
Set symmetric y error.
Definition: Point2D.h:237
double yErrMinus() const
Get negative y-error value.
Definition: Point2D.h:212
double y() const
Get y value.
Definition: Point2D.h:105
double yErrPlus() const
Get positive y-error value.
Definition: Point2D.h:217
void YODA::Point2D::setX ( double  x)
inline

Set x value.

Definition at line 102 of file Point2D.h.

References x().

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

102 { _x = x; }
double x() const
Get x value.
Definition: Point2D.h:99
void YODA::Point2D::setX ( double  x,
double  ex 
)
inline

Set x value and symmetric error.

Definition at line 289 of file Point2D.h.

References setX(), and setXErr().

289  {
290  setX(x);
291  setXErr(ex);
292  }
void setXErr(double ex)
Set symmetric x error.
Definition: Point2D.h:158
double x() const
Get x value.
Definition: Point2D.h:99
void setX(double x)
Set x value.
Definition: Point2D.h:102
void YODA::Point2D::setX ( double  x,
double  exminus,
double  explus 
)
inline

Set x value and asymmetric error.

Definition at line 295 of file Point2D.h.

References setX(), and setXErr().

295  {
296  setX(x);
297  setXErr(exminus, explus);
298  }
void setXErr(double ex)
Set symmetric x error.
Definition: Point2D.h:158
double x() const
Get x value.
Definition: Point2D.h:99
void setX(double x)
Set x value.
Definition: Point2D.h:102
void YODA::Point2D::setX ( double  x,
std::pair< double, double >  ex 
)
inline

Set x value and asymmetric error.

Definition at line 301 of file Point2D.h.

References setX(), and setXErr().

301  {
302  setX(x);
303  setXErr(ex);
304  }
void setXErr(double ex)
Set symmetric x error.
Definition: Point2D.h:158
double x() const
Get x value.
Definition: Point2D.h:99
void setX(double x)
Set x value.
Definition: Point2D.h:102
void YODA::Point2D::setXErr ( double  ex)
inline

Set symmetric x error.

Definition at line 158 of file Point2D.h.

References setXErrMinus(), and setXErrPlus().

Referenced by scaleX(), and setX().

158  {
159  setXErrMinus(ex);
160  setXErrPlus(ex);
161  }
void setXErrPlus(double explus)
Set positive x error.
Definition: Point2D.h:153
void setXErrMinus(double exminus)
Set negative x error.
Definition: Point2D.h:148
void YODA::Point2D::setXErr ( double  exminus,
double  explus 
)
inline

Set asymmetric x error.

Definition at line 164 of file Point2D.h.

References setXErrMinus(), and setXErrPlus().

164  {
165  setXErrMinus(exminus);
166  setXErrPlus(explus);
167  }
void setXErrPlus(double explus)
Set positive x error.
Definition: Point2D.h:153
void setXErrMinus(double exminus)
Set negative x error.
Definition: Point2D.h:148
void YODA::Point2D::setXErr ( std::pair< double, double >  ex)
inline

Set asymmetric x error.

Definition at line 170 of file Point2D.h.

170  {
171  _ex = ex;
172  }
void YODA::Point2D::setXErrMinus ( double  exminus)
inline

Set negative x error.

Definition at line 148 of file Point2D.h.

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

148  {
149  _ex.first = exminus;
150  }
void YODA::Point2D::setXErrPlus ( double  explus)
inline

Set positive x error.

Definition at line 153 of file Point2D.h.

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

153  {
154  _ex.second = explus;
155  }
void YODA::Point2D::setXY ( double  x,
double  y 
)
inline

Set x and y values.

Definition at line 116 of file Point2D.h.

References setX(), and setY().

116 { setX(x); setY(y); }
void setY(double y)
Set y value.
Definition: Point2D.h:108
double x() const
Get x value.
Definition: Point2D.h:99
double y() const
Get y value.
Definition: Point2D.h:105
void setX(double x)
Set x value.
Definition: Point2D.h:102
void YODA::Point2D::setXY ( std::pair< double, double >  xy)
inline

Set x and y values.

Definition at line 119 of file Point2D.h.

References setX(), and setY().

119 { setX(xy.first); setY(xy.second); }
void setY(double y)
Set y value.
Definition: Point2D.h:108
std::pair< double, double > xy() const
Get x,y value pair.
Definition: Point2D.h:113
void setX(double x)
Set x value.
Definition: Point2D.h:102
void YODA::Point2D::setY ( double  y)
inline

Set y value.

Definition at line 108 of file Point2D.h.

References y().

Referenced by YODA::efficiency(), YODA::flip(), scaleY(), setXY(), setY(), YODA::toIntegralEfficiencyHisto(), YODA::toIntegralHisto(), and YODA::transformY().

108 { _y = y; }
double y() const
Get y value.
Definition: Point2D.h:105
void YODA::Point2D::setY ( double  y,
double  ey 
)
inline

Set y value and symmetric error.

Definition at line 308 of file Point2D.h.

References setY(), and setYErr().

308  {
309  setY(y);
310  setYErr(ey);
311  }
void setY(double y)
Set y value.
Definition: Point2D.h:108
void setYErr(double ey)
Set symmetric y error.
Definition: Point2D.h:237
double y() const
Get y value.
Definition: Point2D.h:105
void YODA::Point2D::setY ( double  y,
double  eyminus,
double  eyplus 
)
inline

Set y value and asymmetric error.

Definition at line 314 of file Point2D.h.

References setY(), and setYErr().

314  {
315  setY(y);
316  setYErr(eyminus, eyplus);
317  }
void setY(double y)
Set y value.
Definition: Point2D.h:108
void setYErr(double ey)
Set symmetric y error.
Definition: Point2D.h:237
double y() const
Get y value.
Definition: Point2D.h:105
void YODA::Point2D::setY ( double  y,
std::pair< double, double >  ey 
)
inline

Set y value and asymmetric error.

Definition at line 320 of file Point2D.h.

References setY(), and setYErr().

320  {
321  setY(y);
322  setYErr(ey);
323  }
void setY(double y)
Set y value.
Definition: Point2D.h:108
void setYErr(double ey)
Set symmetric y error.
Definition: Point2D.h:237
double y() const
Get y value.
Definition: Point2D.h:105
void YODA::Point2D::setYErr ( double  ey)
inline

Set symmetric y error.

Definition at line 237 of file Point2D.h.

References setYErrMinus(), and setYErrPlus().

Referenced by scaleY(), and setY().

237  {
238  setYErrMinus(ey);
239  setYErrPlus(ey);
240  }
void setYErrPlus(double eyplus)
Set positive y error.
Definition: Point2D.h:232
void setYErrMinus(double eyminus)
Set negative y error.
Definition: Point2D.h:227
void YODA::Point2D::setYErr ( double  eyminus,
double  eyplus 
)
inline

Set asymmetric y error.

Definition at line 243 of file Point2D.h.

References setYErrMinus(), and setYErrPlus().

243  {
244  setYErrMinus(eyminus);
245  setYErrPlus(eyplus);
246  }
void setYErrPlus(double eyplus)
Set positive y error.
Definition: Point2D.h:232
void setYErrMinus(double eyminus)
Set negative y error.
Definition: Point2D.h:227
void YODA::Point2D::setYErr ( std::pair< double, double >  ey)
inline

Set asymmetric y error.

Definition at line 249 of file Point2D.h.

249  {
250  _ey = ey;
251  }
void YODA::Point2D::setYErrMinus ( double  eyminus)
inline

Set negative y error.

Definition at line 227 of file Point2D.h.

Referenced by YODA::flip(), setYErr(), and YODA::transformY().

227  {
228  _ey.first = eyminus;
229  }
void YODA::Point2D::setYErrPlus ( double  eyplus)
inline

Set positive y error.

Definition at line 232 of file Point2D.h.

Referenced by YODA::flip(), setYErr(), and YODA::transformY().

232  {
233  _ey.second = eyplus;
234  }
double YODA::Point2D::x ( ) const
inline
double YODA::Point2D::xErrAvg ( ) const
inline

Get average x-error value.

Definition at line 143 of file Point2D.h.

143  {
144  return (_ex.first + _ex.second)/2.0;
145  }
double YODA::Point2D::xErrMinus ( ) const
inline

Get negative x-error value.

Definition at line 133 of file Point2D.h.

Referenced by YODA::operator<(), YODA::operator==(), scaleX(), YODA::toTGraph(), YODA::WriterFLAT::writeScatter2D(), YODA::WriterYODA::writeScatter2D(), and YODA::WriterAIDA::writeScatter2D().

133  {
134  return _ex.first;
135  }
double YODA::Point2D::xErrPlus ( ) const
inline

Get positive x-error value.

Definition at line 138 of file Point2D.h.

Referenced by YODA::operator<(), YODA::operator==(), scaleX(), YODA::toTGraph(), YODA::WriterFLAT::writeScatter2D(), YODA::WriterYODA::writeScatter2D(), and YODA::WriterAIDA::writeScatter2D().

138  {
139  return _ex.second;
140  }
const std::pair<double,double>& YODA::Point2D::xErrs ( ) const
inline

Get x-error values.

Definition at line 128 of file Point2D.h.

128  {
129  return _ex;
130  }
double YODA::Point2D::xMax ( ) const
inline

Get value plus positive x-error

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

Definition at line 182 of file Point2D.h.

Referenced by YODA::add(), YODA::divide(), YODA::flip(), YODA::Histo1D::Histo1D(), YODA::Profile1D::Profile1D(), YODA::subtract(), and YODA::transformX().

182  {
183  return _x + _ex.second;
184  }
double YODA::Point2D::xMin ( ) const
inline

Get value minus negative x-error

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

Definition at line 176 of file Point2D.h.

Referenced by YODA::add(), YODA::divide(), YODA::flip(), YODA::Histo1D::Histo1D(), YODA::Profile1D::Profile1D(), YODA::subtract(), and YODA::transformX().

176  {
177  return _x - _ex.first;
178  }
std::pair<double,double> YODA::Point2D::xy ( ) const
inline

Get x,y value pair.

Todo:
Uniform "coords" accessor across all Scatters: returning fixed-size tuple?

Definition at line 113 of file Point2D.h.

113 { return std::make_pair(_x, _y); }
double YODA::Point2D::yErrAvg ( ) const
inline

Get average y-error value.

Definition at line 222 of file Point2D.h.

Referenced by YODA::add(), YODA::divide(), YODA::subtract(), and YODA::toIntegralEfficiencyHisto().

222  {
223  return (_ey.first + _ey.second)/2.0;
224  }
double YODA::Point2D::yErrMinus ( ) const
inline

Get negative y-error value.

Definition at line 212 of file Point2D.h.

Referenced by YODA::chi2(), scaleY(), YODA::toTGraph(), YODA::WriterAIDA::writeScatter2D(), YODA::WriterYODA::writeScatter2D(), and YODA::WriterFLAT::writeScatter2D().

212  {
213  return _ey.first;
214  }
double YODA::Point2D::yErrPlus ( ) const
inline

Get positive y-error value.

Definition at line 217 of file Point2D.h.

Referenced by YODA::chi2(), scaleY(), YODA::toTGraph(), YODA::WriterAIDA::writeScatter2D(), YODA::WriterYODA::writeScatter2D(), and YODA::WriterFLAT::writeScatter2D().

217  {
218  return _ey.second;
219  }
const std::pair<double,double>& YODA::Point2D::yErrs ( ) const
inline

Get y-error values.

Definition at line 207 of file Point2D.h.

207  {
208  return _ey;
209  }
double YODA::Point2D::yMax ( ) const
inline

Get value plus positive y-error

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

Definition at line 261 of file Point2D.h.

Referenced by YODA::flip(), and YODA::transformY().

261  {
262  return _y + _ey.second;
263  }
double YODA::Point2D::yMin ( ) const
inline

Get value minus negative y-error

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

Definition at line 255 of file Point2D.h.

Referenced by YODA::flip(), and YODA::transformY().

255  {
256  return _y - _ey.first;
257  }

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