30 std::vector<unsigned char> channels;
32 for (
int i = 0;
i < 8;
i++) {
40 for (mask = 1 << 15, offset = 15; mask; mask >>= 1, offset--) {
41 if (
data[1 +
i] & mask)
42 channels.push_back(
i * 16 + offset);
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++) {
108 word mask = (1 << 15);
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 ");
139 for (
int i = 8;
i > 0;
i--)
VFATFrame::word getFlags() const
Returns flags.
VFATFrame::word getBC() const
Returns Bunch Crossing number (BC<11:0>).
bool checkFootprint() const
virtual bool checkCRC() const
bool isECPresent() const
Returns true if the EC word is present in the frame.
uint8_t daqErrorFlags
Error flag as given by certain versions of DAQ.
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
void Print(bool binary=false) const
VFATFrame::word getCRC() const
Returns the CRC.
VFATFrame::word getEC() const
Returns Event Counter (EV<7:0>).
bool isBCPresent() const
Returns true if the BC word is present in the frame.
static word calculateCRC(word crc_in, word dato)
internaly used to check CRC
bool isIDPresent() const
Returns true if the ID word is present in the frame.
VFATFrame::word getChipID() const
Returns ChipID (ChipID<11:0>).
virtual std::vector< unsigned char > getActiveChannels() const
void setData(const word *_data)
Copies a memory block to data buffer.
VFATFrame(const word *_data=nullptr)
bool isCRCPresent() const
Returns true if the CRC word is present in the frame.