ndh 0.0.7
Loading...
Searching...
No Matches
NDH::HnSparseT< CONT > Class Template Reference

#include <HnSparse.hh>

Inheritance diagram for NDH::HnSparseT< CONT >:
NDH::HnSparse

Public Member Functions

 HnSparseT ()
 Default constructor.
 
 HnSparseT (const char *name, const char *title, Int_t dim, const Int_t *nbins, const Double_t *xmin=0, const Double_t *xmax=0, Int_t chunksize=1024 *16)
 
TArray * GenerateArray () const
 Generate array for container.
 
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.
 

Detailed Description

template<class CONT>
class 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> THnSparseC Char_t
HnSparseT<TArrayS> THnSparseS Short_t
HnSparseT<TArrayI> THnSparseI Int_t
HnSparseT<TArrayL> THnSparseL Long_t
HnSparseT<TArrayF> THnSparseF Float_t
HnSparseT<TArrayD> THnSparseD 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 79 of file HnSparse.hh.

Constructor & Destructor Documentation

◆ HnSparseT() [1/2]

template<class CONT >
NDH::HnSparseT< CONT >::HnSparseT ( )
inline

Default constructor.

Definition at line 82 of file HnSparse.hh.

◆ HnSparseT() [2/2]

template<class CONT >
NDH::HnSparseT< CONT >::HnSparseT ( const char * name,
const char * title,
Int_t dim,
const Int_t * nbins,
const Double_t * xmin = 0,
const Double_t * xmax = 0,
Int_t chunksize = 1024 * 16 )
inline

Constructor

Definition at line 83 of file HnSparse.hh.

Member Function Documentation

◆ GenerateArray()

template<class CONT >
TArray * NDH::HnSparseT< CONT >::GenerateArray ( ) const
inline

Generate array for container.

Definition at line 93 of file HnSparse.hh.

◆ GetOutputFileName()

TString NDH::HnSparse::GetOutputFileName ( ) const
inlineinherited

Returns output filename.

Definition at line 31 of file HnSparse.hh.

References NDH::HnSparse::fOutputFileName.

◆ Import()

Bool_t 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.cc.

References NDH::HnSparse::fOutputFileName, NDH::HnSparse::fTree, and NDH::HnSparse::RecursiveLoop().

◆ RecursiveLoop()

bool 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 103 of file HnSparse.cc.

References NDH::HnSparse::fTree, and NDH::HnSparse::RecursiveLoop().

Referenced by NDH::HnSparse::Import(), and NDH::HnSparse::RecursiveLoop().

◆ ReserveBins()

void NDH::HnSparse::ReserveBins ( Long64_t nBins)
inherited

Reserve N bins

Definition at line 143 of file HnSparse.cc.

◆ SetOutputFileName()

void NDH::HnSparse::SetOutputFileName ( const char * fn)
inlineinherited

Setting output file name.

Definition at line 29 of file HnSparse.hh.

References NDH::HnSparse::fOutputFileName.

Member Data Documentation

◆ fOutputFileName

TString NDH::HnSparse::fOutputFileName {"ndh.root"}
privateinherited

Output filename.

Definition at line 40 of file HnSparse.hh.

Referenced by NDH::HnSparse::GetOutputFileName(), NDH::HnSparse::Import(), and NDH::HnSparse::SetOutputFileName().

◆ fTree

TTree* NDH::HnSparse::fTree {nullptr}
privateinherited

Container.

Definition at line 39 of file HnSparse.hh.

Referenced by NDH::HnSparse::Import(), and NDH::HnSparse::RecursiveLoop().


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