From 063c2fd33f68fe28890acea677c64bfcbcdf5725 Mon Sep 17 00:00:00 2001 From: Tomasz Ostafin Date: Wed, 11 Dec 2024 20:58:04 +0100 Subject: [PATCH] Encode LS and TO with the same abs value --- CalibPPS/TimingCalibration/src/DoublePeakCorrection.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CalibPPS/TimingCalibration/src/DoublePeakCorrection.cc b/CalibPPS/TimingCalibration/src/DoublePeakCorrection.cc index 36eba263ba517..dd0077bf0558d 100644 --- a/CalibPPS/TimingCalibration/src/DoublePeakCorrection.cc +++ b/CalibPPS/TimingCalibration/src/DoublePeakCorrection.cc @@ -126,9 +126,12 @@ double DoublePeakCorrection::getCorrectedLeadingTime(const double leadingTime, double DoublePeakCorrection::getEncodedLsAndTimeOffset(const PlaneKey& planeKey) const { if (auto it = lsAndTimeOffsets_.find(planeKey); it != std::end(lsAndTimeOffsets_)) { - constexpr double encodingMultiple = 100'000.0; const auto [doublePeakLs, doublePeakTimeOffset] = it->second; - return doublePeakLs * encodingMultiple + doublePeakTimeOffset; + constexpr unsigned int lsEncodingMultiple{100}; + if (doublePeakTimeOffset >= 0.0) { + return doublePeakLs * lsEncodingMultiple + doublePeakTimeOffset; + } + return -(doublePeakLs * lsEncodingMultiple - doublePeakTimeOffset); } return 0.0; }