#ifndef ROOT_THnSparse_Internal
#define ROOT_THnSparse_Internal
#ifndef ROOT_TArrayD
#include "TArrayD.h"
#endif
class TBrowser;
class TH1;
class THnSparse;
class THnSparseArrayChunk: public TObject {
private:
THnSparseArrayChunk(const THnSparseArrayChunk&);
THnSparseArrayChunk& operator=(const THnSparseArrayChunk&);
public:
THnSparseArrayChunk():
fCoordinateAllocationSize(-1), fSingleCoordinateSize(0), fCoordinatesSize(0), fCoordinates(0),
fContent(0), fSumw2(0) {}
THnSparseArrayChunk(Int_t coordsize, bool errors, TArray* cont);
virtual ~THnSparseArrayChunk();
Int_t fCoordinateAllocationSize;
Int_t fSingleCoordinateSize;
Int_t fCoordinatesSize;
Char_t *fCoordinates;
TArray *fContent;
TArrayD *fSumw2;
void AddBin(Int_t idx, const Char_t* idxbuf);
void AddBinContent(Int_t idx, Double_t v = 1.) {
fContent->SetAt(v + fContent->GetAt(idx), idx);
if (fSumw2)
fSumw2->SetAt(v * v+ fSumw2->GetAt(idx), idx);
}
void Sumw2();
Int_t GetEntries() const { return fCoordinatesSize / fSingleCoordinateSize; }
Bool_t Matches(Int_t idx, const Char_t* idxbuf) const {
return fSingleCoordinateSize <= 8 ||
!memcmp(fCoordinates + idx * fSingleCoordinateSize, idxbuf, fSingleCoordinateSize); }
ClassDef(THnSparseArrayChunk, 1);
};
namespace ROOT {
class THnSparseBrowsable: public TNamed {
public:
THnSparseBrowsable(THnSparse* hist, Int_t axis);
~THnSparseBrowsable();
void Browse(TBrowser *b);
Bool_t IsFolder() const { return kFALSE; }
private:
THnSparse* fHist;
Int_t fAxis;
TH1* fProj;
ClassDef(THnSparseBrowsable, 0);
};
};
#endif // ROOT_THnSparse_Internal