Commit 47214c71 authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

StsDigi time limit check improvement: split time check assert & add debug log in unpacker

parent e943bca1
......@@ -49,7 +49,10 @@ public:
**/
CbmStsDigi(int32_t address, int32_t channel, double time, uint16_t charge)
{
assert(time >= 0 && time <= kMaxTimestamp);
// StsDigi is not able to store negative timestamps.
assert(time >= 0);
// StsDigi has a maximal time range of ~2.1s (2 147 483 647 ns).
assert(time <= kMaxTimestamp);
PackAddressAndTime(address, time);
PackChannelAndCharge(channel, charge);
}
......@@ -115,7 +118,9 @@ public:
void SetTime(double dNewTime)
{
// StsDigi is not able to store negative timestamps.
assert(dNewTime >= 0 && dNewTime <= kMaxTimestamp);
assert(dNewTime >= 0);
// StsDigi has a maximal time range of ~2.1s (2 147 483 647 ns).
assert(dNewTime <= kMaxTimestamp);
PackTime(dNewTime);
}
......
......@@ -592,7 +592,7 @@ void CbmStsUnpackAlgo::processTsMsbInfo(const stsxyter::Message& mess, uint32_t
// Update Status counters
if (uVal < fvulCurrentTsMsb[fuCurrDpbIdx]) {
LOG(debug) << " TS " << std::setw(12) << fTsIndex << uMsIdx << " MS Idx " << std::setw(4) << uMsIdx << " Msg Idx "
LOG(debug) << " TS " << std::setw(12) << fTsIndex << " MS Idx " << std::setw(4) << uMsIdx << " Msg Idx "
<< std::setw(5) << uMessIdx << " DPB " << std::setw(2) << fuCurrDpbIdx << " Old TsMsb " << std::setw(5)
<< fvulCurrentTsMsb[fuCurrDpbIdx] << " Old MsbCy " << std::setw(5) << fvuCurrentTsMsbCycle[fuCurrDpbIdx]
<< " new TsMsb " << std::setw(5) << uVal;
......@@ -610,7 +610,7 @@ void CbmStsUnpackAlgo::processTsMsbInfo(const stsxyter::Message& mess, uint32_t
&& !(uVal == fvulCurrentTsMsb[fuCurrDpbIdx] && 2 == uMessIdx)
/// New FW introduced TS_MSB suppression + large TS_MSB => warning only if value not increasing
&& uVal < fvulCurrentTsMsb[fuCurrDpbIdx]) {
LOG(debug) << "TS MSb Jump in "
LOG(debug) << "TS MSB Jump in "
<< " TS " << std::setw(12) << fTsIndex << " MS Idx " << std::setw(4) << uMsIdx << " Msg Idx "
<< std::setw(5) << uMessIdx << " DPB " << std::setw(2) << fuCurrDpbIdx << " => Old TsMsb "
<< std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx] << " new TsMsb " << std::setw(5) << uVal;
......@@ -622,6 +622,10 @@ void CbmStsUnpackAlgo::processTsMsbInfo(const stsxyter::Message& mess, uint32_t
else
fvulCurrentTsMsb[fuCurrDpbIdx] = uVal;
LOG(debug1) << " TS " << std::setw(12) << fTsIndex << " MS Idx " << std::setw(4) << uMsIdx << " Msg Idx "
<< std::setw(5) << uMessIdx << " DPB " << std::setw(2) << fuCurrDpbIdx << " TsMsb " << std::setw(5)
<< fvulCurrentTsMsb[fuCurrDpbIdx] << " MsbCy " << std::setw(5) << fvuCurrentTsMsbCycle[fuCurrDpbIdx];
fulTsMsbIndexInTs[fuCurrDpbIdx] =
fvulCurrentTsMsb[fuCurrDpbIdx]
+ (fvuCurrentTsMsbCycle[fuCurrDpbIdx] * static_cast<uint64_t>(1 << stsxyter::kusLenTsMsbValBinning));
......@@ -653,12 +657,19 @@ void CbmStsUnpackAlgo::refreshTsMsbFields(const uint32_t imslice, const size_t m
std::floor((mstime - uTsMsbCycleHeader * (stsxyter::kulTsCycleNbBinsBinning * stsxyter::kdClockCycleNs))
/ (stsxyter::kuHitNbTsBinsBinning * stsxyter::kdClockCycleNs));
LOG(debug1) << " TS " << std::setw(12) << fTsIndex << " MS " << std::setw(12) << mstime << " MS Idx " << std::setw(4)
<< imslice << " Msg Idx " << std::setw(5) << 0 << " DPB " << std::setw(2) << fuCurrDpbIdx << " Old TsMsb "
<< std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx] << " Old MsbCy " << std::setw(5)
<< fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " header TsMsb " << uTsMsbHeader << " New MsbCy "
<< uTsMsbCycleHeader;
if (0 == imslice) {
if (uTsMsbCycleHeader != fvuCurrentTsMsbCycle[fuCurrDpbIdx])
LOG(debug) << " TS " << std::setw(12) << fTsIndex << " MS " << std::setw(12) << mstime << " MS Idx "
<< std::setw(4) << imslice << " Msg Idx " << std::setw(5) << 0 << " DPB " << std::setw(2)
<< fuCurrDpbIdx << " Old TsMsb " << std::setw(5) << fvulCurrentTsMsb[fuCurrDpbIdx] << " Old MsbCy "
<< std::setw(5) << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " New MsbCy " << uTsMsbCycleHeader;
<< std::setw(5) << fvuCurrentTsMsbCycle[fuCurrDpbIdx] << " New TsMsb " << uTsMsbHeader << " New MsbCy "
<< uTsMsbCycleHeader;
fvuCurrentTsMsbCycle[fuCurrDpbIdx] = uTsMsbCycleHeader;
fvulCurrentTsMsb[fuCurrDpbIdx] = uTsMsbHeader;
}
......@@ -712,7 +723,7 @@ bool CbmStsUnpackAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp, UI
fMsStartTime = msDescriptor.idx;
LOG(debug) << "Microslice: " << fMsStartTime << " from EqId " << std::hex << uCurrentEquipmentId << std::dec
<< " has size: " << uSize;
<< " has size: " << uSize << " (index " << imslice << ")";
if (0 == fvbMaskedComponents.size()) fvbMaskedComponents.resize(ts->num_components(), false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment