Commit a415a97f authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau Committed by Pierre-Alain Loizeau
Browse files

Alter. method of TS start relative time corr for STS

Switch form info to log for debug log statement
parent b16550aa
......@@ -266,7 +266,7 @@ void CbmMcbm2018TofPar::BuildChannelsUidMap()
void CbmMcbm2018TofPar::BuildChannelsUidMapCbm(UInt_t& uCh, UInt_t uGbtx)
{
if (fiRpcSide[uGbtx] < 2) { // mTof modules
LOG(info) << " Map mTof box " << fiModuleId[uGbtx] << " at GBTX - uCh = " << uCh;
LOG(debug) << " Map mTof box " << fiModuleId[uGbtx] << " at GBTX - uCh = " << uCh;
const Int_t RpcMap[5] = {4, 2, 0, 3, 1};
for (Int_t iRpc = 0; iRpc < fiNrOfRpc[uGbtx]; iRpc++) {
Int_t iStrMax = 32;
......
......@@ -90,7 +90,7 @@ void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const cha
// ---- RICH ----
std::shared_ptr<CbmRichUnpackConfig> richconfig = nullptr;
richconfig = std::make_shared<CbmRichUnpackConfig>("", runid);
// richconfig = std::make_shared<CbmRichUnpackConfig>("", runid);
if (richconfig) {
richconfig->SetDebugState();
richconfig->SetDoWriteOutput();
......@@ -109,7 +109,7 @@ void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const cha
stsconfig->SetDoWriteOutput();
std::string parfilesbasepathSts = Form("%s/macro/beamtime/mcbm2021/", srcDir.Data());
stsconfig->SetParFilesBasePath(parfilesbasepathSts);
stsconfig->SetSystemTimeOffset(2221); // [ns] value to be updated
stsconfig->SetSystemTimeOffset(-2221); // [ns] value to be updated
}
// -------------
......
......@@ -43,11 +43,12 @@ uint64_t CbmStsUnpackAlgo::getFullTimeStamp(const uint16_t usRawTs)
{
// Use TS w/o overlap bits as they will anyway come from the TS_MSB
const uint64_t ulTime =
usRawTs
usRawTs + fulTsMsbIndexInTs[fuCurrDpbIdx] * static_cast<uint64_t>(stsxyter::kuHitNbTsBinsBinning);
/*
+ static_cast<uint64_t>(stsxyter::kuHitNbTsBinsBinning) * static_cast<uint64_t>(fvulCurrentTsMsb[fuCurrDpbIdx])
+ static_cast<uint64_t>(stsxyter::kulTsCycleNbBinsBinning)
* static_cast<uint64_t>(fvuCurrentTsMsbCycle[fuCurrDpbIdx]);
*/
return ulTime;
}
......@@ -288,9 +289,11 @@ void CbmStsUnpackAlgo::initInternalStatus(CbmMcbm2018StsPar* parset)
fvulCurrentTsMsb.resize(uNbOfDpbs);
fvuCurrentTsMsbCycle.resize(uNbOfDpbs);
fulTsMsbIndexInTs.resize(uNbOfDpbs);
for (uint32_t uDpb = 0; uDpb < uNbOfDpbs; ++uDpb) {
fvulCurrentTsMsb[uDpb] = 0;
fvuCurrentTsMsbCycle[uDpb] = 0;
fulTsMsbIndexInTs[uDpb] = 0;
}
fvvusLastTsChan.resize(uNbStsXyters);
......@@ -495,10 +498,13 @@ void CbmStsUnpackAlgo::processHitInfo(const stsxyter::Message& mess)
uChanInMod = fNrChsPerFeb - uChanInMod - 1 // Invert channel order
+ fNrChsPerFeb; // Offset for P (back) side
/*
// Get the time relative to the Timeslice time, I hope that the cast here works as expected. Otherwise Sts will also get into trouble with the size of UTC here
auto tsreltime =
static_cast<uint64_t>((ulHitTime - (fTsStartTime / stsxyter::kdClockCycleNs)) * stsxyter::kdClockCycleNs);
double dTimeInNs = tsreltime - fSystemTimeOffset;
*/
double_t tsreltime = ulHitTime * stsxyter::kdClockCycleNs;
double dTimeInNs = tsreltime - fSystemTimeOffset;
if (uAsicIdx < fvdTimeOffsetNsAsics.size()) dTimeInNs -= fvdTimeOffsetNsAsics[uAsicIdx];
const uint64_t ulTimeInNs = static_cast<uint64_t>(dTimeInNs);
......@@ -610,6 +616,11 @@ void CbmStsUnpackAlgo::processTsMsbInfo(const stsxyter::Message& mess, uint32_t
else
fvulCurrentTsMsb[fuCurrDpbIdx] = uVal;
fulTsMsbIndexInTs[fuCurrDpbIdx] =
fvulCurrentTsMsb[fuCurrDpbIdx]
+ (fvuCurrentTsMsbCycle[fuCurrDpbIdx] * static_cast<uint64_t>(1 << stsxyter::kusLenTsMsbValBinning))
- fulTsStartInTsMsb;
if (fMonitor)
if (fMonitor->GetDebugMode()) { //also if( 1 < uMessIdx )?
fMonitor->FillStsDpbRawTsMsb(fuCurrDpbIdx, fvulCurrentTsMsb[fuCurrDpbIdx]);
......@@ -648,6 +659,10 @@ void CbmStsUnpackAlgo::refreshTsMsbFields(const uint32_t imslice, const size_t m
}
fvuCurrentTsMsbCycle[fuCurrDpbIdx] = uTsMsbCycleHeader;
}
fulTsMsbIndexInTs[fuCurrDpbIdx] =
fvulCurrentTsMsb[fuCurrDpbIdx]
+ (fvuCurrentTsMsbCycle[fuCurrDpbIdx] * static_cast<uint64_t>(1 << stsxyter::kusLenTsMsbValBinning))
- fulTsStartInTsMsb;
}
// ---- unpack ----
......@@ -708,6 +723,12 @@ bool CbmStsUnpackAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp, UI
if (fMonitor) fMonitor->FillMsCntEvo(fMsStartTime);
if (0 == imslice) {
/// Extract the time base only on MS 0, assuming that we get all TS of a component in order
fulTsStartInTsMsb =
static_cast<uint64_t>(fTsStartTime / (stsxyter::kuHitNbTsBinsBinning * stsxyter::kdClockCycleNs));
}
// Check the current TS_MSb cycle and correct it if wrong
refreshTsMsbFields(imslice, fMsStartTime);
......
......@@ -8,14 +8,14 @@
* @brief Baseclass for the TrdR unpacker algorithms
* @version 0.1
* @date 2021-04-21
*
*
* @copyright Copyright (c) 2021
*
* This is the base class for the algorithmic part of the tsa data unpacking
*
* This is the base class for the algorithmic part of the tsa data unpacking
* processes of the CbmTrd.
* The actual translation from tsa to digi happens in the derived classes.
*
*
* The actual translation from tsa to digi happens in the derived classes.
*
*
*/
#ifndef CbmStsUnpackAlgo_H
......@@ -53,9 +53,9 @@ public:
/**
* @brief Get the requested parameter containers. To be defined in the derived classes!
* Return the required parameter containers together with the paths to the ascii
* Return the required parameter containers together with the paths to the ascii
* files to.
*
*
* @param[in] std::string geoTag as used in CbmSetup
* @param[in] std::uint32_t runId for runwise defined parameters
* @return fParContVec
......@@ -65,10 +65,10 @@ public:
/**
* @brief Mask a Noisy Channel
*
* @param uFeb
* @param uChan
* @param bMasked
*
* @param uFeb
* @param uChan
* @param bMasked
*/
void MaskNoisyChannel(const uint32_t uFeb, const uint32_t uChan, const bool bMasked = true);
......@@ -95,24 +95,24 @@ protected:
/**
* @brief Get the Asic Index
*
* @param dpbidx
* @param crobidx
* @param elinkidx
*
* @param dpbidx
* @param crobidx
* @param elinkidx
*/
uint32_t getAsicIndex(uint32_t dpbidx, uint32_t crobidx, uint16_t elinkidx);
/**
* @brief Get the Full Time Stamp from raw time stamp
*
* @param usRawTs
* @return uint64_t
* @brief Get the Full Time Stamp from raw time stamp
*
* @param usRawTs
* @return uint64_t
*/
uint64_t getFullTimeStamp(const uint16_t usRawTs);
/**
* @brief Intialisation at begin of run. Special inits of the derived algos.
*
*
* @retval Bool_t initOk
*/
Bool_t init();
......@@ -125,17 +125,17 @@ protected:
/**
* @brief Handles the distribution of the hidden derived classes to their explicit functions.
*
* @param parset
* @return Bool_t initOk
*
* @param parset
* @return Bool_t initOk
*/
Bool_t initParSet(FairParGenericSet* parset);
/**
* @brief Initialize the parameters from CbmMcbm2018StsPar.
*
* @param parset
* @return Bool_t initOk
*
* @param parset
* @return Bool_t initOk
*/
Bool_t initParSet(CbmMcbm2018StsPar* parset);
......@@ -147,13 +147,13 @@ protected:
std::vector<std::vector<std::vector<int32_t>>>* viFebModuleSide);
/**
* @brief Main loop over the sts xyter messages in the µSlices
*
* @param msContent
* @param uSize
* @param uMsIdx
* @param bError
* @param sMessPatt
* @param vNbMessType
*
* @param msContent
* @param uSize
* @param uMsIdx
* @param bError
* @param sMessPatt
* @param vNbMessType
*/
void loopMsMessages(const uint8_t* msContent, const uint32_t uSize, const size_t uMsIdx, bool& bError,
std::string& sMessPatt, std::vector<uint32_t>& vNbMessType);
......@@ -186,24 +186,24 @@ protected:
/**
* @brief Set the Derived Ts Parameters
*
*
* In this function parameters required by the explicit algo connected to the timeslice can be set.
*
* @param itimeslice
* @return true
* @return false
*
* @param itimeslice
* @return true
* @return false
*/
bool setDerivedTsParameters(size_t /*itimeslice*/) { return true; }
/**
* @brief Unpack a given microslice. To be implemented in the derived unpacker algos.
*
*
* @param ts timeslice pointer
* @param icomp index to the component to be unpacked
* @param imslice index of the microslice to be unpacked
* @return true
* @return false
*
* @return true
* @return false
*
* @remark The content of the µslice can only be accessed via the timeslice. Hence, we need to pass the pointer to the full timeslice
*/
bool unpack(const fles::Timeslice* ts, std::uint16_t icomp, UInt_t imslice);
......@@ -282,6 +282,10 @@ protected:
/** @brief Current TS MSB cycle for DPB */
std::vector<uint32_t> fvuCurrentTsMsbCycle = {}; //!
/** @brief Start time of the TS expressed in TS_MSB instead of ns */
uint64_t fulTsStartInTsMsb = 0;
/** @brief Current TS MSB cycle for DPB relative to TS start */
std::vector<uint64_t> fulTsMsbIndexInTs = {};
/// Duplicate hits suppression
static const uint32_t kuMaxTsMsbDiffDuplicates = 8;
......
......@@ -35,7 +35,7 @@ CbmRecoUnpack::CbmRecoUnpack() {}
// ----- Initialisation ---------------------------------------------------
void CbmRecoUnpack::Finish()
{
LOG(info) << "CbmRecoUnpack::Finish() I do let the unpackers talk first : ";
LOG(info) << "CbmRecoUnpack::Finish() I do let the unpackers talk first :\n";
if (fPsdConfig) fPsdConfig->GetUnpacker()->Finish();
if (fRichConfig) fRichConfig->GetUnpacker()->Finish();
......
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