Skip to content
Snippets Groups Projects
Commit 4371cc19 authored by Pascal Raisig's avatar Pascal Raisig Committed by Pierre-Alain Loizeau
Browse files

Add safety in case of a corrupted EOM message

In the data from mcbm2021 the possibility that the bits of the number of samples indicator in EOMs can be corrupted. This commit implements a safety which prevents the unpacker to go into a broken state in case of corrupted bits.
parent 05ef9178
Branches
Tags
1 merge request!441Add safety in case of a corrupted EOM message
Pipeline #12460 passed
......@@ -162,13 +162,17 @@ void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const cha
// -------------
// ---- TOF ----
auto tofconfig = std::make_shared<CbmTofUnpackConfig>("", runid);
std::shared_ptr<CbmTofUnpackConfig> tofconfig = nullptr;
tofconfig = std::make_shared<CbmTofUnpackConfig>("", runid);
if (tofconfig) {
// tofconfig->SetDebugState();
tofconfig->SetDoWriteOutput();
// tofconfig->SetDoWriteOptOutA("CbmTofErrors");
std::string parfilesbasepathTof = Form("%s/macro/beamtime/mcbm2021/", srcDir.Data());
tofconfig->SetParFilesBasePath(parfilesbasepathTof);
tofconfig->SetSystemTimeOffset(-1220); // [ns] value to be updated
}
// -------------
......
......
......@@ -163,8 +163,9 @@ void CbmTrdUnpackAlgoR::finishDerived()
{
LOG(info) << fName << " \n " << fNrWildRda << " unexpected RDA frames,\n " << fNrWildNul
<< " unexpected NUL frames, \n " << fNrWildEom << " unexpected EOM frames, \n " << fNrMissingEom
<< " missing EOM frames, \n " << fNrElinkMis << " SOM to RDA/EOM eLink mismatches, \n " << fNrNonMajorTsMsb
<< " non-major ts_msbs and \n " << fNrUnknownWords << " unknown frames." << std::endl;
<< " missing EOM frames, \n " << fNrCorruptEom << " corrupt EOM frames, \n " << fNrElinkMis
<< " SOM to RDA/EOM eLink mismatches, \n " << fNrNonMajorTsMsb << " non-major ts_msbs and \n "
<< fNrUnknownWords << " unknown frames." << std::endl;
}
// ---- getInfoType ----
......@@ -456,6 +457,8 @@ bool CbmTrdUnpackAlgoR::unpack(const fles::Timeslice* ts, std::uint16_t icomp, U
nn = nreqsamples % 4;
}
// There is a chance that the nsamplesindicator bits are corrupted, here we check that we do not try to extract more adcbits than actually are streamed
if (nreqsamples >= isample) {
// Now extract from the above values the number of required adc bits from the eom
std::int8_t nrequiredbits = (nreqsamples - isample) * 9 - nadcbits;
adcbuffer <<= nrequiredbits;
......@@ -469,6 +472,10 @@ bool CbmTrdUnpackAlgoR::unpack(const fles::Timeslice* ts, std::uint16_t icomp, U
raw.SetSample(extractSample(&adcbuffer, &nadcbits), isample);
isample++;
}
}
else {
++fNrCorruptEom;
}
++fNrCreatedRawMsgs;
// the message is done and the raw message container should contain everything we need. So now we can call makeDigi()
makeDigi(raw);
......
......
......@@ -182,6 +182,9 @@ protected:
/** @brief Number of SOM to RDA/EOM mismatches */
size_t fNrElinkMis = 0;
/** @brief Number of corrupted EOM frames */
size_t fNrCorruptEom = 0;
/** @brief Start time of the current µSlice in Spadic CC */
size_t fMsStartTimeCC = 0;
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment