5#ifndef ROOT_RHistEngine
6#define ROOT_RHistEngine
25#include <initializer_list>
35namespace Experimental {
71template <
typename BinContentType>
114 template <
typename...
Axes>
184 template <std::
size_t N>
190 throw std::invalid_argument(
"invalid number of indices passed to GetBinContent");
194 throw std::invalid_argument(
"bin not found in GetBinContent");
223 throw std::invalid_argument(
"invalid number of indices passed to GetBinContent");
227 throw std::invalid_argument(
"bin not found in GetBinContent");
252 template <
typename... A>
282 template <std::
size_t N,
typename V>
288 throw std::invalid_argument(
"invalid number of indices passed to SetBinContent");
292 throw std::invalid_argument(
"bin not found in SetBinContent");
304 template <
typename... A, std::size_t... I>
334 template <
typename... A>
337 auto t = std::forward_as_tuple(args...);
369 template <
typename... A>
370 void Fill(
const std::tuple<A...> &args)
375 throw std::invalid_argument(
"invalid number of arguments to Fill");
405 template <
typename... A>
413 throw std::invalid_argument(
"invalid number of arguments to Fill");
429 template <std::size_t
N,
typename... A,
typename W>
430 void FillImpl(
const std::tuple<A...> &args,
const W &weight)
455 template <
typename... A,
typename W>
456 void Fill(
const std::tuple<A...> &args,
const W &weight)
458 static_assert(std::is_class_v<BinContentType>,
459 "user-defined weight types are only supported for user-defined bin content types");
464 throw std::invalid_argument(
"invalid number of arguments to Fill");
466 FillImpl<
sizeof...(A)>(args, weight);
493 template <
typename... A>
496 static_assert(
sizeof...(A) >= 1,
"need at least one argument to Fill");
497 if constexpr (
sizeof...(A) >= 1) {
498 auto t = std::forward_as_tuple(args...);
501 static constexpr std::size_t
N =
sizeof...(A) - 1;
503 throw std::invalid_argument(
"invalid number of arguments to Fill");
505 RWeight weight = std::get<N>(t);
521 template <
typename... A>
531 throw std::invalid_argument(
"invalid number of arguments to Fill");
547 template <
typename... A>
559 throw std::invalid_argument(
"invalid number of arguments to Fill");
575 template <
typename... A,
typename W>
578 static_assert(std::is_class_v<BinContentType>,
579 "user-defined weight types are only supported for user-defined bin content types");
588 throw std::invalid_argument(
"invalid number of arguments to Fill");
601 template <
typename... A>
604 static_assert(
sizeof...(A) >= 1,
"need at least one argument to Fill");
605 if constexpr (
sizeof...(A) >= 1) {
610 auto t = std::forward_as_tuple(args...);
613 static constexpr std::size_t
N =
sizeof...(A) - 1;
615 throw std::invalid_argument(
"invalid number of arguments to Fill");
617 RWeight weight = std::get<N>(t);
641 throw std::invalid_argument(
"axes configurations not identical in Add");
656 throw std::invalid_argument(
"axes configurations not identical in AddAtomic");
693 template <
typename U>
710 static_assert(!std::is_integral_v<BinContentType>,
"scaling is not supported for integral bin content types");
723 throw std::invalid_argument(
"invalid number of specifications passed to Slice");
727 std::vector<RAxisVariant> axes;
728 for (std::size_t i = 0; i <
sliceSpecs.size(); i++) {
730 if (
sliceSpecs[i].GetOperationSum() ==
nullptr) {
735 throw std::invalid_argument(
"summing across all dimensions is not supported");
853 template <
typename... A>
870 static_assert(std::is_trivially_copyable_v<BinContentType>,
871 "snapshotting requires a trivially copyable bin content type");
892 std::atomic_thread_fence(std::memory_order_acquire);
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 index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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
Bin configurations for all dimensions of a histogram.
std::size_t GetNDimensions() const
RLinearizedIndex ComputeGlobalIndexImpl(std::size_t index, const std::tuple< A... > &args) const
RLinearizedIndex ComputeGlobalIndex(const std::tuple< A... > &args) const
Compute the global index for all axes.
RBinIndexMultiDimRange GetFullMultiDimRange() const
Get the multidimensional range of all bins.
std::uint64_t ComputeTotalNBins() const
Compute the total number of bins for all axes.
const std::vector< RAxisVariant > & Get() const
Mapper of bin indices for slice operations.
A variant of all supported axis types.
A multidimensional range of bin indices.
A bin index with special values for underflow and overflow bins.
A histogram data structure to bin data along multiple dimensions.
RHistEngine Slice(const std::vector< RSliceSpec > &sliceSpecs) const
Slice this histogram with an RSliceSpec per dimension.
RHistEngine & operator=(RHistEngine &&rhs) noexcept
Efficiently move a histogram engine.
RHistEngine(const RAxisVariant &axis1, const Axes &...axes)
Construct a histogram engine.
void Fill(const A &...args)
Fill an entry into the histogram.
const std::vector< RAxisVariant > & GetAxes() const
RHistEngine(RHistEngine &&rhs) noexcept
Efficiently move construct a histogram engine.
RBinIndexMultiDimRange GetFullMultiDimRange() const
Get the multidimensional range of all bins.
RHistEngine Clone() const
Clone this histogram engine.
void FillImpl(const std::tuple< A... > &args, const W &weight)
void SetBinContent(const A &...args)
Set the content of a single bin.
void Scale(double factor)
Scale all histogram bin contents.
RHistEngine SnapshotAtomic() const
Create an atomic snapshot of this histogram engine.
void Fill(const std::tuple< A... > &args)
Fill an entry into the histogram.
void FillAtomic(const std::tuple< A... > &args)
Fill an entry into the histogram using atomic instructions.
RHistEngine(std::uint64_t nNormalBins, std::pair< double, double > interval)
Construct a one-dimensional histogram engine with a regular axis.
RHistEngine & operator=(const RHistEngine &)=delete
The copy assignment operator is deleted.
const BinContentType & GetBinContent(const std::vector< RBinIndex > &indices) const
Get the content of a single bin.
RHistEngine(const RHistEngine &)=delete
The copy constructor is deleted.
const BinContentType & GetBinContent(const std::array< RBinIndex, N > &indices) const
Get the content of a single bin.
const BinContentType & GetBinContent(const A &...args) const
Get the content of a single bin.
RHistEngine SliceImpl(const std::vector< RSliceSpec > &sliceSpecs, bool &dropped) const
void SetBinContent(const std::array< RBinIndex, N > &indices, const V &value)
Set the content of a single bin.
void AddAtomic(const RHistEngine &other)
Add all bin contents of another histogram using atomic instructions.
std::size_t GetNDimensions() const
void Fill(const std::tuple< A... > &args, const W &weight)
Fill an entry into the histogram with a user-defined weight.
void Add(const RHistEngine &other)
Add all bin contents of another histogram.
void FillAtomic(const std::tuple< A... > &args, RWeight weight)
Fill an entry into the histogram with a weight using atomic instructions.
static constexpr bool SupportsWeightedFilling
Whether this histogram engine type supports weighted filling.
void Clear()
Clear all bin contents.
RHistEngine Slice(const A &...args) const
Slice this histogram with an RSliceSpec per dimension.
std::uint64_t GetTotalNBins() const
void FillAtomic(const std::tuple< A... > &args, const W &weight)
Fill an entry into the histogram with a user-defined weight using atomic instructions.
void SetBinContentImpl(const std::tuple< A... > &args, std::index_sequence< I... >)
RHistEngine(std::vector< RAxisVariant > axes)
Construct a histogram engine.
void FillAtomic(const A &...args)
Fill an entry into the histogram using atomic instructions.
Internal::RAxes fAxes
The axis configuration for this histogram. Relevant methods are forwarded from the public interface.
void Fill(const std::tuple< A... > &args, RWeight weight)
Fill an entry into the histogram with a weight.
std::atomic< bool > fSnapshotInProgress
Flag to pause filling while a snapshot is ongoing.
RHistEngine(std::initializer_list< RAxisVariant > axes)
Construct a histogram engine.
void Streamer(TBuffer &)
ROOT Streamer function to throw when trying to store an object of this class.
std::vector< BinContentType > fBinContents
The bin contents for this histogram.
RHistEngine< U > Convert() const
Convert this histogram engine to a different bin content type.
A histogram for aggregation of data along multiple dimensions.
A profile histogram, computing statistical quantities of an additional variable per bin.
A regular axis with equidistant bins in the interval .
const_iterator begin() const
Buffer base class used for serializing objects.
std::enable_if_t< std::is_arithmetic_v< T > > AtomicIncRelease(T *ptr)
std::enable_if_t< std::is_arithmetic_v< T > > AtomicLoad(const T *ptr, T *ret)
std::enable_if_t< std::is_integral_v< T > > AtomicAdd(T *ptr, T val)
std::enable_if_t< std::is_integral_v< T > > AtomicAddRelease(T *ptr, T val)
A linearized index that can be invalid.
A weight for filling histograms.