From b1e8b1116aeee5ca0c4f8751faafebfa9a66d747 Mon Sep 17 00:00:00 2001 From: Pascal Raisig <praisig@ikf.uni-frankfurt.de> Date: Tue, 30 Nov 2021 11:19:30 +0100 Subject: [PATCH] =?UTF-8?q?Reduce=20amount=20of=20calculating=20the=20rela?= =?UTF-8?q?rtive=20=C2=B5Slice=20start=20time.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before the time was calculated for each raw message, now it is calculated once per µSlice. --- reco/detectors/trd/unpack/CbmTrdUnpackAlgoR.cxx | 9 ++++----- reco/detectors/trd/unpack/CbmTrdUnpackAlgoR.h | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackAlgoR.cxx b/reco/detectors/trd/unpack/CbmTrdUnpackAlgoR.cxx index 542470c67f..21fcd178df 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackAlgoR.cxx +++ b/reco/detectors/trd/unpack/CbmTrdUnpackAlgoR.cxx @@ -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; diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackAlgoR.h b/reco/detectors/trd/unpack/CbmTrdUnpackAlgoR.h index bd1269e19a..845bf5155e 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackAlgoR.h +++ b/reco/detectors/trd/unpack/CbmTrdUnpackAlgoR.h @@ -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 */ -- GitLab