32 for (
int i = 0;
i < 8;
i++) {
72 word crc_fin = 0xffff;
74 for (
int i = 11;
i >= 1;
i--)
77 return (crc_fin ==
data[0]);
84 word crc_temp = crc_in;
85 unsigned char datalen = 16;
87 for (
int i = 0;
i < datalen;
i++) {
93 if ((crc_temp &
mask) ^
d)
94 crc_temp = crc_temp >> 1 ^ 0x8408;
96 crc_temp = crc_temp >> 1;
106 for (
int i = 0;
i < 12;
i++) {
109 for (
int j = 0;
j < 16;
j++) {
115 if ((
j + 1) % 4 == 0)
121 printf(
"ID = %03x, BC = %04u, EC = %03u, flags = %2u, CRC = %04x ",
129 printf(
"( OK), footprint ");
131 printf(
"(FAIL), footprint ");
138 printf(
", frame = %04x|%04x|%04x|",
data[11],
data[10],
data[9]);
139 for (
int i = 8;
i > 0;
i--)
140 printf(
"%04x",
data[
i]);
141 printf(
"|%04x",
data[0]);
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.
VFATFrame::word getChipID() const
Returns ChipID (ChipID<11:0>).
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)