ndmspc  0.20250128.0
Ndmspc::Ndh::HnSparseT< CONT > Class Template Reference

#include <HnSparse.h>

Inheritance diagram for Ndmspc::Ndh::HnSparseT< CONT >:
Ndmspc::Ndh::HnSparse

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.
 

Detailed Description

template<class CONT>
class Ndmspc::Ndh::HnSparseT< CONT >

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.

Member Function Documentation

◆ Import()

Bool_t Ndmspc::Ndh::HnSparse::Import ( std::vector< Int_t >  r,
TString  filename,
TString  objname,
TString  cacheDir = gSystem->HomeDirectory() 
)
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().

◆ RecursiveLoop()

bool Ndmspc::Ndh::HnSparse::RecursiveLoop ( THnSparse *  s,
Int_t  level,
Int_t *  coord,
Int_t *  dims,
std::vector< Int_t > &  r 
)
protectedinherited

Recursive loop

Definition at line 105 of file HnSparse.cxx.

References Ndmspc::Ndh::HnSparse::fTree.

Referenced by Ndmspc::Ndh::HnSparse::Import().

◆ ReserveBins()

void Ndmspc::Ndh::HnSparse::ReserveBins ( Long64_t  nBins)
inherited

Reserve N bins

Definition at line 145 of file HnSparse.cxx.


The documentation for this class was generated from the following file: