ndmspc
0.20240624.0
|
#include <HnSparse.h>
Public Member Functions | |
HnSparseT (const char *name, const char *title, Int_t dim, const Int_t *nbins, const Double_t *xmin=nullptr, const Double_t *xmax=nullptr, Int_t chunksize=1024 *16) | |
TArray * | GenerateArray () const override |
Bool_t | Import (std::vector< Int_t > r, TString filename, TString objname, TString cacheDir=gSystem->HomeDirectory()) |
void | SetOutputFileName (const char *fn) |
Setting output file name. | |
TString | GetOutputFileName () const |
Returns output filename. | |
void | ReserveBins (Long64_t nBins) |
Protected Member Functions | |
bool | RecursiveLoop (THnSparse *s, Int_t level, Int_t *coord, Int_t *dims, std::vector< Int_t > &r) |
Private Member Functions | |
ClassDefOverride (HnSparseT, 1) | |
Private Attributes | |
TTree * | fTree {nullptr} |
Container. | |
TString | fOutputFileName {"ndh.root"} |
Output filename. | |
Templated implementation of the abstract base THnSparse. All functionality and the interfaces to be used are in THnSparse!
THnSparse does not know how to store any bin content itself. Instead, this is delegated to the derived, templated class: the template parameter decides what the format for the bin content is. In fact it even defines the array itself; possible implementations probably derive from TArray.
Typedefs exist for template parameters with ROOT's generic types:
Templated name | Typedef | Bin content type |
---|---|---|
HnSparseT<TArrayC> | HnSparseC | Char_t |
HnSparseT<TArrayS> | HnSparseS | Short_t |
HnSparseT<TArrayI> | HnSparseI | Int_t |
HnSparseT<TArrayL64> | HnSparseL | Long64_t |
HnSparseT<TArrayF> | HnSparseF | Float_t |
HnSparseT<TArrayD> | HnSparseD | Double_t |
We recommend to use THnSparseC wherever possible, and to map its value space of 256 possible values to e.g. float values outside the class. This saves an enormous amount of memory. Only if more than 256 values need to be distinguished should e.g. THnSparseS or even THnSparseF be chosen.
Implementation detail: the derived, templated class is kept extremely small on purpose. That way the (templated thus inlined) uses of this class will only create a small amount of machine code, in contrast to e.g. STL.
Definition at line 80 of file HnSparse.h.
|
inherited |
Import THnSparse from file
Definition at line 32 of file HnSparse.cxx.
References NDH::HnSparse::fOutputFileName, NDH::HnSparse::fTree, and NDH::HnSparse::RecursiveLoop().
|
protectedinherited |
Recursive loop
Definition at line 105 of file HnSparse.cxx.
References NDH::HnSparse::fTree.
Referenced by NDH::HnSparse::Import().
|
inherited |
Reserve N bins
Definition at line 145 of file HnSparse.cxx.