5#ifndef ROOT_RSliceBinIndexMapper
6#define ROOT_RSliceBinIndexMapper
19namespace Experimental {
36 if (
spec.GetOperationSum() ==
nullptr) {
49 throw std::invalid_argument(
"must have at least 1 slice specification");
64 throw std::invalid_argument(
"invalid number of original indices passed to RSliceBinIndexMapper::Map");
67 throw std::invalid_argument(
"invalid size of mapped indices passed to RSliceBinIndexMapper::Map");
71 for (std::size_t i = 0; i <
original.size(); i++) {
73 if (
index.IsInvalid()) {
74 throw std::invalid_argument(
"invalid bin index passed to RSliceBinIndexMapper::Map");
80 if (!
range.IsInvalid()) {
83 if (
index.IsUnderflow()) {
85 }
else if (
index.IsOverflow()) {
87 }
else if (
index.IsNormal()) {
88 const auto &begin =
range.GetBegin();
89 const auto &end =
range.GetEnd();
90 if (begin.IsNormal() &&
index < begin) {
93 }
else if (end.IsNormal() &&
index >= end) {
96 }
else if (begin.IsNormal()) {
99 index -= begin.GetIndex();
106 if (
index.IsNormal()) {
109 }
else if (
sliceSpec.GetOperationSum() !=
nullptr) {
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
Mapper of bin indices for slice operations.
bool Map(const std::vector< RBinIndex > &original, std::vector< RBinIndex > &mapped) const
Map a vector of RBinIndex according to the slice specifications.
RSliceBinIndexMapper(std::vector< RSliceSpec > sliceSpecs)
const std::vector< RSliceSpec > & GetSliceSpecs() const
std::size_t GetMappedDimensionality() const
std::size_t fMappedDimensionality
The expected dimensionality of the mapped indices.
std::vector< RSliceSpec > fSliceSpecs
The requested slice specifications.
static std::size_t ComputeMappedDimensionality(const std::vector< RSliceSpec > &sliceSpecs)
A bin index with special values for underflow and overflow bins.
static RBinIndex Overflow()
static RBinIndex Underflow()
Specification of a slice operation along one dimension.