24namespace Experimental {
35 std::vector<RAxisVariant>
fAxes;
42 throw std::invalid_argument(
"must have at least 1 axis object");
47 const std::vector<RAxisVariant> &
Get()
const {
return fAxes; }
59 for (
auto &&axis :
fAxes) {
60 if (
auto *
regular = std::get_if<RRegularAxis>(&axis)) {
62 }
else if (
auto *variable = std::get_if<RVariableBinAxis>(&axis)) {
65 throw std::logic_error(
"unimplemented axis type");
72 template <std::size_t
I,
typename... A>
75 const auto &axis =
fAxes[
I];
77 if (
auto *
regular = std::get_if<RRegularAxis>(&axis)) {
80 }
else if (
auto *variable = std::get_if<RVariableBinAxis>(&axis)) {
81 index *= variable->GetTotalNBins();
82 linIndex = variable->ComputeLinearizedIndex(std::get<I>(args));
84 throw std::logic_error(
"unimplemented axis type");
90 if constexpr (
I + 1 <
sizeof...(A)) {
101 template <
typename... A>
104 if (
sizeof...(A) !=
fAxes.size()) {
105 throw std::invalid_argument(
"invalid number of arguments to ComputeGlobalIndex");
114 template <std::
size_t N>
118 throw std::invalid_argument(
"invalid number of indices passed to ComputeGlobalIndex");
121 for (std::size_t i = 0; i <
N; i++) {
123 const auto &axis =
fAxes[i];
125 if (
auto *
regular = std::get_if<RRegularAxis>(&axis)) {
128 }
else if (
auto *variable = std::get_if<RVariableBinAxis>(&axis)) {
132 throw std::logic_error(
"unimplemented axis type");
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
Bin configurations for all dimensions of a histogram.
friend bool operator==(const RAxes &lhs, const RAxes &rhs)
std::size_t GetNDimensions() const
RLinearizedIndex ComputeGlobalIndex(const std::tuple< A... > &args) const
Compute the global index for all axes.
std::size_t ComputeTotalNBins() const
Compute the total number of bins for all axes.
RAxes(std::vector< RAxisVariant > axes)
void Streamer(TBuffer &)
ROOT Streamer function to throw when trying to store an object of this class.
RLinearizedIndex ComputeGlobalIndex(const std::array< RBinIndex, N > &indices) const
Compute the global index for all axes.
RLinearizedIndex ComputeGlobalIndex(std::size_t index, const std::tuple< A... > &args) const
std::vector< RAxisVariant > fAxes
const std::vector< RAxisVariant > & Get() const
Buffer base class used for serializing objects.
std::variant< RRegularAxis, RVariableBinAxis > RAxisVariant
Variant of all supported axis types.
Namespace for new ROOT classes and functions.
A linearized index that can be invalid.