Commit b1e8b111 authored by Pascal Raisig's avatar Pascal Raisig
Browse files

Reduce amount of calculating the relartive µSlice start time.

Before the time was calculated for each raw message, now it is calculated once per µSlice.
parent ab0f53f5
......@@ -315,9 +315,7 @@ CbmTrdRawMessageSpadic CbmTrdUnpackAlgoR::makeRaw(const std::uint32_t frame, std
// We directly start with the largest possible samples vector to only init it once
std::vector<std::int16_t> samples = std::vector<std::int16_t>(0);
// Get the µSlice starttime relative to the timeslice starttime. Otherwise the UTC will already here be to large due to a cast, caused by the multiplication with a double used in the raw message
auto relMsStartTimeCC = fMsStartTimeCC - (fTsStartTime / CbmTrdSpadic::GetClockCycle());
uint64_t fulltime = relMsStartTimeCC + (fNrTsMsbVec.at(istream) * fTsMsbLengthCC) + timestamp;
uint64_t fulltime = fMsStartTimeRelCC + (fNrTsMsbVec.at(istream) * fTsMsbLengthCC) + timestamp;
// Create message
......@@ -333,8 +331,9 @@ bool CbmTrdUnpackAlgoR::unpack(const fles::Timeslice* ts, std::uint16_t icomp, U
auto msdesc = ts->descriptor(icomp, imslice);
// Get the µSlice start time and reset the ts_msb counter
fMsStartTimeCC = msdesc.idx / fSpadic->GetClockCycle();
// Get the µSlice starttime relative to the timeslice starttime.
// The UTC is already to large for storing it CbmTrdRawMessageSpadic due to a cast, caused by the multiplication with a double used in the raw message
fMsStartTimeRelCC = (msdesc.idx - fTsStartTime) / fSpadic->GetClockCycle();
// We only want to count on TS_MSB per Stream per TS_MSB package (each eLink sends its own TS_MSB frame) so we store the current TS_MSB and compare it to the incoming.
std::uint8_t currTsMsb = 0;
......
......@@ -185,8 +185,8 @@ protected:
/** @brief Number of corrupted EOM frames */
size_t fNrCorruptEom = 0;
/** @brief Start time of the current µSlice in Spadic CC */
size_t fMsStartTimeCC = 0;
/** @brief Start time of the current µSlice relative to the Timeslice start time in Spadic CC. */
size_t fMsStartTimeRelCC = 0;
// Constants
/** @brief Bytes per spadic frame stored in the microslices */
......
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