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

A Bin2D specialised for handling histogram-type information. More...

#include <HistoBin2D.h>

Inheritance diagram for YODA::HistoBin2D:
YODA::Bin2D< Dbn2D > YODA::Bin

Public Member Functions

Constructors
 HistoBin2D (double xmin, double xmax, double ymin, double ymax)
 Make a new, empty bin with two pairs of edges. More...
 
 HistoBin2D (const std::pair< double, double > &xedges, const std::pair< double, double > &yedges)
 Constructor accepting a set of all edges of a bin. More...
 
 HistoBin2D (const std::pair< double, double > &xedges, const std::pair< double, double > &yedges, const Dbn2D &dbn)
 Make a bin with all the components of a fill history. More...
 
 HistoBin2D (const HistoBin2D &pb)
 Copy constructor. More...
 
HistoBin2Doperator= (const HistoBin2D &hb)
 Copy assignment. More...
 
Modifiers
void fill (double x, double y, double weight=1.0)
 
void fill (std::pair< double, double > coords, double weight=1.0)
 
void fillBin (double weight=1.0)
 
void reset ()
 A reset function. More...
 
Accessors
double volume () const
 The volume of a bin. More...
 
double volumeErr () const
 Error on volume. More...
 
double height () const
 The height of a bin. More...
 
double heightErr () const
 Error on height. More...
 
double relErr () const
 The relative size of the error (same for either volume or height errors) More...
 
- Public Member Functions inherited from YODA::Bin2D< Dbn2D >
 Bin2D (const std::pair< double, double > &xedges, const std::pair< double, double > &yedges)
 Make a new, empty bin with two pairs of edges. More...
 
 Bin2D (const std::pair< double, double > &xedges, const std::pair< double, double > &yedges, const Dbn2D &dbn)
 Make a bin with all the components of a fill history. More...
 
 Bin2D (const Bin2D< Dbn2D > &b)
 Copy constructor. More...
 
Bin2D< Dbn2D > & operator= (const Bin2D< Dbn2D > &b)
 Copy assignment. More...
 
void scaleW (double scalefactor)
 
void scaleXY (double scaleX, double scaleY)
 
std::pair< double, double > xEdges () const
 Get the {low,high} edges as an STL pair. More...
 
double xMin () const
 Lower x limit of the bin (inclusive). More...
 
double xMax () const
 Upper x limit of the bin (exclusive). More...
 
std::pair< double, double > yEdges () const
 Get the {low,high} edges as an STL pair. More...
 
double yMin () const
 Lower y limit of the bin (inclusive). More...
 
double yMax () const
 Upper y limit of the bin (exclusive). More...
 
double xMid () const
 Middle of the bin in x. More...
 
double yMid () const
 Middle of the bin in y. More...
 
std::pair< double, double > xyMid () const
 The geometric centre of the bin. More...
 
double xWidth () const
 Width of the bin in x. More...
 
double yWidth () const
 Width of the bin in y. More...
 
std::pair< double, double > xyWidths () const
 Widths of the bin in x and y. More...
 
double xFocus () const
 The mean x position in the bin, or the x midpoint if that is not available. More...
 
double yFocus () const
 The mean y position in the bin, or the y midpoint if that is not available. More...
 
std::pair< double, double > xyFocus () const
 The mean position in the bin, or the midpoint if that is not available. More...
 
double xMean () const
 Mean value of x-values in the bin. More...
 
double yMean () const
 Mean value of y-values in the bin. More...
 
double xVariance () const
 The variance of x-values in the bin. More...
 
double yVariance () const
 The variance of y-values in the bin. More...
 
double xStdDev () const
 The standard deviation (spread) of x-values in the bin. More...
 
double yStdDev () const
 The standard deviation (spread) of y-values in the bin. More...
 
double xStdErr () const
 The standard error on the bin x focus. More...
 
double yStdErr () const
 The standard error on the bin y focus. More...
 
double xRMS () const
 The x RMS in the bin. More...
 
double yRMS () const
 The y RMS in the bin. More...
 
Dbn2Ddbn ()
 Statistical distribution in this bin (non-const) More...
 
const Dbn2Ddbn () const
 Statistical distribution in this bin (const) More...
 
unsigned long numEntries () const
 The number of entries. More...
 
double effNumEntries () const
 The effective number of entries. More...
 
double sumW () const
 The sum of weights. More...
 
double sumW2 () const
 The sum of weights squared. More...
 
double sumWX () const
 The sum of x*weight. More...
 
double sumWY () const
 The sum of y*weight. More...
 
double sumWXY () const
 The sum of x*y*weight. More...
 
double sumWX2 () const
 The sum of x^2 * weight. More...
 
double sumWY2 () const
 The sum of y^2 * weight. More...
 
Bin2D< Dbn2D > & operator+= (const Bin2D< Dbn2D > &b)
 Add two bins. More...
 
Bin2D< Dbn2D > & operator-= (const Bin2D< Dbn2D > &b)
 Subtract one bin from another. More...
 
Bin2D< Dbn2D > & add (const Bin2D< Dbn2D > &b)
 Merge two adjacent bins. More...
 
Bin2D< Dbn2D > & subtract (const Bin2D< Dbn2D > &b)
 
bool fitsInside (std::pair< double, double > xrange, std::pair< double, double > yrange) const
 Test whether this bin would fit inside the given area. More...
 
bool bounds (double x, double y) const
 Test whether a point lies within the current bin. More...
 
int adjacentTo (const Bin2D< Dbn2D > &b) const
 Test whether two bins are adjacent and, if so, return how as an integer. More...
 
- Public Member Functions inherited from YODA::Bin
virtual ~Bin ()
 Virtual destructor for inheritance. More...
 

Detailed Description

A Bin2D specialised for handling histogram-type information.

This is a 2D bin type, which supports all the operations defined for a generic Bin2D object, but also supplies the specific member functions for histogram-type data, as opposed to profile-type.

Definition at line 21 of file HistoBin2D.h.

Constructor & Destructor Documentation

YODA::HistoBin2D::HistoBin2D ( double  xmin,
double  xmax,
double  ymin,
double  ymax 
)
inline

Make a new, empty bin with two pairs of edges.

Definition at line 28 of file HistoBin2D.h.

29  : Bin2D<Dbn2D>(std::make_pair(xmin, xmax), std::make_pair(ymin, ymax))
30  { }
YODA::HistoBin2D::HistoBin2D ( const std::pair< double, double > &  xedges,
const std::pair< double, double > &  yedges 
)
inline

Constructor accepting a set of all edges of a bin.

Definition at line 33 of file HistoBin2D.h.

35  : Bin2D<Dbn2D>(xedges, yedges)
36  { }
YODA::HistoBin2D::HistoBin2D ( const std::pair< double, double > &  xedges,
const std::pair< double, double > &  yedges,
const Dbn2D dbn 
)
inline

Make a bin with all the components of a fill history.

Mainly intended for internal persistency use.

Definition at line 41 of file HistoBin2D.h.

43  : Bin2D<Dbn2D>(xedges, yedges, dbn)
44  { }
Dbn2D & dbn()
Statistical distribution in this bin (non-const)
Definition: Bin2D.h:276
YODA::HistoBin2D::HistoBin2D ( const HistoBin2D pb)
inline

Copy constructor.

Definition at line 47 of file HistoBin2D.h.

48  : Bin2D<Dbn2D>(pb)
49  { }

Member Function Documentation

void YODA::HistoBin2D::fill ( double  x,
double  y,
double  weight = 1.0 
)
inline

A fill() function accepting coordinates as spearate numbers

Note
This should not be used, since it breaks histogram consistency. It will be removed in a future version.

Definition at line 66 of file HistoBin2D.h.

Referenced by fill(), and fillBin().

66  {
67  _dbn.fill(x, y, weight);
68  }
void YODA::HistoBin2D::fill ( std::pair< double, double >  coords,
double  weight = 1.0 
)
inline

A fill() function accepting the coordinates as std::pair

Note
This should not be used, since it breaks histogram consistency. It will be removed in a future version.

Definition at line 73 of file HistoBin2D.h.

References fill().

73  {
74  fill(coords.first, coords.second, weight);
75  }
void fill(double x, double y, double weight=1.0)
Definition: HistoBin2D.h:66
void YODA::HistoBin2D::fillBin ( double  weight = 1.0)
inline

A function that fills this particular bin.

Note
This should not be used, since it breaks histogram consistency. It will be removed in a future version.

Definition at line 80 of file HistoBin2D.h.

References fill(), and YODA::Bin2D< Dbn2D >::xyMid().

80  {
81  fill(xyMid(), weight);
82  }
std::pair< double, double > xyMid() const
The geometric centre of the bin.
Definition: Bin2D.h:173
void fill(double x, double y, double weight=1.0)
Definition: HistoBin2D.h:66
double YODA::HistoBin2D::height ( ) const
inline

The height of a bin.

Definition at line 106 of file HistoBin2D.h.

References volume(), YODA::Bin2D< Dbn2D >::xWidth(), and YODA::Bin2D< Dbn2D >::yWidth().

Referenced by YODA::mkScatter().

106  {
107  return volume()/(xWidth()*yWidth());
108  }
double xWidth() const
Width of the bin in x.
Definition: Bin2D.h:179
double volume() const
The volume of a bin.
Definition: HistoBin2D.h:96
double yWidth() const
Width of the bin in y.
Definition: Bin2D.h:184
double YODA::HistoBin2D::heightErr ( ) const
inline

Error on height.

Definition at line 111 of file HistoBin2D.h.

References volumeErr(), YODA::Bin2D< Dbn2D >::xWidth(), and YODA::Bin2D< Dbn2D >::yWidth().

Referenced by YODA::mkScatter().

111  {
112  return volumeErr()/(xWidth()*yWidth());
113  }
double volumeErr() const
Error on volume.
Definition: HistoBin2D.h:101
double xWidth() const
Width of the bin in x.
Definition: Bin2D.h:179
double yWidth() const
Width of the bin in y.
Definition: Bin2D.h:184
HistoBin2D& YODA::HistoBin2D::operator= ( const HistoBin2D hb)
inline

Copy assignment.

Definition at line 52 of file HistoBin2D.h.

References YODA::Bin2D< DBN >::operator=().

52  {
54  return *this;
55  }
Bin2D< DBN > & operator=(const Bin2D< DBN > &b)
Copy assignment.
Definition: Bin2D.h:83
double YODA::HistoBin2D::relErr ( ) const
inline

The relative size of the error (same for either volume or height errors)

Definition at line 116 of file HistoBin2D.h.

References YODA::Bin2D< Dbn2D >::sumW(), and YODA::Bin2D< Dbn2D >::sumW2().

116  {
117  return sumW2() != 0 ? sqrt(sumW2()) / sumW() : 0;
118  }
double sumW() const
The sum of weights.
Definition: Bin2D.h:296
double sumW2() const
The sum of weights squared.
Definition: Bin2D.h:301
void YODA::HistoBin2D::reset ( )
inlinevirtual

A reset function.

Reimplemented from YODA::Bin2D< Dbn2D >.

Definition at line 85 of file HistoBin2D.h.

References YODA::Bin2D< DBN >::reset().

85  {
87  }
virtual void reset()
Reset this bin.
Definition: Bin2D.h:97
double YODA::HistoBin2D::volume ( ) const
inline

The volume of a bin.

Definition at line 96 of file HistoBin2D.h.

References YODA::Bin2D< Dbn2D >::sumW().

Referenced by height().

96  {
97  return sumW();
98  }
double sumW() const
The sum of weights.
Definition: Bin2D.h:296
double YODA::HistoBin2D::volumeErr ( ) const
inline

Error on volume.

Definition at line 101 of file HistoBin2D.h.

References YODA::Bin2D< Dbn2D >::sumW2().

Referenced by heightErr().

101  {
102  return sqrt(sumW2());
103  }
double sumW2() const
The sum of weights squared.
Definition: Bin2D.h:301

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