ndmspc 0.20250128.0
Loading...
Searching...
No Matches
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.

Constructor & Destructor Documentation

◆ HnSparseT() [1/2]

template<class CONT >
Ndmspc::Ndh::HnSparseT< CONT >::HnSparseT ( )
inline

Definition at line 82 of file HnSparse.h.

◆ HnSparseT() [2/2]

template<class CONT >
Ndmspc::Ndh::HnSparseT< CONT >::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 )
inline

Definition at line 83 of file HnSparse.h.

Member Function Documentation

◆ GenerateArray()

template<class CONT >
TArray * Ndmspc::Ndh::HnSparseT< CONT >::GenerateArray ( ) const
inlineoverride

Definition at line 89 of file HnSparse.h.

◆ GetOutputFileName()

TString Ndmspc::Ndh::HnSparse::GetOutputFileName ( ) const
inlineinherited

Returns output filename.

Definition at line 32 of file HnSparse.h.

References Ndmspc::Ndh::HnSparse::fOutputFileName.

◆ 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

◆ ReserveBins()

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

Reserve N bins

Definition at line 145 of file HnSparse.cxx.

◆ SetOutputFileName()

void Ndmspc::Ndh::HnSparse::SetOutputFileName ( const char * fn)
inlineinherited

Setting output file name.

Definition at line 30 of file HnSparse.h.

References Ndmspc::Ndh::HnSparse::fOutputFileName.

Member Data Documentation

◆ fOutputFileName

TString Ndmspc::Ndh::HnSparse::fOutputFileName {"ndh.root"}
privateinherited

◆ fTree

TTree* Ndmspc::Ndh::HnSparse::fTree {nullptr}
privateinherited

Container.

Definition at line 40 of file HnSparse.h.

Referenced by Ndmspc::Ndh::HnSparse::Import(), and Ndmspc::Ndh::HnSparse::RecursiveLoop().


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