20 struct CounterRange_t {
37 ~THnBinIter()
override {
delete [] fCounter; }
40 Int_t GetCoord(
Int_t dim)
const override {
return fCounter[dim].i; }
42 THnBinIter(
const THnBinIter&) =
delete;
43 THnBinIter&
operator=(
const THnBinIter&) =
delete;
48 const TNDArray* fArray;
49 CounterRange_t* fCounter;
58 ROOT::Internal::THnBaseBinIter(respectAxisRange),
60 fCounter =
new CounterRange_t[dim]();
61 for (
Int_t i = 0; i < dim; ++i) {
63 fCounter[i].len = axis->
GetNbins() + 2;
66 fCounter[i].first = 0;
67 fCounter[i].last = fCounter[i].len - 1;
71 fHaveSkippedBin =
kTRUE;
74 if (min == 0 && max == 0) {
81 fCounter[i].first = min;
82 fCounter[i].last = max;
84 fIndex += fCounter[i].first * fCounter[i].cellSize;
87 --fCounter[dim - 1].i;
95 if (fNdimensions < 0)
return -1;
96 ++fCounter[fNdimensions - 1].i;
99 for (
Int_t d = fNdimensions - 1;
d > 0 && fCounter[
d].i > fCounter[
d].last; --
d) {
101 Int_t skippedCells = fCounter[
d].len - (fCounter[
d].last + 1);
102 skippedCells += fCounter[
d].first;
103 fIndex += skippedCells * fCounter[
d].cellSize;
104 fCounter[
d].i = fCounter[
d].first;
107 if (fCounter[0].i > fCounter[0].last) {
112 for (
Int_t d = 0;
d < fNdimensions; ++
d) {
113 coord[
d] = fCounter[
d].i;
191 const Int_t dim = axes.size();
192 std::vector<Int_t> nbins(dim);
193 for (
Int_t i = 0; i < dim; i++)
194 nbins[i] = axes.at(i).GetNbins();
199 const std::vector<std::vector<double>> &xbins)
231 for (
Long64_t ibin = 0; ibin < nbins; ++ibin)
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
const char Option_t
Option string (const char).
Binding & operator=(OUT(*fun)(void))
Iterator over THnBase bins (internal implementation).
Class to manage histogram axis.
Int_t GetLast() const
Return last bin on the axis i.e.
Int_t GetFirst() const
Return first bin on the axis i.e.
TObjArray * GetListOfAxes()
Int_t GetNdimensions() const
Bool_t GetCalculateErrors() const
Double_t fTsumw2
Total sum of weights squared; -1 if no errors are calculated.
TNDArrayT< Float_t > fArray
void AllocCoordBuf() const
Create the coordinate buffer.
void InitStorage(Int_t *nbins, Int_t chunkSize) override
Initialize the storage of a histogram created via Init().
~THn() override
Destruct a THn.
std::vector< Int_t > fCoordBuf
! Temporary buffer
TNDArrayT< Double_t > fSumw2
ROOT::Internal::THnBaseBinIter * CreateIter(Bool_t respectAxisRange) const override
Create an iterator over all bins. Public interface is THnIter.
void Reset(Option_t *option="") override
Reset the contents of a THn.
void Sumw2() override
Enable calculation of errors.
Long64_t GetNbins() const override
virtual const TNDArray & GetArray() const =0
virtual Double_t AtAsDouble(ULong64_t linidx) const =0
Long64_t GetCellSize(Int_t dim) const
virtual void Init(Int_t ndim, const Int_t *nbins, bool addOverflow=false)
virtual void Reset(Option_t *option="")=0
TObject * At(Int_t idx) const override
Bool_t TestBit(UInt_t f) const