16 #ifndef ROOT7_RHistBinIter
17 #define ROOT7_RHistBinIter
22 namespace Experimental {
33 template <
class HISTIMPL>
36 using HistImpl_t = HISTIMPL;
37 using CoordArray_t =
typename HISTIMPL::CoordArray_t;
38 using Weight_t =
typename HISTIMPL::Weight_t;
39 using HistBinStat_t = decltype(((HISTIMPL *)0x123)->GetStat().GetView(1));
43 HistImpl_t *fHist{
nullptr};
44 HistBinStat_t fStatView;
48 RHistBinRef(HistImpl_t &hist,
size_t idx): fIndex(idx), fHist(&hist), fStatView(hist.GetStat().GetView(idx)) {}
53 auto GetContent() {
return fStatView.GetContent(); }
56 double GetUncertainty()
const {
return fStatView.GetUncertainty(); }
60 HistBinStat_t GetStat()
const {
return fStatView; }
66 CoordArray_t GetCenter()
const {
return fHist->GetBinCenter(fIndex); }
69 CoordArray_t GetFrom()
const {
return fHist->GetBinFrom(fIndex); }
72 CoordArray_t GetTo()
const {
return fHist->GetBinTo(fIndex); }
80 template <
class HISTIMPL>
83 using Ref_t = RHistBinRef<HISTIMPL>;
85 const Ref_t &operator->() const noexcept {
return fRef; }
96 template <
class HISTIMPL>
97 class RHistBinIter:
public Internal::RIndexIter<RHistBinRef<HISTIMPL>, RHistBinPtr<HISTIMPL>> {
99 using Ref_t = RHistBinRef<HISTIMPL>;
100 using Ptr_t = RHistBinPtr<HISTIMPL>;
103 using IndexIter_t = Internal::RIndexIter<RHistBinRef<HISTIMPL>, RHistBinPtr<HISTIMPL>>;
109 RHistBinIter(HISTIMPL &hist): IndexIter_t(0), fHist(hist) {}
112 RHistBinIter(HISTIMPL &hist,
size_t idx): IndexIter_t(idx), fHist(hist) {}
116 Ref_t operator*() const noexcept {
return Ref_t{fHist, IndexIter_t::GetIndex()}; }
118 Ptr_t operator->() const noexcept {
return Ptr_t{*
this}; }