File indexing completed on 2025-01-18 10:12:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_THnSparse_Internal
0013 #define ROOT_THnSparse_Internal
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "TArrayD.h"
0023
0024 #include "TObject.h"
0025
0026 class TBrowser;
0027 class TH1;
0028 class THnSparse;
0029
0030 class THnSparseArrayChunk: public TObject {
0031 private:
0032
0033 THnSparseArrayChunk(const THnSparseArrayChunk&) = delete;
0034 THnSparseArrayChunk& operator=(const THnSparseArrayChunk&) = delete;
0035
0036 public:
0037 THnSparseArrayChunk():
0038 fCoordinateAllocationSize(-1), fSingleCoordinateSize(0), fCoordinatesSize(0), fCoordinates(nullptr),
0039 fContent(nullptr), fSumw2(nullptr) {}
0040
0041 THnSparseArrayChunk(Int_t coordsize, bool errors, TArray* cont);
0042 ~THnSparseArrayChunk() override;
0043
0044 Int_t fCoordinateAllocationSize;
0045 Int_t fSingleCoordinateSize;
0046 Int_t fCoordinatesSize;
0047 Char_t *fCoordinates;
0048 TArray *fContent;
0049 TArrayD *fSumw2;
0050
0051 void AddBin(Int_t idx, const Char_t* idxbuf);
0052 void AddBinContent(Int_t idx, Double_t v = 1.) {
0053 fContent->SetAt(v + fContent->GetAt(idx), idx);
0054 if (fSumw2)
0055 fSumw2->SetAt(v * v + fSumw2->GetAt(idx), idx);
0056 }
0057 void Sumw2();
0058 Int_t GetEntries() const { return fCoordinatesSize / fSingleCoordinateSize; }
0059
0060
0061
0062
0063 Bool_t Matches(Int_t idx, const Char_t* idxbuf) const {
0064 return fSingleCoordinateSize <= 8 ||
0065 !memcmp(fCoordinates + idx * fSingleCoordinateSize, idxbuf, fSingleCoordinateSize); }
0066
0067 ClassDefOverride(THnSparseArrayChunk, 1);
0068 };
0069 #endif
0070