Histogram statistics of unbinned values.
Every call to Fill updates sums to compute the number of effective entries as well as the arithmetic mean and other statistical quantities per dimension:
Definition at line 41 of file RHistStats.hxx.
Classes | |
| struct | RDimensionStats |
| Statistics for one dimension. More... | |
Public Member Functions | |
| RHistStats (std::size_t nDimensions) | |
| Construct a statistics object. | |
| void | Add (const RHistStats &other) |
| Add all entries from another statistics object. | |
| void | AddAtomic (const RHistStats &other) |
| Add all entries from another statistics object using atomic instructions. | |
| void | Clear () |
| Clear this statistics object. | |
| double | ComputeKurtosis (std::size_t dim=0) const |
| Compute the (excess) kurtosis of unbinned values. | |
| double | ComputeMean (std::size_t dim=0) const |
| Compute the arithmetic mean of unbinned values. | |
| double | ComputeNEffectiveEntries () const |
| Compute the number of effective entries. | |
| double | ComputeSkewness (std::size_t dim=0) const |
| Compute the skewness of unbinned values. | |
| double | ComputeStdDev (std::size_t dim=0) const |
| Compute the standard deviation of unbinned values. | |
| double | ComputeVariance (std::size_t dim=0) const |
| Compute the variance of unbinned values. | |
| void | DisableDimension (std::size_t dim) |
| Disable one dimension of this statistics object. | |
| template<typename... A> | |
| void | Fill (const A &...args) |
| Fill an entry into this statistics object. | |
| template<typename... A> | |
| void | Fill (const std::tuple< A... > &args) |
| Fill an entry into this statistics object. | |
| template<typename... A> | |
| void | Fill (const std::tuple< A... > &args, RWeight weight) |
| Fill an entry into this statistics object with a weight. | |
| const RDimensionStats & | GetDimensionStats (std::size_t dim=0) const |
| Get the statistics object for one dimension. | |
| std::size_t | GetNDimensions () const |
| std::uint64_t | GetNEntries () const |
| double | GetSumW () const |
| double | GetSumW2 () const |
| bool | IsEnabled (std::size_t dim) const |
| bool | IsTainted () const |
| void | Scale (double factor) |
| Scale the histogram statistics. | |
| void | Streamer (TBuffer &) |
| ROOT Streamer function to throw when trying to store an object of this class. | |
| void | Taint () |
| Taint this statistics object. | |
Private Member Functions | |
| template<std::size_t I, typename... A> | |
| void | FillImpl (const std::tuple< A... > &args) |
| template<std::size_t I, std::size_t N, typename... A> | |
| void | FillImpl (const std::tuple< A... > &args, double w) |
| void | ThrowIfTainted () const |
Private Attributes | |
| std::vector< RDimensionStats > | fDimensionStats |
| The sums per dimension. | |
| std::uint64_t | fNEntries = 0 |
| The number of entries. | |
| double | fSumW = 0.0 |
| The sum of weights. | |
| double | fSumW2 = 0.0 |
| The sum of weights squared. | |
| bool | fTainted = false |
| Whether this object is tainted, in which case read access will throw. | |
#include <ROOT/RHistStats.hxx>
|
inlineexplicit |
Construct a statistics object.
| [in] | nDimensions | the number of dimensions, must be > 0 |
Definition at line 132 of file RHistStats.hxx.
|
inline |
Add all entries from another statistics object.
Throws an exception if the number of dimensions are not identical.
| [in] | other | another statistics object |
Definition at line 196 of file RHistStats.hxx.
|
inline |
Add all entries from another statistics object using atomic instructions.
Throws an exception if the number of dimensions are not identical.
| [in] | other | another statistics object that must not be modified during the operation |
Definition at line 222 of file RHistStats.hxx.
|
inline |
Clear this statistics object.
Definition at line 244 of file RHistStats.hxx.
|
inline |
Compute the (excess) kurtosis of unbinned values.
The kurtosis is based on the fourth standardized moment:
\[ E\left[\left(\frac{X - \mu}{\sigma}\right)^4\right] \]
The excess kurtosis subtracts 3 from the standardized moment to have a value of 0 for a normal distribution:
\[ E\left[\left(\frac{X - \mu}{\sigma}\right)^4\right] - 3 \]
With support for weighted filling and after some rewriting, the (excess kurtosis) is computed as:
\[ \frac{\frac{\sum w_i \cdot x_i^4}{\sum w_i} - 4 \cdot \frac{\sum w_i \cdot x_i^3}{\sum w_i} \cdot \mu + 6 \cdot \frac{\sum w_i \cdot x_i^2}{\sum w_i} \cdot \mu^2 - 3 \cdot \mu^4}{\sigma^4} - 3 \]
| [in] | dim | the dimension index, starting at 0 |
Definition at line 386 of file RHistStats.hxx.
|
inline |
Compute the arithmetic mean of unbinned values.
\[ \mu = \frac{\sum w_i \cdot x_i}{\sum w_i} \]
| [in] | dim | the dimension index, starting at 0 |
Definition at line 279 of file RHistStats.hxx.
|
inline |
Compute the number of effective entries.
\[ \frac{(\sum w_i)^2}{\sum w_i^2} \]
Definition at line 262 of file RHistStats.hxx.
|
inline |
Compute the skewness of unbinned values.
The skewness is the third standardized moment:
\[ E\left[\left(\frac{X - \mu}{\sigma}\right)^3\right] \]
With support for weighted filling and after some rewriting, it is computed as:
\[ \frac{\frac{\sum w_i \cdot x_i^3}{\sum w_i} - 3 \cdot \frac{\sum w_i \cdot x_i^2}{\sum w_i} \cdot \mu + 2 \cdot \mu^3}{\sigma^3} \]
| [in] | dim | the dimension index, starting at 0 |
Definition at line 349 of file RHistStats.hxx.
|
inline |
Compute the standard deviation of unbinned values.
This function computes the uncorrected sample standard deviation:
\[ \sigma = \sqrt{\frac{1}{\sum w_i} \sum(w_i \cdot x_i - \mu)^2} \]
With some rewriting, this is equivalent to:
\[ \sigma = \sqrt{\frac{\sum w_i \cdot x_i^2}{\sum w_i} - \frac{(\sum w_i \cdot x_i)^2}{(\sum w_i)^2}} \]
This function does not include Bessel's correction needed for an unbiased estimator of population variance. In other words, the return value is a biased estimation lower than the actual population standard deviation.
| [in] | dim | the dimension index, starting at 0 |
Definition at line 332 of file RHistStats.hxx.
|
inline |
Compute the variance of unbinned values.
This function computes the uncorrected sample variance:
\[ \sigma^2 = \frac{1}{\sum w_i} \sum(w_i \cdot x_i - \mu)^2 \]
With some rewriting, this is equivalent to:
\[ \sigma^2 = \frac{\sum w_i \cdot x_i^2}{\sum w_i} - \mu^2 \]
This function does not include Bessel's correction needed for an unbiased estimator of population variance. In other words, the return value is a biased estimation lower than the actual population variance.
| [in] | dim | the dimension index, starting at 0 |
Definition at line 305 of file RHistStats.hxx.
|
inline |
Disable one dimension of this statistics object.
All future calls to Fill will ignore the corresponding argument. Once disabled, a dimension cannot be reenabled.
| [in] | dim | the dimension index, starting at 0 |
Definition at line 180 of file RHistStats.hxx.
|
inline |
Fill an entry into this statistics object.
For weighted filling, pass an RWeight as the last argument:
Throws an exception if the number of arguments does not match the number of dimensions.
| [in] | args | the arguments for each dimension |
std::tuple for unweighted filling and for weighted filling Definition at line 511 of file RHistStats.hxx.
|
inline |
Fill an entry into this statistics object.
Throws an exception if the number of arguments does not match the number of dimensions.
| [in] | args | the arguments for each dimension |
Definition at line 455 of file RHistStats.hxx.
|
inline |
Fill an entry into this statistics object with a weight.
| [in] | args | the arguments for each dimension |
| [in] | weight | the weight for this entry |
Definition at line 480 of file RHistStats.hxx.
|
inlineprivate |
Definition at line 406 of file RHistStats.hxx.
|
inlineprivate |
Definition at line 422 of file RHistStats.hxx.
|
inline |
Get the statistics object for one dimension.
Throws an exception if the dimension is disabled.
| [in] | dim | the dimension index, starting at 0 |
Definition at line 164 of file RHistStats.hxx.
|
inline |
Definition at line 140 of file RHistStats.hxx.
|
inline |
Definition at line 142 of file RHistStats.hxx.
|
inline |
Definition at line 147 of file RHistStats.hxx.
|
inline |
Definition at line 152 of file RHistStats.hxx.
|
inline |
Definition at line 182 of file RHistStats.hxx.
|
inline |
Definition at line 189 of file RHistStats.hxx.
|
inline |
Scale the histogram statistics.
| [in] | factor | the scale factor |
Definition at line 535 of file RHistStats.hxx.
|
inline |
ROOT Streamer function to throw when trying to store an object of this class.
Definition at line 549 of file RHistStats.hxx.
|
inline |
Taint this statistics object.
It can still be filled, but any read access will throw until Clear() is called.
Definition at line 187 of file RHistStats.hxx.
|
inlineprivate |
Definition at line 121 of file RHistStats.hxx.
|
private |
The sums per dimension.
Definition at line 116 of file RHistStats.hxx.
|
private |
The number of entries.
Definition at line 110 of file RHistStats.hxx.
|
private |
The sum of weights.
Definition at line 112 of file RHistStats.hxx.
|
private |
The sum of weights squared.
Definition at line 114 of file RHistStats.hxx.
Whether this object is tainted, in which case read access will throw.
This is used if a user modifies bin contents explicitly or slices histograms without preserving all entries, for example.
Definition at line 119 of file RHistStats.hxx.