58 const unsigned int m = 0x5bd1e995;
61 unsigned int h =
len ^ 0xdeadbeef;
63 const unsigned char*
data = (
const unsigned char*)
key;
66 unsigned int k = *(
unsigned int*)
data;
98 extended_pattern[0] = (
unsigned char)nRow;
99 extended_pattern[1] = (
unsigned char)nCol;
100 int nBits = nRow * nCol;
101 int nBytes = nBits / 8;
102 if (nBits % 8 != 0) {
105 memcpy(&extended_pattern[2], patt, nBytes);
107 unsigned long partialHash = (
unsigned long)
hashFunction(extended_pattern, nBytes);
109 unsigned long completeHash = partialHash << 32;
113 completeHash += ((((
unsigned long)extended_pattern[2]) << 24));
114 }
else if (nBytes == 2) {
115 completeHash += ((((
unsigned long)extended_pattern[2]) << 24) + (((
unsigned long)extended_pattern[3]) << 16));
116 }
else if (nBytes == 3) {
117 completeHash += ((((
unsigned long)extended_pattern[2]) << 24) + (((
unsigned long)extended_pattern[3]) << 16) +
118 (((
unsigned long)extended_pattern[4]) << 8));
119 }
else if (nBytes >= 4) {
120 completeHash += ((((
unsigned long)extended_pattern[2]) << 24) + (((
unsigned long)extended_pattern[3]) << 16) +
121 (((
unsigned long)extended_pattern[4]) << 8) + ((
unsigned long)extended_pattern[5]));
123 LOG(error) <<
"No fired pixels in small topology";
124 throw std::runtime_error(
"No fired pixels in small topology");
133 unsigned long partialHash = (
unsigned long)
hashFunction(patt.data(), nBytesUsed);
135 unsigned long completeHash = partialHash << 32;
138 if (nBytesUsed == 1) {
139 completeHash += ((((
unsigned long)patt[2]) << 24));
140 }
else if (nBytesUsed == 2) {
141 completeHash += ((((
unsigned long)patt[2]) << 24) + (((
unsigned long)patt[3]) << 16));
142 }
else if (nBytesUsed == 3) {
144 ((((
unsigned long)patt[2]) << 24) + (((
unsigned long)patt[3]) << 16) + (((
unsigned long)patt[4]) << 8));
145 }
else if (nBytesUsed >= 4) {
146 completeHash += ((((
unsigned long)patt[2]) << 24) + (((
unsigned long)patt[3]) << 16) +
147 (((
unsigned long)patt[4]) << 8) + ((
unsigned long)patt[5]));
149 LOG(error) <<
"No fired pixels in small topology";
150 throw std::runtime_error(
"No fired pixels in small topology");
157 std::cout << (*this) <<
"\n";
162 os << topology.mPattern << std::endl;
ClassImp(o2::itsmft::ClusterTopology)
Definition of the ClusterTopology class.
Class for time synchronization of RawReader instances.
static constexpr int MaxPatternBytes
void setPattern(int nRow, int nCol, const unsigned char patt[MaxPatternBytes])
Sets the pattern.
static constexpr int kExtendedPatternBytes
Maximum number of bytes for the cluster puttern + 2 bytes respectively for the number of rows and col...
const std::array< unsigned char, ClusterPattern::kExtendedPatternBytes > & getPattern() const
Returns the pattern.
int getUsedBytes() const
Returns the number of used bytes.
void setPattern(int nRow, int nCol, const unsigned char patt[ClusterPattern::MaxPatternBytes])
Sets the pattern.
static unsigned int hashFunction(const void *key, int len)
MurMur2 hash fucntion.
void print() const
Prints to the stdout.
static unsigned long getCompleteHash(int nRow, int nCol, const unsigned char patt[ClusterPattern::MaxPatternBytes])
Compute the complete hash as defined for mHash.
ClusterTopology()
Default constructor.
GLenum GLenum GLsizei len
std::ostream & operator<<(std::ostream &os, const ClusterPattern &pattern)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"