From c5d56bc1380fff61a91bff982ea6ad6c1d968cff Mon Sep 17 00:00:00 2001 From: Pascal Raisig <praisig@ikf.uni-frankfurt.de> Date: Tue, 10 Nov 2020 13:51:33 +0100 Subject: [PATCH] Add automatic TSLength calculation and tsIndex to TimesliceMetaData Up to now the TS length was hardcoded for the TimesliceMetaData object. This commit adds an automatic calculation and inserts it into the stored TimesliceMetaData objects. --- fles/mcbm2018/CbmMcbm2018Source.cxx | 21 +++++++++++++++++++-- fles/mcbm2018/CbmMcbm2018Source.h | 3 +++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/fles/mcbm2018/CbmMcbm2018Source.cxx b/fles/mcbm2018/CbmMcbm2018Source.cxx index a4006f72f6..0db535ca17 100644 --- a/fles/mcbm2018/CbmMcbm2018Source.cxx +++ b/fles/mcbm2018/CbmMcbm2018Source.cxx @@ -259,9 +259,26 @@ Int_t CbmMcbm2018Source::FillBuffer() { } // if( 0 == tsIndex % fuTsReduction ) /// Save the TimeSlice meta-data for access by higher level tasks - /// TODO: do not hard-code the duration here! + if (fTSCounter == 1) { + auto nMsInTs = ts.num_core_microslices(); + if (nMsInTs > 1) { + // This assumes that we have a component 0 and component independent ms/ts settings! + auto msDescA = ts.descriptor(0, 0); + auto msDescB = ts.descriptor(0, 1); + auto msLength = msDescB.idx - msDescA.idx; + fTSLength = msLength * nMsInTs; + fTSOverlappLength = msLength * (ts.num_microslices(0) - nMsInTs); + } else { + LOG(warning) + << "CbmMcbm2018Source::FillBuffer() - TS 1 - Calculate " + "TimesliceMetaData information - single microslice timeslices -> " + "TS duration can not be calculated with the given method. Hence, " + "TimesliceMetaData duration values are filled with 0"; + } + } new ((*fTimeSliceMetaDataArray)[fTimeSliceMetaDataArray->GetEntriesFast()]) - TimesliceMetaData(ts.descriptor(0, 0).idx); + TimesliceMetaData( + ts.descriptor(0, 0).idx, fTSLength, fTSOverlappLength, tsIndex); return 0; } diff --git a/fles/mcbm2018/CbmMcbm2018Source.h b/fles/mcbm2018/CbmMcbm2018Source.h index e6af90ff43..06ad5480ec 100644 --- a/fles/mcbm2018/CbmMcbm2018Source.h +++ b/fles/mcbm2018/CbmMcbm2018Source.h @@ -92,6 +92,9 @@ private: UInt_t fTSNumber; UInt_t fTSCounter; + ULong64_t fTSLength = 0; // used for the creation of the TimesliceMetaData + ULong64_t fTSOverlappLength = + 0; // used for the creation of the TimesliceMetaData TStopwatch fTimer; TH1I* fHistoMissedTS; //! -- GitLab