diff --git a/Detectors/ITSMFT/ITS/tracking/src/ClusterLines.cxx b/Detectors/ITSMFT/ITS/tracking/src/ClusterLines.cxx index 32b78d4f2ef18..570f58ca2695d 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/ClusterLines.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/ClusterLines.cxx @@ -369,15 +369,24 @@ bool ClusterLines::operator==(const ClusterLines& rhs) const GPUhdi() void ClusterLines::updateROFPoll(const Line& line) { - // Boyer-Moore voting for rof label - if (mROFWeight == 0) { + // option 1: Boyer-Moore voting for rof label + // if (mROFWeight == 0) { + // mROF = line.getMinROF(); + // mROFWeight = 1; + // } else { + // if (mROF == line.getMinROF()) { + // mROFWeight++; + // } else { + // mROFWeight--; + // } + // } + + // option 2 + if (mROF == -1) { mROF = line.getMinROF(); - mROFWeight = 1; } else { - if (mROF == line.getMinROF()) { - mROFWeight++; - } else { - mROFWeight--; + if (line.getMinROF() < mROF) { + mROF = line.getMinROF(); } } } diff --git a/Detectors/ITSMFT/ITS/tracking/src/TimeFrame.cxx b/Detectors/ITSMFT/ITS/tracking/src/TimeFrame.cxx index b75a475df3577..11acc43082e12 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/TimeFrame.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/TimeFrame.cxx @@ -98,17 +98,30 @@ void TimeFrame::addPrimaryVertices(const std::vector& vertices, const in void TimeFrame::addPrimaryVertices(const gsl::span& vertices, const int rofId) { - // auto rofId = mROFramesPV.size(); + std::vector futureVertices; for (const auto& vertex : vertices) { - mPrimaryVertices.emplace_back(vertex); - if (!isBeamPositionOverridden) { + if (vertex.getTimeStamp().getTimeStamp() < rofId) { // put a copy in the past + insertLateVertex(vertex); + } else { + if (vertex.getTimeStamp().getTimeStamp() > rofId) { // or put a copy in the future + futureVertices.emplace_back(vertex); + } + } + mPrimaryVertices.emplace_back(vertex); // put a copy in the present + if (!isBeamPositionOverridden) { // beam position is updated only at first occurrence of the vertex. A bit sketchy if we have past/future vertices, it should not impact too much. const int w{vertex.getNContributors()}; mBeamPos[0] = (mBeamPos[0] * mBeamPosWeight + vertex.getX() * w) / (mBeamPosWeight + w); mBeamPos[1] = (mBeamPos[1] * mBeamPosWeight + vertex.getY() * w) / (mBeamPosWeight + w); mBeamPosWeight += w; } + mROFramesPV.push_back(mPrimaryVertices.size()); // current rof must have number of vertices up to present + + if (futureVertices.size() > 0) { // append future vertices. In the last rofId we cannot have ones from the next, so we are never here. + for (auto& vertex : futureVertices) { + mPrimaryVertices.emplace_back(vertex); + } + } } - mROFramesPV.push_back(mPrimaryVertices.size()); } // void TimeFrame::addPrimaryVertices(const std::vector& lVertices)