41 const std::vector<std::vector<double>> &xbins);
77 return const_cast<const THn*
>(
this)->
GetBin(idx);
80 return const_cast<const THn*
>(
this)->
GetBin(
x);
130 idx[i] = (bin % prevCellSize) / cellSize;
131 prevCellSize = cellSize;
143 void Sumw2()
override;
227 fArray(dim, nbins, true) {}
230 const std::vector<std::vector<double>> &xbins)
231 :
THn(
name, title, dim, nbins, xbins),
fArray(dim, nbins, true)
#define ClassDefOverride(name, id)
Iterator over THnBase bins (internal implementation).
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
virtual Int_t FindFixBin(Double_t x) const
Find bin number corresponding to abscissa x.
1-D histogram with a double per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
2-D histogram with a double per channel (see TH1 documentation)
3-D histogram with a double per channel (see TH1 documentation)
Multidimensional histogram base.
void AddBinContent(const Int_t *x, Double_t v=1.)
TH1D * Projection(Int_t xDim, Option_t *option="") const
Project all bins into a 1-dimensional histogram, keeping only axis "xDim".
Int_t GetNdimensions() const
static THnBase * CreateHnAny(const char *name, const char *title, const TH1 *h1, Bool_t sparse, Int_t chunkSize=1024 *16)
Create a THn / THnSparse object from a histogram deriving from TH1.
THnBase * RebinBase(Int_t group) const
Combine the content of "group" neighboring bins into a new bin and return the resulting THnBase.
THnBase * ProjectionND(Int_t ndim, const Int_t *dim, Option_t *option="") const
Bool_t GetCalculateErrors() const
Double_t GetBinContent(const Int_t *idx) const
void SetBinContent(const Int_t *idx, Double_t v)
TAxis * GetAxis(Int_t dim) const
Int_t fNdimensions
Number of dimensions.
void FillBinBase(Double_t w)
Increment the statistics due to filled weight "w",.
Efficient multidimensional histogram.
Templated implementation of the abstract base THn.
const TNDArray & GetArray() const override
TNDArrayT< T > fArray
Bin content.
THnT(const char *name, const char *title, Int_t dim, const Int_t *nbins, const Double_t *xmin, const Double_t *xmax)
THnT(const char *name, const char *title, Int_t dim, const Int_t *nbins, const std::vector< std::vector< double > > &xbins)
TNDArray & GetArray() override
Multidimensional histogram.
void AllocCoordBuf() const
Create the coordinate buffer.
void FillBin(Long64_t bin, Double_t w) override
Increment the bin content of "bin" by "w", return the bin index.
TH1D * Projection(Int_t xDim, Option_t *option="") const
Forwards to THnBase::Projection().
void AddBinContent(const Int_t *idx, Double_t v=1.)
Forwards to THnBase::SetBinContent().
void InitStorage(Int_t *nbins, Int_t chunkSize) override
Initialize the storage of a histogram created via Init()
Long64_t GetBin(const char *name[], Bool_t=kTRUE) override
static THn * CreateHn(const char *name, const char *title, const TH1 *h1)
THn * Rebin(Int_t group) const
Double_t GetBinContent(const Int_t *idx) const
Forwards to THnBase::GetBinContent() overload.
Long64_t GetBin(const Int_t *idx, Bool_t=kTRUE) override
Long64_t GetBin(const Double_t *x, Bool_t=kTRUE) override
~THn() override
Destruct a THn.
TH2D * Projection(Int_t yDim, Int_t xDim, Option_t *option="") const
Forwards to THnBase::Projection().
void AddBinError2(Long64_t bin, Double_t e2) override
THn * Rebin(const Int_t *group) const
static THn * CreateHn(const char *name, const char *title, const THnBase *hn)
std::vector< Int_t > fCoordBuf
TNDArrayT< Double_t > fSumw2
void SetBinContent(const Int_t *idx, Double_t v)
Forwards to THnBase::SetBinContent().
void SetBinError2(Long64_t bin, Double_t e2) override
Double_t GetBinContent(Long64_t bin, Int_t *idx=nullptr) const override
Get the content of bin, and set its index if idx is != 0.
Double_t GetBinError2(Long64_t linidx) const override
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.
Long64_t GetBin(const Int_t *idx) const override
Long64_t GetBin(const char *name[]) const override
void Sumw2() override
Enable calculation of errors.
Long64_t GetBin(const Double_t *x) const override
void AddBinContent(Long64_t bin, Double_t v=1.) override
Long64_t GetNbins() const override
TH3D * Projection(Int_t xDim, Int_t yDim, Int_t zDim, Option_t *option="") const
Forwards to THnBase::Projection().
void SetBinContent(Long64_t bin, Double_t v) override
virtual TNDArray & GetArray()=0
virtual const TNDArray & GetArray() const =0
THn * Projection(Int_t ndim, const Int_t *dim, Option_t *option="") const
virtual void AddAt(ULong64_t linidx, Double_t value)=0
virtual Double_t AtAsDouble(ULong64_t linidx) const =0
Long64_t GetNbins() const
Long64_t GetCellSize(Int_t dim) const
Long64_t GetBin(const Int_t *idx) const
virtual void SetAsDouble(ULong64_t linidx, Double_t value)=0