diff --git a/hist/inc/THnSparse.h b/hist/inc/THnSparse.h index a3094f2ae4be364da5e733a35c2e49d959001d92..e0dce0b06f022fcedf25f0c9990247d2d880a013 100644 --- a/hist/inc/THnSparse.h +++ b/hist/inc/THnSparse.h @@ -227,6 +227,38 @@ class THnSparse: public TNamed { ClassDef(THnSparse, 1); // Interfaces of sparse n-dimensional histogram }; + + +//______________________________________________________________________________ +// +// 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 parematers with ROOT's generic types: +// +// Templated name Typedef Bin content type +// THnSparseT<TArrayC> THnSparseC Char_r +// THnSparseT<TArrayS> THnSparseS Short_t +// THnSparseT<TArrayI> THnSparseI Int_t +// THnSparseT<TArrayL> THnSparseL Long_t +// THnSparseT<TArrayF> THnSparseF Float_t +// THnSparseT<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 +// enourmous 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. +//______________________________________________________________________________ + template <class CONT> class THnSparseT: public THnSparse { public: