24namespace Experimental {
131 throw std::logic_error(
"statistics are tainted, for example after setting bin contents or slicing");
142 throw std::invalid_argument(
"nDimensions must be > 0");
177 throw std::invalid_argument(
"dimension is disabled");
208 throw std::invalid_argument(
"number of dimensions not identical in Add");
213 throw std::invalid_argument(
"the same dimensions must be enabled to combine statistics with Add");
238 throw std::invalid_argument(
"number of dimensions not identical in AddAtomic");
243 throw std::invalid_argument(
"the same dimensions must be enabled to combine statistics with AddAtomic");
281 return std::numeric_limits<double>::signaling_NaN();
299 return std::numeric_limits<double>::signaling_NaN();
301 return stats.fSumWX /
fSumW;
325 return std::numeric_limits<double>::signaling_NaN();
328 return stats.fSumWX2 /
fSumW - mean * mean;
369 return std::numeric_limits<double>::signaling_NaN();
374 return std::numeric_limits<double>::signaling_NaN();
378 return (
EWX3 - 3 *
EWX2 * mean + 2 * mean * mean * mean) / std::pow(var, 1.5);
406 return std::numeric_limits<double>::signaling_NaN();
411 return std::numeric_limits<double>::signaling_NaN();
416 return (
EWX4 - 4 *
EWX3 * mean + 6 *
EWX2 * mean * mean - 3 * mean * mean * mean * mean) / (var * var) - 3;
420 template <std::size_t
I, std::size_t
N,
typename... A>
423 using ArgumentType = std::tuple_element_t<
I, std::tuple<A...>>;
425 if constexpr (!std::is_convertible_v<ArgumentType, double>) {
426 throw std::invalid_argument(
"invalid type of argument in RHistStats");
429 if constexpr (
I + 1 <
N) {
434 template <std::size_t
I,
typename... A>
437 using ArgumentType = std::tuple_element_t<
I, std::tuple<A...>>;
439 if constexpr (std::is_convertible_v<ArgumentType, double>) {
446 if constexpr (
I + 1 <
sizeof...(A)) {
451 template <std::size_t
I, std::size_t
N,
typename... A>
454 using ArgumentType = std::tuple_element_t<
I, std::tuple<A...>>;
456 if constexpr (std::is_convertible_v<ArgumentType, double>) {
465 if constexpr (
I + 1 <
N) {
485 template <
typename... A>
486 void Fill(
const std::tuple<A...> &args)
489 throw std::invalid_argument(
"invalid number of arguments to Fill");
513 template <
typename... A>
517 throw std::invalid_argument(
"invalid number of arguments to Fill");
547 template <
typename... A>
550 static_assert(
sizeof...(A) >= 1,
"need at least one argument to Fill");
551 if constexpr (
sizeof...(A) >= 1) {
552 auto t = std::forward_as_tuple(args...);
554 static constexpr std::size_t
N =
sizeof...(A) - 1;
556 throw std::invalid_argument(
"invalid number of arguments to Fill");
562 double w = std::get<N>(t).fValue;
580 fSumW2 *= factor * factor;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Histogram statistics of unbinned values.
void Add(const RHistStats &other)
Add all entries from another statistics object.
void Fill(const std::tuple< A... > &args, RWeight weight)
Fill an entry into this statistics object with a weight.
void FillImpl(const std::tuple< A... > &args)
double ComputeSkewness(std::size_t dim=0) const
Compute the skewness of unbinned values.
void Fill(const A &...args)
Fill an entry into this statistics object.
std::vector< RDimensionStats > fDimensionStats
The sums per dimension.
void Clear()
Clear this statistics object.
void Taint()
Taint this statistics object.
void FillImpl(const std::tuple< A... > &args, double w)
void AddAtomic(const RHistStats &other)
Add all entries from another statistics object using atomic instructions.
double fSumW
The sum of weights.
std::size_t GetNDimensions() const
const RDimensionStats & GetDimensionStats(std::size_t dim=0) const
Get the statistics object for one dimension.
double fSumW2
The sum of weights squared.
void Scale(double factor)
Scale the histogram statistics.
void Fill(const std::tuple< A... > &args)
Fill an entry into this statistics object.
double ComputeNEffectiveEntries() const
Compute the number of effective entries.
void DisableDimension(std::size_t dim)
Disable one dimension of this statistics object.
void CheckArguments(const std::tuple< A... > &args) const
double ComputeVariance(std::size_t dim=0) const
Compute the variance of unbinned values.
void Streamer(TBuffer &)
ROOT Streamer function to throw when trying to store an object of this class.
std::uint64_t GetNEntries() const
void ThrowIfTainted() const
double ComputeMean(std::size_t dim=0) const
Compute the arithmetic mean of unbinned values.
double ComputeKurtosis(std::size_t dim=0) const
Compute the (excess) kurtosis of unbinned values.
RHistStats(std::size_t nDimensions)
Construct a statistics object.
bool IsEnabled(std::size_t dim) const
std::uint64_t fNEntries
The number of entries.
bool fTainted
Whether this object is tainted, in which case read access will throw.
double ComputeStdDev(std::size_t dim=0) const
Compute the standard deviation of unbinned values.
A histogram for aggregation of data along multiple dimensions.
Buffer base class used for serializing objects.
std::enable_if_t< std::is_integral_v< T > > AtomicAdd(T *ptr, T val)
Statistics for one dimension.
void Scale(double factor)
void Add(double x, double w)
void AddAtomic(const RDimensionStats &other)
Add another statistics object using atomic instructions.
void Add(const RDimensionStats &other)
A weight for filling histograms.