File indexing completed on 2026-08-16 09:21:23
0001
0002
0003
0004
0005 #ifndef ROOT_RSliceSpec
0006 #define ROOT_RSliceSpec
0007
0008 #include "RBinIndexRange.hxx"
0009
0010 #include <cstdint>
0011 #include <stdexcept>
0012 #include <utility>
0013 #include <variant>
0014
0015 namespace ROOT {
0016 namespace Experimental {
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 class RSliceSpec final {
0041 public:
0042
0043 class ROperationRebin final {
0044 std::uint64_t fNGroup = 1;
0045
0046 public:
0047
0048 ROperationRebin(std::uint64_t nGroup) : fNGroup(nGroup)
0049 {
0050 if (nGroup == 0) {
0051 throw std::invalid_argument("nGroup must be > 0");
0052 }
0053 }
0054
0055 std::uint64_t GetNGroup() const { return fNGroup; }
0056 };
0057
0058
0059 class ROperationSum final {
0060
0061 };
0062
0063 private:
0064
0065 RBinIndexRange fRange;
0066
0067 std::variant<std::monostate, ROperationRebin, ROperationSum> fOperation;
0068
0069 public:
0070
0071 RSliceSpec() = default;
0072
0073
0074
0075
0076 RSliceSpec(RBinIndexRange range) : fRange(std::move(range)) {}
0077
0078
0079 RSliceSpec(ROperationRebin rebin) : fOperation(std::move(rebin)) {}
0080
0081
0082 RSliceSpec(ROperationSum sum) : fOperation(std::move(sum)) {}
0083
0084
0085 RSliceSpec(RBinIndexRange range, ROperationRebin rebin) : fRange(std::move(range)), fOperation(std::move(rebin)) {}
0086
0087
0088 RSliceSpec(RBinIndexRange range, ROperationSum sum) : fRange(std::move(range)), fOperation(std::move(sum)) {}
0089
0090 const RBinIndexRange &GetRange() const { return fRange; }
0091 bool HasOperation() const { return !std::holds_alternative<std::monostate>(fOperation); }
0092 const ROperationRebin *GetOperationRebin() const { return std::get_if<ROperationRebin>(&fOperation); }
0093 const ROperationSum *GetOperationSum() const { return std::get_if<ROperationSum>(&fOperation); }
0094 };
0095
0096 }
0097 }
0098
0099 #endif