diff --git a/EventFilter/HGCalRawToDigi/interface/UnpackerTools.h b/EventFilter/HGCalRawToDigi/interface/UnpackerTools.h index 6eae134c415..2685515036b 100644 --- a/EventFilter/HGCalRawToDigi/interface/UnpackerTools.h +++ b/EventFilter/HGCalRawToDigi/interface/UnpackerTools.h @@ -10,7 +10,7 @@ namespace hgcal { @short this function re-computes the CRC of the ECON-D packet and compares it with the trailer of the packet false is returned if there is a mismatch */ - bool econdCRCAnalysis(const uint64_t *header, const uint32_t pos, const uint32_t payloadLength) ; + bool econdCRCAnalysis(const uint64_t *header, const uint32_t pos, const uint32_t payloadLength); } // namespace hgcal diff --git a/EventFilter/HGCalRawToDigi/src/UnpackerTools.cc b/EventFilter/HGCalRawToDigi/src/UnpackerTools.cc index fc269bc5c83..b255754f6c5 100644 --- a/EventFilter/HGCalRawToDigi/src/UnpackerTools.cc +++ b/EventFilter/HGCalRawToDigi/src/UnpackerTools.cc @@ -25,12 +25,18 @@ bool hgcal::econdCRCAnalysis(const uint64_t *header, const uint32_t pos, const u //Compute CRC using all eRx subpackets but not the event paket header (two first words) std::vector crcvec(data32b.begin() + 2, data32b.end() - 1); std::transform(crcvec.begin(), crcvec.end(), crcvec.begin(), [](uint32_t w) { - return ((w << 24) & 0xFF000000) | ((w << 8) & 0x00FF0000) | ((w >> 8) & 0x0000FF00) | ((w >> 24) & 0x000000FF); //swapping endianness + return ((w << 24) & 0xFF000000) | ((w << 8) & 0x00FF0000) | ((w >> 8) & 0x0000FF00) | + ((w >> 24) & 0x000000FF); //swapping endianness }); auto array = &(crcvec[0]); auto bytes = reinterpret_cast(array); - auto crc32 = boost::crc<32, hgcal::ECOND_FRAME::CRC_POL, hgcal::ECOND_FRAME::CRC_INITREM, hgcal::ECOND_FRAME::CRC_FINALXOR, false, false>(bytes, (payloadLength - 1) * 4); //32-bit words, hence need to parse 4 bytes + auto crc32 = boost::crc<32, + hgcal::ECOND_FRAME::CRC_POL, + hgcal::ECOND_FRAME::CRC_INITREM, + hgcal::ECOND_FRAME::CRC_FINALXOR, + false, + false>(bytes, (payloadLength - 1) * 4); //32-bit words, hence need to parse 4 bytes return crc32 == target; }