diff --git a/algo/detectors/trd2d/ReadoutConfig.h b/algo/detectors/trd2d/ReadoutConfig.h index f63026808fca972c0f5214a94def28349da9052e..84c7266b18ea8ce3cbede864541a08b426946afd 100644 --- a/algo/detectors/trd2d/ReadoutConfig.h +++ b/algo/detectors/trd2d/ReadoutConfig.h @@ -44,7 +44,7 @@ namespace cbm::algo::trd2d struct ChanMapping { int32_t padAddress; /// map pad and pairing to FASP channel bool maskFlag; /// HW mask flag for channel - uint8_t tOffset; /// time correction in clk + int8_t tOffset; /// time correction in clk uint16_t lThreshold; /// SW threshold for ringing channels CBM_YAML_FORMAT(YAML::Flow); diff --git a/algo/detectors/trd2d/Unpack.cxx b/algo/detectors/trd2d/Unpack.cxx index 5cc2d37bca409192ee37a1a267642e6934308ef3..d4f661e1a40a67134ef8a81d443cf06d3905357d 100644 --- a/algo/detectors/trd2d/Unpack.cxx +++ b/algo/detectors/trd2d/Unpack.cxx @@ -51,6 +51,7 @@ Unpack::Unpack(const Config& config) : fConfig(config) {calCh.noise.tDelay, calCh.noise.tWindow, calCh.noise.lDThres, calCh.noise.lSThres}}; chanPar.fMask = pars.maskFlag; // Flag channel mask chanPar.fDaqOffset = pars.tOffset; // Time calibration parameter + par.toff[ch/2] = pars.tOffset; chanPar.fSignalThres = pars.lThreshold; // Threshold cut asicPar.fChanParams.push_back(chanPar); } diff --git a/algo/detectors/trd2d/UnpackMS.cxx b/algo/detectors/trd2d/UnpackMS.cxx index 9851cd5d1235ea3eba74fbfe5f52e75d4542fb0f..19f9b8dfe616ab4cdaadcd4c3d716b282dac605e 100644 --- a/algo/detectors/trd2d/UnpackMS.cxx +++ b/algo/detectors/trd2d/UnpackMS.cxx @@ -442,7 +442,9 @@ namespace cbm::algo::trd2d * Correct the time with the system time offset which is derived in calibration.*/ uint64_t gtime = id.GetTime() * fAsicClockPeriod; gtime >>= 1; - if (gtime >= uint64_t(fParams.fSystemTimeOffset)) gtime -= fParams.fSystemTimeOffset; + int toffGlobalCorrection = fParams.fSystemTimeOffset + fParams.toff[ipad]; + if (toffGlobalCorrection > 0 && gtime < uint64_t(toffGlobalCorrection)) gtime = 0; + else gtime -= (fParams.fSystemTimeOffset + fParams.toff[ipad]); id.SetTime(gtime); outputDigis.emplace_back(std::move(id)); } @@ -474,7 +476,7 @@ namespace cbm::algo::trd2d if (calPar.noise.fSignalThres && imess.data <= calPar.noise.fSignalThres) continue; const uint32_t pad = mch / 2; const bool hasPairingR = bool(chPar.fPadAddress > 0); - const uint64_t lTime = time + imess.tlab + calPar.fDaqOffset; + const uint64_t lTime = time + imess.tlab; const uint16_t sgn = uint16_t((imess.data - fParams.fRefSignal) * calPar.fGainFee - calPar.fBaseline + fParams.fRefSignal); const uint16_t lchR = hasPairingR ? sgn : 0; diff --git a/algo/detectors/trd2d/UnpackMS.h b/algo/detectors/trd2d/UnpackMS.h index b09536dfde21d098ca73e1cc24046f6441193f81..c75452a6a4a1baa4e070f050080d150c67b77e7d 100644 --- a/algo/detectors/trd2d/UnpackMS.h +++ b/algo/detectors/trd2d/UnpackMS.h @@ -171,6 +171,7 @@ namespace cbm::algo::trd2d std::map<uint8_t, UnpackAsicPar> fAsicParams = {}; ///< Parameters for each ASIC std::array<CalibChannelPar, NFASPMOD* NFASPCH> fCalibParams = {}; ///< Parameters for each ASIC channel for each module + int toff[NFASPMOD * NFASPPAD]; /** \brief Write to the debug stream the content of the current param object*/ void dump() const;