5#ifndef ROOT_RSliceBinIndexMapper
6#define ROOT_RSliceBinIndexMapper
18namespace Experimental {
35 if (
spec.GetOperationSum() ==
nullptr) {
48 throw std::invalid_argument(
"must have at least 1 slice specification");
63 throw std::invalid_argument(
"invalid number of original indices passed to RSliceBinIndexMapper::Map");
66 throw std::invalid_argument(
"invalid size of mapped indices passed to RSliceBinIndexMapper::Map");
70 for (std::size_t i = 0; i <
original.size(); i++) {
72 if (
index.IsInvalid()) {
73 throw std::invalid_argument(
"invalid bin index passed to RSliceBinIndexMapper::Map");
79 if (!
range.IsInvalid()) {
82 if (
index.IsUnderflow()) {
84 }
else if (
index.IsOverflow()) {
86 }
else if (
index.IsNormal()) {
87 const auto &begin =
range.GetBegin();
88 const auto &end =
range.GetEnd();
89 if (begin.IsNormal() &&
index < begin) {
92 }
else if (end.IsNormal() &&
index >= end) {
95 }
else if (begin.IsNormal()) {
98 index -= begin.GetIndex();
105 if (
index.IsNormal()) {
108 }
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.