A histogram data structure to bin data along multiple dimensions.
Every call to Fill bins the data according to the axis configuration and increments the bin content:
The class is templated on the bin content type. For counting, as in the example above, it may be an integer type such as int
or long
. Narrower types such as unsigned char
or short
are supported, but may overflow due to their limited range and must be used with care. For weighted filling, the bin content type must be a floating-point type such as float
or double
. Note that float
has a limited significant precision of 24 bits.
An object can have arbitrary dimensionality determined at run-time. The axis configuration is passed as a vector of RAxisVariant:
Definition at line 55 of file RHistEngine.hxx.
Public Member Functions | |
RHistEngine (const RHistEngine< BinContentType > &)=delete | |
RHistEngine (RHistEngine< BinContentType > &&)=default | |
RHistEngine (std::size_t nNormalBins, double low, double high) | |
Construct a one-dimensional histogram engine with a regular axis. | |
RHistEngine (std::vector< RAxisVariant > axes) | |
Construct a histogram engine. | |
~RHistEngine ()=default | |
template<typename... A> | |
void | Fill (const A &...args) |
Fill an entry into the histogram. | |
template<typename... A> | |
void | Fill (const std::tuple< A... > &args) |
Fill an entry into the histogram. | |
const std::vector< RAxisVariant > & | GetAxes () const |
template<typename... A> | |
const BinContentType & | GetBinContent (const A &...args) const |
Get the content of a single bin. | |
template<std::size_t N> | |
const BinContentType & | GetBinContent (const std::array< RBinIndex, N > &indices) const |
Get the content of a single bin. | |
std::size_t | GetNDimensions () const |
std::size_t | GetTotalNBins () const |
RHistEngine< BinContentType > & | operator= (const RHistEngine< BinContentType > &)=delete |
RHistEngine< BinContentType > & | operator= (RHistEngine< BinContentType > &&)=default |
void | Streamer (TBuffer &) |
ROOT Streamer function to throw when trying to store an object of this class. | |
Private Attributes | |
Internal::RAxes | fAxes |
The axis configuration for this histogram. Relevant methods are forwarded from the public interface. | |
std::vector< BinContentType > | fBinContents |
The bin contents for this histogram. | |
#include <ROOT/RHistEngine.hxx>
|
inlineexplicit |
Construct a histogram engine.
[in] | axes | the axis objects, must have size > 0 |
Definition at line 65 of file RHistEngine.hxx.
|
inline |
Construct a one-dimensional histogram engine with a regular axis.
[in] | nNormalBins | the number of normal bins, must be > 0 |
[in] | low | the lower end of the axis interval (inclusive) |
[in] | high | the upper end of the axis interval (exclusive), must be > low |
Definition at line 78 of file RHistEngine.hxx.
|
delete |
|
default |
|
default |
|
inline |
Fill an entry into the histogram.
If one of the arguments is outside the corresponding axis and flow bins are disabled, the entry will be silently discarded.
Throws an exception if the number of arguments does not match the axis configuration.
[in] | args | the arguments for each axis |
std::tuple
Definition at line 200 of file RHistEngine.hxx.
|
inline |
Fill an entry into the histogram.
If one of the arguments is outside the corresponding axis and flow bins are disabled, the entry will be silently discarded.
Throws an exception if the number of arguments does not match the axis configuration.
[in] | args | the arguments for each axis |
Definition at line 170 of file RHistEngine.hxx.
|
inline |
Definition at line 89 of file RHistEngine.hxx.
|
inline |
Get the content of a single bin.
Throws an exception if the number of arguments does not match the axis configuration or the bin is not found.
[in] | args | the arguments for each axis |
std::array
Definition at line 147 of file RHistEngine.hxx.
|
inline |
Get the content of a single bin.
Throws an exception if the number of indices does not match the axis configuration or the bin is not found.
[in] | indices | the array of indices for each axis |
Definition at line 112 of file RHistEngine.hxx.
|
inline |
Definition at line 90 of file RHistEngine.hxx.
|
inline |
Definition at line 91 of file RHistEngine.hxx.
|
delete |
|
default |
|
inline |
ROOT Streamer function to throw when trying to store an object of this class.
Definition at line 206 of file RHistEngine.hxx.
|
private |
The axis configuration for this histogram. Relevant methods are forwarded from the public interface.
Definition at line 57 of file RHistEngine.hxx.
|
private |
The bin contents for this histogram.
Definition at line 59 of file RHistEngine.hxx.