16 #ifndef ROOT7_RHistView
17 #define ROOT7_RHistView
22 namespace Experimental {
40 template <
class HISTVIEW>
41 struct RHistViewOutOfRange {
43 bool operator()(
int idx) {
return fHistView.IsBinOutOfRange(idx); }
50 template <
int DIMENSIONS,
class PRECISION,
template <
int D_,
class P_>
class... STAT>
53 using Hist_t = RHist<DIMENSIONS, PRECISION, STAT...>;
54 using AxisRange_t =
typename Hist_t::AxisIterRange_t;
55 using HistViewOutOfRange_t = RHistViewOutOfRange<RHistView>;
57 using const_iterator = Detail::RHistBinIter<typename Hist_t::ImplBase_t>;
59 RHistView(Hist_t &hist,
int nbins,
const AxisRange_t &range): fHist(hist), fNBins(nbins), fRange(range) {}
61 bool IsBinOutOfRange(
int idx)
const noexcept
64 return idx < 0 || idx > fNBins;
67 void SetRange(
int axis,
double from,
double to)
69 RAxisView axisView = fHist.GetImpl()->GetAxis(axis);
70 fRange[axis] = axisView.FindBin(from);
71 fRange[axis] = axisView.FindBin(to);
74 const_iterator begin() const noexcept
77 size_t nbins = fHist.GetNBins();
78 while (IsBinOutOfRange(beginidx) && beginidx < nbins)
80 return const_iterator(beginidx, HistViewOutOfRange_t(*
this));
83 const_iterator end() const noexcept {
return const_iterator(fHist.GetImpl(), fHist.GetImpl().GetNBins()); }