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;
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 ClassDef(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
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)
Multidimensional histogram.
void AllocCoordBuf() const
Create the coordinate buffer.
void FillBin(Long64_t bin, Double_t w)
Increment the bin content of "bin" by "w", return the bin index.
Double_t GetBinError2(Long64_t linidx) const
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)
Initialize the storage of a histogram created via Init()
static THn * CreateHn(const char *name, const char *title, const TH1 *h1)
void AddBinContent(Long64_t bin, Double_t v=1.)
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) const
Long64_t GetBin(const char *name[], Bool_t=kTRUE)
void SetBinContent(Long64_t bin, Double_t v)
Long64_t GetBin(const char *name[]) const
TH2D * Projection(Int_t yDim, Int_t xDim, Option_t *option="") const
Forwards to THnBase::Projection().
THn * Rebin(const Int_t *group) const
virtual ~THn()
Destruct a THn.
static THn * CreateHn(const char *name, const char *title, const THnBase *hn)
Long64_t GetBin(const Int_t *idx, Bool_t=kTRUE)
std::vector< Int_t > fCoordBuf
TNDArrayT< Double_t > fSumw2
void SetBinContent(const Int_t *idx, Double_t v)
Forwards to THnBase::SetBinContent().
Double_t GetBinContent(Long64_t bin, Int_t *idx=0) const
Get the content of bin, and set its index if idx is != 0.
void Reset(Option_t *option="")
Reset the contents of a THn.
Long64_t GetBin(const Double_t *x, Bool_t=kTRUE)
Long64_t GetNbins() const
TH3D * Projection(Int_t xDim, Int_t yDim, Int_t zDim, Option_t *option="") const
Forwards to THnBase::Projection().
void AddBinError2(Long64_t bin, Double_t e2)
virtual TNDArray & GetArray()=0
void Sumw2()
Enable calculation of errors.
virtual const TNDArray & GetArray() const =0
Long64_t GetBin(const Double_t *x) const
THn * Projection(Int_t ndim, const Int_t *dim, Option_t *option="") const
ROOT::Internal::THnBaseBinIter * CreateIter(Bool_t respectAxisRange) const
Create an iterator over all bins. Public interface is THnIter.
void SetBinError2(Long64_t bin, Double_t e2)
void AddAt(ULong64_t linidx, Double_t value)
T At(const Int_t *idx) 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