Skip to content
Snippets Groups Projects
Commit 9d1d753e authored by David Schledt's avatar David Schledt Committed by Pierre-Alain Loizeau
Browse files

Fix for overflow counting issue in trd1d timing

parent 3e4e23da
No related branches found
No related tags found
1 merge request!861Fix for overflow counting issue in trd1d timing
Pipeline #17772 passed
...@@ -246,6 +246,8 @@ Spadic::MsMessageType CbmTrdUnpackAlgoR::getMessageType(const std::uint32_t fram ...@@ -246,6 +246,8 @@ Spadic::MsMessageType CbmTrdUnpackAlgoR::getMessageType(const std::uint32_t fram
// ---- getTsMsb ---- // ---- getTsMsb ----
std::uint8_t CbmTrdUnpackAlgoR::getTsMsb(const std::uint32_t frame) std::uint8_t CbmTrdUnpackAlgoR::getTsMsb(const std::uint32_t frame)
{ {
if ((frame & 0xf) > 0)
return -2; // if a 'error' ts_msb is received the tsmsb value is not correct. To not mess up the counting -2 is returned.
// The epoch in form of the TS_MSBs is written 3 times into the frame to allow to check for bit flips and catch errors. It has the length of 6 bits and an offset of 4 // The epoch in form of the TS_MSBs is written 3 times into the frame to allow to check for bit flips and catch errors. It has the length of 6 bits and an offset of 4
std::uint8_t tsmsb[3]; std::uint8_t tsmsb[3];
for (uint iepoch = 0; iepoch < 3; ++iepoch) { for (uint iepoch = 0; iepoch < 3; ++iepoch) {
...@@ -381,7 +383,7 @@ bool CbmTrdUnpackAlgoR::unpack(const fles::Timeslice* ts, std::uint16_t icomp, U ...@@ -381,7 +383,7 @@ bool CbmTrdUnpackAlgoR::unpack(const fles::Timeslice* ts, std::uint16_t icomp, U
switch (kWordtype) { switch (kWordtype) {
case Spadic::MsMessageType::kEPO: { case Spadic::MsMessageType::kEPO: {
auto tsmsb = getTsMsb(frame); auto tsmsb = getTsMsb(frame);
if (tsmsb > currTsMsb) fNrTsMsbVec.at(istream)++; if (((tsmsb - currTsMsb) & 0x3f) == 1 || currTsMsb == -1) fNrTsMsbVec.at(istream)++;
currTsMsb = tsmsb; currTsMsb = tsmsb;
fNrEpochMsgs++; fNrEpochMsgs++;
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment