Skip to content

Commit

Permalink
Encode LS and TO with the same abs value
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Ostafin committed Dec 11, 2024
1 parent 09e0bb6 commit 063c2fd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CalibPPS/TimingCalibration/src/DoublePeakCorrection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 063c2fd

Please sign in to comment.