Logo ROOT  
Reference Guide
THnSparseCoordCompression Class Reference

THnSparseCoordCompression is a class used by THnSparse internally.

It represents a compacted n-dimensional array of bin coordinates (indices). As the total number of bins in each dimension is known by THnSparse, bin indices can be compacted to only use the amount of bins needed by the total number of bins in each dimension. E.g. for a THnSparse with {15, 100, 2, 20, 10, 100} bins per dimension, a bin index will only occupy 28 bits (4+7+1+5+4+7), i.e. less than a 32bit integer. The tricky part is the fast compression and decompression, the platform-independent storage (think of endianness: the bits of the number 0x123456 depend on the platform), and the hashing needed by THnSparseArrayChunk.

Definition at line 112 of file THnSparse.cxx.

Public Member Functions

 THnSparseCoordCompression (const THnSparseCoordCompression &other)
 Construct a THnSparseCoordCompression from another one. More...
 
 THnSparseCoordCompression (Int_t dim, const Int_t *nbins)
 Initialize a THnSparseCoordCompression object with "dim" dimensions and "bins" holding the number of bins for each dimension; it stores the. More...
 
 ~THnSparseCoordCompression ()
 destruct a THnSparseCoordCompression More...
 
Int_t GetBufferSize () const
 
ULong64_t GetHashFromBuffer (const Char_t *buf) const
 Calculate hash from compact bin index. More...
 
Int_t GetNdimensions () const
 
THnSparseCoordCompressionoperator= (const THnSparseCoordCompression &other)
 Set this to other if different. More...
 
ULong64_t SetBufferFromCoord (const Int_t *coord_in, Char_t *buf_out) const
 Given the cbin coordinates coord_in, calculate ("compact") the bin coordinates and return them in buf_in. More...
 
void SetCoordFromBuffer (const Char_t *buf_in, Int_t *coord_out) const
 Given the compressed coordinate buffer buf_in, calculate ("decompact") the bin coordinates and return them in coord_out. More...
 

Protected Member Functions

Int_t GetNumBits (Int_t n) const
 

Private Attributes

Int_tfBitOffsets
 
Int_t fCoordBufferSize
 
Int_t fNdimensions
 
Inheritance diagram for THnSparseCoordCompression:
[legend]

Constructor & Destructor Documentation

◆ THnSparseCoordCompression() [1/2]

THnSparseCoordCompression::THnSparseCoordCompression ( Int_t  dim,
const Int_t nbins 
)

Initialize a THnSparseCoordCompression object with "dim" dimensions and "bins" holding the number of bins for each dimension; it stores the.

Definition at line 149 of file THnSparse.cxx.

◆ THnSparseCoordCompression() [2/2]

THnSparseCoordCompression::THnSparseCoordCompression ( const THnSparseCoordCompression other)

Construct a THnSparseCoordCompression from another one.

Definition at line 167 of file THnSparse.cxx.

◆ ~THnSparseCoordCompression()

THnSparseCoordCompression::~THnSparseCoordCompression ( )

destruct a THnSparseCoordCompression

Definition at line 195 of file THnSparse.cxx.

Member Function Documentation

◆ GetBufferSize()

Int_t THnSparseCoordCompression::GetBufferSize ( ) const
inline

Definition at line 121 of file THnSparse.cxx.

◆ GetHashFromBuffer()

ULong64_t THnSparseCoordCompression::GetHashFromBuffer ( const Char_t buf) const

Calculate hash from compact bin index.

Definition at line 317 of file THnSparse.cxx.

◆ GetNdimensions()

Int_t THnSparseCoordCompression::GetNdimensions ( ) const
inline

Definition at line 122 of file THnSparse.cxx.

◆ GetNumBits()

Int_t THnSparseCoordCompression::GetNumBits ( Int_t  n) const
inlineprotected

Definition at line 127 of file THnSparse.cxx.

◆ operator=()

THnSparseCoordCompression & THnSparseCoordCompression::operator= ( const THnSparseCoordCompression other)

Set this to other if different.

Definition at line 179 of file THnSparse.cxx.

◆ SetBufferFromCoord()

ULong64_t THnSparseCoordCompression::SetBufferFromCoord ( const Int_t coord_in,
Char_t buf_out 
) const

Given the cbin coordinates coord_in, calculate ("compact") the bin coordinates and return them in buf_in.

Return the hash value.

Definition at line 233 of file THnSparse.cxx.

◆ SetCoordFromBuffer()

void THnSparseCoordCompression::SetCoordFromBuffer ( const Char_t buf_in,
Int_t coord_out 
) const

Given the compressed coordinate buffer buf_in, calculate ("decompact") the bin coordinates and return them in coord_out.

Definition at line 205 of file THnSparse.cxx.

Member Data Documentation

◆ fBitOffsets

Int_t* THnSparseCoordCompression::fBitOffsets
private

Definition at line 136 of file THnSparse.cxx.

◆ fCoordBufferSize

Int_t THnSparseCoordCompression::fCoordBufferSize
private

Definition at line 135 of file THnSparse.cxx.

◆ fNdimensions

Int_t THnSparseCoordCompression::fNdimensions
private

Definition at line 134 of file THnSparse.cxx.


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