ndmspc 0.20250304.0
|
#include <HnSparse.h>
Public Member Functions | |
HnSparseT () | |
Default constructor. | |
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) | |
Constructor. | |
TArray * | GenerateArray () const override |
Returns content array. | |
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 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.
|
inline |
Default constructor.
Definition at line 83 of file HnSparse.h.
|
inline |
Constructor.
Definition at line 85 of file HnSparse.h.
|
inlineoverride |
Returns content array.
Definition at line 92 of file HnSparse.h.
|
inlineinherited |
Returns output filename.
Definition at line 32 of file HnSparse.h.
References Ndmspc::Ndh::HnSparse::fOutputFileName.
|
inherited |
Import THnSparse from file
Definition at line 32 of file HnSparse.cxx.
References Ndmspc::Ndh::HnSparse::fOutputFileName, Ndmspc::Ndh::HnSparse::fTree, and Ndmspc::Ndh::HnSparse::RecursiveLoop().
|
protectedinherited |
Recursive loop
Definition at line 105 of file HnSparse.cxx.
References Ndmspc::Ndh::HnSparse::fTree, and Ndmspc::Ndh::HnSparse::RecursiveLoop().
Referenced by Ndmspc::Ndh::HnSparse::Import(), and Ndmspc::Ndh::HnSparse::RecursiveLoop().
|
inherited |
Reserve N bins
Definition at line 145 of file HnSparse.cxx.
|
inlineinherited |
Setting output file name.
Definition at line 30 of file HnSparse.h.
References Ndmspc::Ndh::HnSparse::fOutputFileName.
|
privateinherited |
Output filename.
Definition at line 41 of file HnSparse.h.
Referenced by Ndmspc::Ndh::HnSparse::GetOutputFileName(), Ndmspc::Ndh::HnSparse::Import(), and Ndmspc::Ndh::HnSparse::SetOutputFileName().
|
privateinherited |
Container.
Definition at line 40 of file HnSparse.h.
Referenced by Ndmspc::Ndh::HnSparse::Import(), and Ndmspc::Ndh::HnSparse::RecursiveLoop().