36 LOG(error) <<
"Invalid element of the pattern";
45 int nBits = (
int)mBitmap[0] * (
int)mBitmap[1];
46 int nBytes = nBits / 8;
55 mBitmap[0] = (
unsigned char)nRow;
56 mBitmap[1] = (
unsigned char)nCol;
57 int nBytes = nRow * nCol / 8;
58 if (((nRow * nCol) % 8) != 0) {
61 memcpy(&mBitmap[2], patt, nBytes);
71 os <<
"rowSpan: " <<
pattern.getRowSpan() <<
" columnSpan: " <<
pattern.getColumnSpan()
72 <<
" #bytes: " <<
pattern.getUsedBytes() << std::endl;
73 unsigned char tempChar = 0;
76 for (
int i = 2;
i <
pattern.getUsedBytes() + 2;
i++) {
80 if (ic %
pattern.getColumnSpan() == 0) {
84 if ((tempChar & s) != 0) {
90 if (ic %
pattern.getColumnSpan() == 0) {
91 os <<
"|" << std::endl;
107 std::cout << *
this <<
"\n";
113 const auto* patt = mBitmap.data() + 2;
114 for (
int i = 0;
i < nBytes;
i++) {
117 p = ((p & 0xAA) >> 1) + (p & 0x55);
118 p = ((p & 0xCC) >> 2) + (p & 0x33);
119 p = ((p & 0xF0) >> 4) + (p & 0x0f);
128 int tempxCOG = 0, tempzCOG = 0, tempFiredPixels = 0, ic = 0,
ir = 0;
129 int nBits = rowSpan * colSpan;
130 int nBytes = nBits / 8;
131 if (nBits % 8 != 0) {
134 for (
int i = 0;
i < nBytes;
i++) {
135 unsigned char tempChar = patt[
i];
138 if ((tempChar & s) != 0) {
145 if ((
ir + 1) * ic == nBits) {
153 if ((
ir + 1) * ic == nBits) {
157 xCOG = float(tempxCOG) / tempFiredPixels;
158 zCOG = float(tempzCOG) / tempFiredPixels;
160 return tempFiredPixels;
ClassImp(o2::itsmft::ClusterPattern)
Definition of the ClusterTopology class.
static constexpr int MaxPatternBytes
static int getCOG(int rowSpan, int colSpan, const unsigned char patt[MaxPatternBytes], float &xCOG, float &zCOG)
Static: Compute pattern's COG position. Returns the number of fired pixels.
void setPattern(int nRow, int nCol, const unsigned char patt[MaxPatternBytes])
Sets the pattern.
ClusterPattern()
Default constructor.
static constexpr int kExtendedPatternBytes
Maximum number of bytes for the cluster puttern + 2 bytes respectively for the number of rows and col...
unsigned char getByte(int n) const
Returns a specific byte of the pattern.
int getNPixels() const
Returns the number of fired pixels.
int getUsedBytes() const
Returns the number of bytes used for the pattern.
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"
o2::InteractionRecord ir(0, 0)
std::array< uint16_t, 5 > pattern