diff --git a/algo/detectors/rich/UnpackRich.cxx b/algo/detectors/rich/UnpackRich.cxx index 471504f5f955ded4c4a0e0bdf4338745941c9e3a..7958be3dc62755ab84819d18af7f0696aadf2c42 100644 --- a/algo/detectors/rich/UnpackRich.cxx +++ b/algo/detectors/rich/UnpackRich.cxx @@ -258,7 +258,7 @@ namespace cbm::algo double ToTcorr = fbDoToTCorr ? fParams.fElinkParams[fpgaID].fToTshift[channel] : 0.; int32_t pixelUID = GetPixelUID(fpgaID, channel); //check ordering - double finalTime = time + (double) fMsRefTime - fSystemTimeOffset; + double finalTime = time + (double) fMsRefTime - fParams.fElinkParams[fpgaID].fTimeOffset; // Do not accept digis, where the MS und TS differs by more than 6 sec (mainly TS0) if (6e9 < finalTime) return; diff --git a/algo/detectors/rich/UnpackRich.h b/algo/detectors/rich/UnpackRich.h index 8987e926f3918cf56ce043428f16d96adf2f3af6..944660d68780964ec2c4d58f3dd877605937df4d 100644 --- a/algo/detectors/rich/UnpackRich.h +++ b/algo/detectors/rich/UnpackRich.h @@ -46,6 +46,7 @@ namespace cbm::algo **/ struct UnpackRichElinkPar { std::vector<double> fToTshift; ///< TOT shift for different channels + uint64_t fTimeOffset = 0.; ///< Time calibration parameter }; @@ -178,12 +179,6 @@ namespace cbm::algo /** @brief Storage of monitoring data. */ UnpackRichMonitorData fMonitor; - - /** - * @brief Time offset for the system - * @todo This should be module and channel dependent and included into the asic parameters - */ - std::int32_t fSystemTimeOffset = 0; }; diff --git a/algo/detectors/trd/UnpackTrd.cxx b/algo/detectors/trd/UnpackTrd.cxx index 854cb8e202096b2e6c5449aa8b2082ffdd06c5e8..ed9fe1ee0a5922938b95d9fa9fe6935d7b1dccad 100644 --- a/algo/detectors/trd/UnpackTrd.cxx +++ b/algo/detectors/trd/UnpackTrd.cxx @@ -404,7 +404,7 @@ namespace cbm::algo fLastFulltime = raw.GetFullTime(); // Get the time information and apply the necessary correction - uint64_t time = raw.GetTime() - fSystemTimeOffset; + uint64_t time = raw.GetTime() - elinkPar.fTimeOffset; // Get the timeshift and set the member, which is required for some of the rtd methods uint64_t currentTimeshift = GetBinTimeShift(raw.GetSamples()); diff --git a/algo/detectors/trd/UnpackTrd.h b/algo/detectors/trd/UnpackTrd.h index 1afc4ed23a6c668ee1f33a39b1753ff0e8283266..915535c1f22eb91a105cbe3ca46fe410f06478ad 100644 --- a/algo/detectors/trd/UnpackTrd.h +++ b/algo/detectors/trd/UnpackTrd.h @@ -250,12 +250,6 @@ namespace cbm::algo /** @brief Number of streams per word **/ static const std::uint8_t fStreamsPerWord = 2; - /** - ** @brief Time offset for the system - ** @todo This should be module and channel dependent and included into the asic parameters - **/ - std::int32_t fSystemTimeOffset = 0; - /** @brief Start time of the current µSlice relative to the Timeslice start time in Spadic CC. */ size_t fMsStartTimeRelCC = 0; diff --git a/algo/detectors/trd2d/UnpackTrd2d.cxx b/algo/detectors/trd2d/UnpackTrd2d.cxx index e6709b4a00d79ccac613999bd460de670736b390..a1eb4ec42726799d524c2196ea3da7e8ff5c5562 100644 --- a/algo/detectors/trd2d/UnpackTrd2d.cxx +++ b/algo/detectors/trd2d/UnpackTrd2d.cxx @@ -39,7 +39,7 @@ namespace cbm::algo // - relative offset of the MS wrt the TS // - FASP epoch offset for current CROB // - TRD2D system offset wrt to experiment time (e.g. T0) - uint64_t time = uint64_t((msDescr.idx - tTimeslice - fSystemTimeOffset) / 12.5); + uint64_t time = uint64_t((msDescr.idx - tTimeslice - fParams.fSystemTimeOffset) / 12.5); // Get parameters for current eq id. const uint8_t crob_id = fParams.fCrobId; diff --git a/algo/detectors/trd2d/UnpackTrd2d.h b/algo/detectors/trd2d/UnpackTrd2d.h index 25cc2886c2f0ce76ec94f87d837e8cbae0f20f4e..9cb8a3580fe236bbae0418fa7bb8e6d5963de94e 100644 --- a/algo/detectors/trd2d/UnpackTrd2d.h +++ b/algo/detectors/trd2d/UnpackTrd2d.h @@ -73,6 +73,7 @@ namespace cbm::algo ** @brief Parameters required for the TRD unpacking (specific to one component) **/ struct UnpackTrd2dPar { + int32_t fSystemTimeOffset = 0; ///< Time calibration parameter uint16_t fModId = 0; ///< Module ID of component uint8_t fCrobId = 0; ///< CROB ID of component std::vector<UnpackTrd2dAsicPar> fAsicParams = {}; ///< Parameters for each ASIC @@ -141,12 +142,6 @@ namespace cbm::algo UnpackTrd2dMonitorData fMonitor; ///< Container for monitoring data - /** - ** @brief Time offset for the system - ** @todo This should be module and channel dependent and included into the asic parameters - **/ - std::int32_t fSystemTimeOffset = 0; - bool pushDigis(std::vector<CbmTrdFaspMessage> messages, const uint64_t time); /** @brief Finalize component (e.g. copy from temp buffers) */ diff --git a/algo/unpack/Unpack.cxx b/algo/unpack/Unpack.cxx index 6c8eb331dbec78fa84ff3f78d48bd6f336069382..32cf018102167b17c14fcc41e026d11a36aaae2c 100644 --- a/algo/unpack/Unpack.cxx +++ b/algo/unpack/Unpack.cxx @@ -146,7 +146,7 @@ namespace cbm::algo auto mapEntry = fStsConfig.Map(equip, elink); elinkPar.fAddress = mapEntry.first; // Module address for this elink elinkPar.fAsicNr = mapEntry.second; // ASIC number within module - elinkPar.fTimeOffset = 0.; + elinkPar.fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::STS]; elinkPar.fAdcOffset = 1.; elinkPar.fAdcGain = 1.; elinkPar.fWalk = fStsConfig.WalkMap(elinkPar.fAddress, elinkPar.fAsicNr); @@ -165,7 +165,7 @@ namespace cbm::algo for (size_t elink = 0; elink < numElinks; elink++) { UnpackMuchElinkPar elinkPar; elinkPar.fAddress = fMuchConfig.Map(equip, elink); // Vector of MUCH addresses for this elink - elinkPar.fTimeOffset = 0.; + elinkPar.fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::MUCH]; par->fElinkParams.push_back(elinkPar); } fAlgoMuch[equip].SetParams(std::move(par)); @@ -180,7 +180,7 @@ namespace cbm::algo for (size_t elink = 0; elink < numElinks; elink++) { UnpackTofElinkPar elinkPar; elinkPar.fChannelUId = fTofConfig.Map(equip, elink); // Vector of TOF addresses for this elink - elinkPar.fTimeOffset = 0.; + elinkPar.fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::RPC]; par->fElinkParams.push_back(elinkPar); } fAlgoTof[equip].SetParams(std::move(par)); @@ -195,7 +195,7 @@ namespace cbm::algo for (size_t elink = 0; elink < numElinks; elink++) { UnpackBmonElinkPar elinkPar; elinkPar.fChannelUId = fBmonConfig.Map(equip, elink); // Vector of T0 addresses for this elink - elinkPar.fTimeOffset = 0.; + elinkPar.fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::T0]; par->fElinkParams.push_back(elinkPar); } fAlgoBmon[equip].SetParams(std::move(par)); @@ -208,8 +208,9 @@ namespace cbm::algo std::unique_ptr<UnpackRichPar> par(new UnpackRichPar()); std::map<uint32_t, std::vector<double>> compMap = fRichConfig.Map(equip); for (auto const& val : compMap) { - uint32_t address = val.first; - par->fElinkParams[address].fToTshift = val.second; + uint32_t address = val.first; + par->fElinkParams[address].fToTshift = val.second; + par->fElinkParams[address].fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::RICH]; } fAlgoRich[equip].SetParams(std::move(par)); L_(info) << "--- Configured equipment " << equip << " with " << fRichConfig.GetNumElinks(equip) << " elinks"; @@ -231,6 +232,7 @@ namespace cbm::algo auto addresses = fTrdConfig.Map(equip, crob, elink); elinkPar.fAddress = addresses.first; // Asic address for this elink elinkPar.fChanAddress = addresses.second; // Channel addresses for this elink + elinkPar.fTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::TRD]; crobPar.fElinkParams.push_back(elinkPar); } par->fCrobParams.push_back(crobPar); @@ -258,9 +260,10 @@ namespace cbm::algo chanPar.fDaqOffset = std::get<2>(pars); // Time calibration parameter asicPar.fChanParams.push_back(chanPar); } - auto comppars = fTrd2dConfig.CompMap(equip); - par->fModId = comppars.first; - par->fCrobId = comppars.second; + auto comppars = fTrd2dConfig.CompMap(equip); + par->fSystemTimeOffset = fSystemTimeOffset[fles::SubsystemIdentifier::TRD2D]; + par->fModId = comppars.first; + par->fCrobId = comppars.second; par->fAsicParams.push_back(asicPar); } fAlgoTrd2d[equip].SetParams(std::move(par)); diff --git a/algo/unpack/Unpack.h b/algo/unpack/Unpack.h index 57d72cb8d21da4176d42d04c1bc89703473c39f5..3071986f540a01d353038cecdffdecc41170a98f 100644 --- a/algo/unpack/Unpack.h +++ b/algo/unpack/Unpack.h @@ -132,6 +132,13 @@ namespace cbm::algo /** @brief RICH unpackers **/ std::map<uint16_t, UnpackRich> fAlgoRich = {}; + + /** @brief System time offsets **/ + std::map<fles::SubsystemIdentifier, int32_t> fSystemTimeOffset = { + {fles::SubsystemIdentifier::STS, -970}, {fles::SubsystemIdentifier::MUCH, -980}, + {fles::SubsystemIdentifier::RICH, 100}, {fles::SubsystemIdentifier::RPC, 40}, + {fles::SubsystemIdentifier::T0, 0}, {fles::SubsystemIdentifier::TRD, 1300}, + {fles::SubsystemIdentifier::TRD2D, -510}}; }; } // namespace cbm::algo