32 for (
int i = 0;
i < 8;
i++) {
85 word crc_fin = 0xffff;
87 for (
int i = 11;
i >= 1;
i--)
90 return (crc_fin ==
data[0]);
99 word crc_fin = 0xffff;
101 for (
int i = 0;
i < 11;
i++)
104 return (crc_fin ==
data[11]);
111 word crc_temp = crc_in;
112 unsigned char datalen = 16;
114 for (
int i = 0;
i < datalen;
i++) {
120 if ((crc_temp &
mask) ^
d)
121 crc_temp = crc_temp >> 1 ^ 0x8408;
123 crc_temp = crc_temp >> 1;
133 for (
int i = 0;
i < 12;
i++) {
136 for (
int j = 0;
j < 16;
j++) {
142 if ((
j + 1) % 4 == 0)
148 printf(
"ID = %03x, BC = %04u, EC = %03u, flags = %2u, CRC = %04x ",
156 printf(
"( OK), footprint ");
158 printf(
"(FAIL), footprint ");
165 printf(
", frame = %04x|%04x|%04x|",
data[11],
data[10],
data[9]);
166 for (
int i = 8;
i > 0;
i--)
167 printf(
"%04x",
data[
i]);
168 printf(
"|%04x",
data[0]);
179 for (
int i = 0;
i < 12;
i++) {
182 for (
int j = 0;
j < 16;
j++) {
188 if ((
j + 1) % 4 == 0)
195 word crc_fin = 0xffff;
197 for (
int i = 0;
i < 11;
i++)
203 printf(
"( OK), footprint ");
205 printf(
"(FAIL, right = %04x), footprint ", crc_fin);
212 printf(
"Frame = %04x|%04x|%04x|",
data[0],
data[1],
data[2]);
213 for (
int i = 3;
i < 11;
i++)
214 printf(
"%04x",
data[
i]);
215 printf(
"|%04x",
data[11]);
virtual bool checkCRC() const
void Print(bool binary=false) const
VFATFrame::word getEC() const
Returns Event Counter (EV<7:0>).
bool checkFootprint() const
VFATFrame::word getCRC() const
Returns the CRC.
VFATFrame::word getFlags() const
Returns flags.
virtual std::vector< unsigned char > getActiveChannels() const
bool isBCPresent() const
Returns true if the BC word is present in the frame.
uint8_t daqErrorFlags
Error flag as given by certain versions of DAQ.
virtual bool checkCRCT2() const
VFATFrame::word getChipID() const
Returns ChipID (ChipID<11:0>).
VFATFrame::word getCRCT2() const
Returns the CRC, for non-reversed TOTEM T2.
void PrintT2(bool binary=false) const
bool checkFootprintT2() const
bool isCRCPresent() const
Returns true if the CRC word is present in the frame.
static word calculateCRC(word crc_in, word dato)
internaly used to check CRC
bool isECPresent() const
Returns true if the EC word is present in the frame.
bool isIDPresent() const
Returns true if the ID word is present in the frame.
VFATFrame::word getBC() const
Returns Bunch Crossing number (BC<11:0>).
void setData(const word *_data)
Copies a memory block to data buffer.
VFATFrame(const word *_data=nullptr)