62 Int_t overBins = addOverflow ? 2 : 0;
64 for (
Int_t i = 0; i < ndim; ++i) {
65 fSizes[ndim - i - 1] =
fSizes[ndim - i] * (nbins[ndim - i - 1] + overBins);
79 bin +=
fSizes[d + 1] * idx[d];
102 fData(data),
fSizes(sizes) {}
110 if (!fData)
return T();
111 R__ASSERT(
fSizes == 0 &&
"Element operator can only be used on non-array element. Missing an operator[] level?");
121 template <
typename T>
128 fNumData(), fData() {
147 new (fData)
T[fNumData]();
166 if (!fData)
return T();
167 return fData[linidx];
170 if (!fData) fData =
new T[fNumData]();
171 return fData[linidx];
175 if (!fData)
return 0.;
176 return fData[linidx];
179 if (!fData) fData =
new T[fNumData]();
180 fData[linidx] = (
T) value;
183 if (!fData) fData =
new T[fNumData]();
184 fData[linidx] += (
T) value;
205 #endif // ROOT_TNDArray TNDArrayT(Int_t ndim, const Int_t *nbins, bool addOverflow=false)
virtual Double_t AtAsDouble(ULong64_t linidx) const =0
Buffer base class used for serializing objects.
void SetAsDouble(ULong64_t linidx, Double_t value)
virtual void SetAsDouble(ULong64_t linidx, Double_t value)=0
Long64_t GetNbins() const
TNDArray & operator=(const TNDArray &)
void Init(Int_t ndim, const Int_t *nbins, bool addOverflow=false)
#define ClassDef(name, id)
virtual void Reset(Option_t *option="")=0
void Streamer(TBuffer &R__b)
TNDArray(Int_t ndim, const Int_t *nbins, bool addOverflow=false)
T At(const Int_t *idx) const
void Reset(Option_t *="")
#define ClassDefNV(name, id)
void AddAt(ULong64_t linidx, Double_t value)
The ROOT global object gROOT contains a list of all defined classes.
TNDArrayRef< T > operator[](Int_t idx) const
TNDArrayRef(const T *data, const Long64_t *sizes)
unsigned long long ULong64_t
Double_t AtAsDouble(ULong64_t linidx) const
virtual void Init(Int_t ndim, const Int_t *nbins, bool addOverflow=false)
Mother of all ROOT objects.
Int_t GetNdimensions() const
Long64_t GetBin(const Int_t *idx) const
Long64_t GetCellSize(Int_t dim) const
T At(ULong64_t linidx) const
virtual void AddAt(ULong64_t linidx, Double_t value)=0