ThePEG 2.3.0
|
User level interface to 1D Histogram. More...
#include <Histogram2D.h>
Public Member Functions | |
Histogram2D (int nx, double lox, double upx, int ny, double loy, double upy) | |
Standard constructor. | |
Histogram2D (const std::vector< double > &xedges, const std::vector< double > &yedges) | |
Standard constructor for variable bin width. | |
Histogram2D (const Histogram2D &h) | |
Copy constructor. | |
virtual | ~Histogram2D () |
Destructor. | |
std::string | title () const |
Get the Histogram's title. | |
std::string | name () const |
Get the Histogram's name. | |
bool | setTitle (const std::string &title) |
Set the histogram title. | |
IAnnotation & | annotation () |
Not implemented in LWH. | |
const IAnnotation & | annotation () const |
Not implemented in LWH. | |
int | dimension () const |
Get the Histogram's dimension. | |
bool | reset () |
Reset the Histogram; as if just created. | |
int | entries () const |
Get the number of in-range entries in the Histogram. | |
int | allEntries () const |
Sum of the entries in all the IHistogram's bins, i.e in-range bins, UNDERFLOW and OVERFLOW. | |
int | extraEntries () const |
Number of entries in the UNDERFLOW and OVERFLOW bins. | |
double | equivalentBinEntries () const |
Number of equivalent entries, i.e. | |
double | sumBinHeights () const |
Sum of in-range bin heights in the IHistogram, UNDERFLOW and OVERFLOW bins are excluded. | |
double | sumAllBinHeights () const |
Sum of the heights of all the IHistogram's bins, i.e in-range bins, UNDERFLOW and OVERFLOW. | |
double | sumExtraBinHeights () const |
Sum of heights in the UNDERFLOW and OVERFLOW bins. | |
double | minBinHeight () const |
Minimum height of the in-range bins, i.e. | |
double | maxBinHeight () const |
Maximum height of the in-range bins, i.e. | |
bool | fill (double x, double y, double weight=1.) |
Fill the IHistogram1D with a value and the corresponding weight. | |
double | binMeanX (int xindex, int yindex) const |
The weighted mean along the x-axis of a bin. | |
double | binMeanY (int xindex, int yindex) const |
The weighted mean along the y-axis of a bin. | |
double | binRmsX (int xindex, int yindex) const |
The weighted x-RMS of a bin. | |
double | binRmsY (int xindex, int yindex) const |
The weighted y-RMS of a bin. | |
int | binEntries (int xindex, int yindex) const |
Number of entries in the corresponding bin (ie the number of times fill was called for this bin). | |
virtual int | binEntriesX (int index) const |
Sum of all the entries of the bins along a given x bin. | |
virtual int | binEntriesY (int index) const |
Sum of all the entries of the bins along a given y bin. | |
double | binHeight (int xindex, int yindex) const |
Total height of the corresponding bin (ie the sum of the weights in this bin). | |
virtual double | binHeightX (int index) const |
Sum of all the heights of the bins along a given x bin. | |
virtual double | binHeightY (int index) const |
Sum of all the heights of the bins along a given y bin. | |
double | binError (int xindex, int yindex) const |
The error of a given bin. | |
double | meanX () const |
The mean of the IHistogram2D along the x axis. | |
double | meanY () const |
The mean of the IHistogram2D along the y axis. | |
double | rmsX () const |
The RMS of the IHistogram2D along the x axis. | |
double | rmsY () const |
The RMS of the IHistogram2D along the x axis. | |
double | getSumW (int xindex, int yindex) const |
The weights. | |
double | getSumW2 (int xindex, int yindex) const |
The squared weights. | |
double | getSumXW (int xindex, int yindex) const |
The weighted x-values. | |
double | getSumX2W (int xindex, int yindex) const |
The weighted x-square-values. | |
double | getSumYW (int xindex, int yindex) const |
The weighted x-values. | |
double | getSumY2W (int xindex, int yindex) const |
The weighted x-square-values. | |
const IAxis & | xAxis () const |
Get the x axis of the IHistogram2D. | |
const IAxis & | yAxis () const |
Get the y axis of the IHistogram2D. | |
int | coordToIndexX (double coord) const |
Get the bin number corresponding to a given coordinate along the x axis. | |
int | coordToIndexY (double coord) const |
Get the bin number corresponding to a given coordinate along the y axis. | |
bool | add (const Histogram2D &h) |
Add to this Histogram2D the contents of another IHistogram2D. | |
bool | add (const IHistogram2D &hist) |
Add to this IHistogram1D the contents of another IHistogram1D. | |
bool | scale (double s) |
Scale the contents of this histogram with the given factor. | |
void | normalize (double intg) |
Scale the given histogram so that the integral over all bins (including overflow) gives intg. | |
void * | cast (const std::string &) const |
Return the integral over the histogram bins assuming it has been normalize()d. | |
bool | writeXML (std::ostream &os, std::string path, std::string name) |
Write out the histogram in the AIDA xml format. | |
bool | writeFLAT (std::ostream &os, std::string path, std::string name) |
Write out the histogram in a flat text file suitable for eg. | |
Public Member Functions inherited from LWH::ManagedObject | |
virtual | ~ManagedObject () |
Destructor. | |
virtual bool | writeXML (std::ostream &os, std::string path, std::string name)=0 |
Write out the object to the given stream in XML format. | |
virtual bool | writeFLAT (std::ostream &os, std::string path, std::string name)=0 |
Write out the object to the given stream in simple table format. | |
Private Attributes | |
std::string | theTitle |
The title. | |
IAxis * | xax |
The axis. | |
Axis * | xfax |
Pointer (possibly null) to a axis with fixed bin width. | |
VariAxis * | xvax |
Pointer (possibly null) to a axis with fixed bin width. | |
IAxis * | yax |
The axis. | |
Axis * | yfax |
Pointer (possibly null) to a axis with fixed bin width. | |
VariAxis * | yvax |
Pointer (possibly null) to a axis with fixed bin width. | |
std::vector< std::vector< int > > | sum |
The counts. | |
std::vector< std::vector< double > > | sumw |
The weights. | |
std::vector< std::vector< double > > | sumw2 |
The squared weights. | |
std::vector< std::vector< double > > | sumxw |
The weighted x-values. | |
std::vector< std::vector< double > > | sumx2w |
The weighted x-square-values. | |
std::vector< std::vector< double > > | sumyw |
The weighted y-values. | |
std::vector< std::vector< double > > | sumy2w |
The weighted y-square-values. | |
IAnnotation * | anno |
dummy pointer to non-existen annotation. | |
Friends | |
class | HistogramFactory |
HistFactory is a friend. | |
User level interface to 1D Histogram.
Definition at line 25 of file Histogram2D.h.
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
Add to this Histogram2D the contents of another IHistogram2D.
h | The Histogram2D to be added to this IHistogram2D. |
Definition at line 577 of file Histogram2D.h.
References sum, sumw, sumw2, sumx2w, sumxw, sumy2w, sumyw, xax, and yax.
Referenced by add(), and LWH::HistogramFactory::add().
|
inline |
Add to this IHistogram1D the contents of another IHistogram1D.
hist | The IHistogram1D to be added to this IHistogram1D. |
Definition at line 602 of file Histogram2D.h.
References add().
|
inline |
Sum of the entries in all the IHistogram's bins, i.e in-range bins, UNDERFLOW and OVERFLOW.
This is equivalent to the number of times the method fill was invoked.
Definition at line 178 of file Histogram2D.h.
References entries(), and extraEntries().
|
inline |
Not implemented in LWH.
will throw an exception.
Definition at line 121 of file Histogram2D.h.
References anno.
|
inline |
Not implemented in LWH.
will throw an exception.
Definition at line 129 of file Histogram2D.h.
References anno.
|
inline |
Number of entries in the corresponding bin (ie the number of times fill was called for this bin).
index | The bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
Definition at line 352 of file Histogram2D.h.
References sum.
|
inlinevirtual |
Sum of all the entries of the bins along a given x bin.
This is equivalent to projectionX().binEntries(index)
.
index | The x bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
Definition at line 363 of file Histogram2D.h.
|
inlinevirtual |
Sum of all the entries of the bins along a given y bin.
This is equivalent to projectionY().binEntries(index)
.
index | The y bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
Definition at line 377 of file Histogram2D.h.
|
inline |
The error of a given bin.
index | The bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
Definition at line 430 of file Histogram2D.h.
References sumw2.
|
inline |
Total height of the corresponding bin (ie the sum of the weights in this bin).
index | The bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
Definition at line 390 of file Histogram2D.h.
References sumw.
|
inlinevirtual |
Sum of all the heights of the bins along a given x bin.
This is equivalent to projectionX().binHeight(index)
.
index | The x bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
Definition at line 403 of file Histogram2D.h.
|
inlinevirtual |
Sum of all the heights of the bins along a given y bin.
This is equivalent to projectionY().binHeight(index)
.
index | The y bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
Definition at line 417 of file Histogram2D.h.
|
inline |
The weighted mean along the x-axis of a bin.
xindex | The bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
yindex | The bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
Definition at line 298 of file Histogram2D.h.
References LWH::Axis::binMidPoint(), LWH::VariAxis::binMidPoint(), sumw, sumxw, xfax, and xvax.
Referenced by writeXML().
|
inline |
The weighted mean along the y-axis of a bin.
xindex | The bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
yindex | The bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
Definition at line 311 of file Histogram2D.h.
References LWH::Axis::binMidPoint(), LWH::VariAxis::binMidPoint(), sumw, sumyw, xfax, and yvax.
Referenced by writeXML().
|
inline |
The weighted x-RMS of a bin.
xindex | The bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
yindex | The bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
Definition at line 324 of file Histogram2D.h.
References sum, sumw, sumx2w, sumxw, and xax.
Referenced by writeXML().
|
inline |
The weighted y-RMS of a bin.
xindex | The bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
yindex | The bin number (0...N-1) or OVERFLOW or UNDERFLOW. |
Definition at line 338 of file Histogram2D.h.
References sum, sumw, sumy2w, sumyw, and yax.
Referenced by writeXML().
|
inline |
Return the integral over the histogram bins assuming it has been normalize()d.
Not implemented in LWH.
Definition at line 666 of file Histogram2D.h.
|
inline |
Get the bin number corresponding to a given coordinate along the x axis.
This is a convenience method, equivalent to axis().coordToIndex(coord)
.
coord | The coordinalte along the x axis. |
Definition at line 557 of file Histogram2D.h.
References xax.
|
inline |
Get the bin number corresponding to a given coordinate along the y axis.
This is a convenience method, equivalent to axis().coordToIndex(coord)
.
coord | The coordinalte along the y axis. |
Definition at line 568 of file Histogram2D.h.
References yax.
|
inline |
Get the Histogram's dimension.
Definition at line 138 of file Histogram2D.h.
|
inline |
Get the number of in-range entries in the Histogram.
Definition at line 164 of file Histogram2D.h.
Referenced by allEntries(), and writeXML().
|
inline |
|
inline |
Number of entries in the UNDERFLOW and OVERFLOW bins.
Definition at line 186 of file Histogram2D.h.
Referenced by allEntries().
|
inline |
Fill the IHistogram1D with a value and the corresponding weight.
x | The value to be filled in. |
weight | The corresponding weight (by default 1). |
Definition at line 279 of file Histogram2D.h.
References sum, sumw, sumw2, sumx2w, sumxw, sumy2w, sumyw, xax, and yax.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Maximum height of the in-range bins, i.e.
not considering the UNDERFLOW and OVERFLOW bins.
Definition at line 264 of file Histogram2D.h.
|
inline |
The mean of the IHistogram2D along the x axis.
Definition at line 439 of file Histogram2D.h.
References sumw, sumxw, xax, and yax.
Referenced by writeXML().
|
inline |
The mean of the IHistogram2D along the y axis.
Definition at line 455 of file Histogram2D.h.
References sumw, sumyw, xax, and yax.
Referenced by writeXML().
|
inline |
Minimum height of the in-range bins, i.e.
not considering the UNDERFLOW and OVERFLOW bins.
Definition at line 251 of file Histogram2D.h.
|
inline |
Get the Histogram's name.
Definition at line 104 of file Histogram2D.h.
References title().
Referenced by writeFLAT(), and writeXML().
|
inline |
Scale the given histogram so that the integral over all bins (including overflow) gives intg.
This function also corrects for the bin-widths, which means that it should only be run once for each histogram. Further rescaling must be done with the scale(double) function.
Definition at line 630 of file Histogram2D.h.
References sumAllBinHeights(), sumw, sumw2, sumx2w, sumxw, sumy2w, sumyw, xax, and yax.
|
inline |
|
inline |
The RMS of the IHistogram2D along the x axis.
Definition at line 471 of file Histogram2D.h.
References sumw, sumx2w, sumxw, xax, and yax.
Referenced by writeXML().
|
inline |
The RMS of the IHistogram2D along the x axis.
Definition at line 490 of file Histogram2D.h.
References sumw, sumy2w, sumyw, xax, and yax.
Referenced by writeXML().
|
inline |
|
inline |
Set the histogram title.
title | The title. |
Definition at line 113 of file Histogram2D.h.
References theTitle, and title().
Referenced by LWH::HistogramFactory::add(), LWH::HistogramFactory::createCopy(), LWH::HistogramFactory::createHistogram2D(), LWH::HistogramFactory::divide(), LWH::HistogramFactory::multiply(), and LWH::HistogramFactory::subtract().
|
inline |
Sum of the heights of all the IHistogram's bins, i.e in-range bins, UNDERFLOW and OVERFLOW.
Definition at line 229 of file Histogram2D.h.
References sumBinHeights(), and sumExtraBinHeights().
Referenced by normalize().
|
inline |
Sum of in-range bin heights in the IHistogram, UNDERFLOW and OVERFLOW bins are excluded.
Definition at line 217 of file Histogram2D.h.
References sumw, xax, and yax.
Referenced by sumAllBinHeights().
|
inline |
Sum of heights in the UNDERFLOW and OVERFLOW bins.
Definition at line 237 of file Histogram2D.h.
References sumw, xax, and yax.
Referenced by sumAllBinHeights().
|
inline |
Get the Histogram's title.
Definition at line 96 of file Histogram2D.h.
References theTitle.
Referenced by name(), setTitle(), writeFLAT(), and writeXML().
|
inlinevirtual |
Write out the histogram in a flat text file suitable for eg.
gnuplot to read. The coloums are layed out as 'x w w2 n'.
Implements LWH::ManagedObject.
Definition at line 738 of file Histogram2D.h.
|
inlinevirtual |
|
inline |
Get the x axis of the IHistogram2D.
Definition at line 538 of file Histogram2D.h.
References xax.
|
inline |
Get the y axis of the IHistogram2D.
Definition at line 546 of file Histogram2D.h.
References yax.
|
friend |
HistFactory is a friend.
Definition at line 30 of file Histogram2D.h.
|
private |
dummy pointer to non-existen annotation.
Definition at line 862 of file Histogram2D.h.
Referenced by annotation().
|
private |
The counts.
Definition at line 841 of file Histogram2D.h.
Referenced by add(), binEntries(), binEntriesX(), binEntriesY(), binRmsX(), binRmsY(), LWH::HistogramFactory::divide(), entries(), extraEntries(), fill(), LWH::HistogramFactory::multiply(), reset(), LWH::HistogramFactory::sliceX(), LWH::HistogramFactory::subtract(), writeFLAT(), and writeXML().
|
private |
The weights.
Definition at line 844 of file Histogram2D.h.
Referenced by add(), binHeight(), binHeightX(), binHeightY(), binMeanX(), binMeanY(), binRmsX(), binRmsY(), LWH::HistogramFactory::divide(), equivalentBinEntries(), fill(), getSumW(), maxBinHeight(), meanX(), meanY(), minBinHeight(), LWH::HistogramFactory::multiply(), normalize(), reset(), rmsX(), rmsY(), scale(), LWH::HistogramFactory::sliceX(), LWH::HistogramFactory::subtract(), sumBinHeights(), sumExtraBinHeights(), writeFLAT(), and writeXML().
|
private |
The squared weights.
Definition at line 847 of file Histogram2D.h.
Referenced by add(), binError(), LWH::HistogramFactory::divide(), equivalentBinEntries(), fill(), getSumW2(), LWH::HistogramFactory::multiply(), normalize(), reset(), scale(), LWH::HistogramFactory::sliceX(), LWH::HistogramFactory::subtract(), writeFLAT(), and writeXML().
|
private |
The weighted x-square-values.
Definition at line 853 of file Histogram2D.h.
Referenced by add(), binRmsX(), fill(), getSumX2W(), normalize(), reset(), rmsX(), scale(), LWH::HistogramFactory::sliceX(), and LWH::HistogramFactory::subtract().
|
private |
The weighted x-values.
Definition at line 850 of file Histogram2D.h.
Referenced by add(), binMeanX(), binRmsX(), fill(), getSumXW(), meanX(), normalize(), reset(), rmsX(), scale(), LWH::HistogramFactory::sliceX(), and LWH::HistogramFactory::subtract().
|
private |
The weighted y-square-values.
Definition at line 859 of file Histogram2D.h.
Referenced by add(), binRmsY(), fill(), getSumY2W(), normalize(), reset(), rmsY(), scale(), and LWH::HistogramFactory::subtract().
|
private |
The weighted y-values.
Definition at line 856 of file Histogram2D.h.
Referenced by add(), binMeanY(), binRmsY(), fill(), getSumYW(), meanY(), normalize(), reset(), rmsY(), scale(), and LWH::HistogramFactory::subtract().
|
private |
|
private |
The axis.
Definition at line 823 of file Histogram2D.h.
Referenced by add(), binEntriesY(), binHeightY(), binRmsX(), LWH::HistogramFactory::checkBins(), coordToIndexX(), LWH::HistogramFactory::divide(), entries(), equivalentBinEntries(), extraEntries(), fill(), Histogram2D(), maxBinHeight(), meanX(), meanY(), minBinHeight(), LWH::HistogramFactory::multiply(), normalize(), LWH::HistogramFactory::projectionY(), reset(), rmsX(), rmsY(), scale(), LWH::HistogramFactory::sliceX(), LWH::HistogramFactory::subtract(), sumBinHeights(), sumExtraBinHeights(), writeFLAT(), writeXML(), xAxis(), and ~Histogram2D().
|
private |
Pointer (possibly null) to a axis with fixed bin width.
Definition at line 826 of file Histogram2D.h.
Referenced by binMeanX(), binMeanY(), LWH::HistogramFactory::checkBins(), Histogram2D(), and LWH::HistogramFactory::sliceX().
|
private |
Pointer (possibly null) to a axis with fixed bin width.
Definition at line 829 of file Histogram2D.h.
Referenced by binMeanX(), Histogram2D(), and writeXML().
|
private |
The axis.
Definition at line 832 of file Histogram2D.h.
Referenced by add(), binEntriesX(), binHeightX(), binRmsY(), LWH::HistogramFactory::checkBins(), coordToIndexY(), LWH::HistogramFactory::divide(), entries(), equivalentBinEntries(), extraEntries(), fill(), Histogram2D(), maxBinHeight(), meanX(), meanY(), minBinHeight(), LWH::HistogramFactory::multiply(), normalize(), LWH::HistogramFactory::projectionX(), reset(), rmsX(), rmsY(), scale(), LWH::HistogramFactory::subtract(), sumBinHeights(), sumExtraBinHeights(), writeFLAT(), writeXML(), yAxis(), and ~Histogram2D().
|
private |
Pointer (possibly null) to a axis with fixed bin width.
Definition at line 835 of file Histogram2D.h.
Referenced by LWH::HistogramFactory::checkBins(), and Histogram2D().
|
private |
Pointer (possibly null) to a axis with fixed bin width.
Definition at line 838 of file Histogram2D.h.
Referenced by binMeanY(), Histogram2D(), and writeXML().