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. | |
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. | |
~THnSparseCoordCompression () | |
destruct a THnSparseCoordCompression | |
Int_t | GetBufferSize () const |
ULong64_t | GetHashFromBuffer (const Char_t *buf) const |
Calculate hash from compact bin index. | |
Int_t | GetNdimensions () const |
THnSparseCoordCompression & | operator= (const THnSparseCoordCompression &other) |
Set this to other if different. | |
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. | |
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. | |
Protected Member Functions | |
Int_t | GetNumBits (Int_t n) const |
Private Attributes | |
Int_t * | fBitOffsets |
Int_t | fCoordBufferSize |
Int_t | fNdimensions |
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::THnSparseCoordCompression | ( | const THnSparseCoordCompression & | other | ) |
Construct a THnSparseCoordCompression from another one.
Definition at line 167 of file THnSparse.cxx.
THnSparseCoordCompression::~THnSparseCoordCompression | ( | ) |
destruct a THnSparseCoordCompression
Definition at line 195 of file THnSparse.cxx.
|
inline |
Definition at line 121 of file THnSparse.cxx.
Calculate hash from compact bin index.
Definition at line 317 of file THnSparse.cxx.
|
inline |
Definition at line 122 of file THnSparse.cxx.
Definition at line 127 of file THnSparse.cxx.
THnSparseCoordCompression & THnSparseCoordCompression::operator= | ( | const THnSparseCoordCompression & | other | ) |
Set this to other if different.
Definition at line 179 of file THnSparse.cxx.
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.
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.
|
private |
Definition at line 136 of file THnSparse.cxx.
|
private |
Definition at line 135 of file THnSparse.cxx.
|
private |
Definition at line 134 of file THnSparse.cxx.