From ce3e0bcba7690d9ad47819b8ecb2a61113137f90 Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Wed, 25 Jun 2025 16:30:10 +0200 Subject: [PATCH] ITS: Vertexer remove unused code Signed-off-by: Felix Schlepper --- .../include/ITStracking/VertexerTraits.h | 16 +- .../ITS/tracking/src/VertexerTraits.cxx | 141 ------------------ 2 files changed, 1 insertion(+), 156 deletions(-) diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/VertexerTraits.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/VertexerTraits.h index a2429fe7270a8..54424136fcfe1 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/VertexerTraits.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/VertexerTraits.h @@ -73,24 +73,10 @@ class VertexerTraits virtual void computeVertices(const int iteration = 0); virtual void adoptTimeFrame(TimeFrame7* tf) noexcept { mTimeFrame = tf; } virtual void updateVertexingParameters(const std::vector& vrtPar, const TimeFrameGPUParameters& gpuTfPar); + // truth tracking void addTruthSeedingVertices(); - void computeVerticesInRof(int, - gsl::span&, - bounded_vector&, - bounded_vector&, - std::array&, - bounded_vector&, - bounded_vector&, - TimeFrame7*, - bounded_vector*, - const int iteration = 0); - - bounded_vector> selectClusters(const int* indexTable, - const std::array& selectedBinsRect, - const IndexTableUtils& utils); - // utils auto& getVertexingParameters() { return mVrtParams; } auto getVertexingParameters() const { return mVrtParams; } diff --git a/Detectors/ITSMFT/ITS/tracking/src/VertexerTraits.cxx b/Detectors/ITSMFT/ITS/tracking/src/VertexerTraits.cxx index a0f044c5f62ca..bf421a8f8d59d 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/VertexerTraits.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/VertexerTraits.cxx @@ -144,26 +144,6 @@ void trackletSelectionKernelHost( } } -bounded_vector> VertexerTraits::selectClusters(const int* indexTable, - const std::array& selectedBinsRect, - const IndexTableUtils& utils) -{ - bounded_vector> filteredBins{mMemoryPool.get()}; - int phiBinsNum{selectedBinsRect[3] - selectedBinsRect[1] + 1}; - if (phiBinsNum < 0) { - phiBinsNum += utils.getNphiBins(); - } - filteredBins.reserve(phiBinsNum); - for (int iPhiBin{selectedBinsRect[1]}, iPhiCount{0}; iPhiCount < phiBinsNum; - iPhiBin = ++iPhiBin == utils.getNphiBins() ? 0 : iPhiBin, iPhiCount++) { - const int firstBinIndex{utils.getBinIndex(selectedBinsRect[0], iPhiBin)}; - filteredBins.emplace_back( - indexTable[firstBinIndex], - utils.countRowSelectedBins(indexTable, iPhiBin, selectedBinsRect[0], selectedBinsRect[2])); - } - return filteredBins; -} - void VertexerTraits::updateVertexingParameters(const std::vector& vrtPar, const TimeFrameGPUParameters& tfPar) { mVrtParams = vrtPar; @@ -575,127 +555,6 @@ void VertexerTraits::computeVertices(const int iteration) #endif } -void VertexerTraits::computeVerticesInRof(int rofId, - gsl::span& lines, - bounded_vector& usedLines, - bounded_vector& clusterLines, - std::array& beamPosXY, - bounded_vector& vertices, - bounded_vector& verticesInRof, - TimeFrame7* tf, - bounded_vector* labels, - const int iteration) -{ - int foundVertices{0}; - auto nsigmaCut{std::min(mVrtParams[iteration].vertNsigmaCut * mVrtParams[iteration].vertNsigmaCut * (mVrtParams[iteration].vertRadiusSigma * mVrtParams[iteration].vertRadiusSigma + mVrtParams[iteration].trackletSigma * mVrtParams[iteration].trackletSigma), 1.98f)}; - const int numTracklets{static_cast(lines.size())}; - for (int line1{0}; line1 < numTracklets; ++line1) { - if (usedLines[line1]) { - continue; - } - for (int line2{line1 + 1}; line2 < numTracklets; ++line2) { - if (usedLines[line2]) { - continue; - } - auto dca{Line::getDCA(lines[line1], lines[line2])}; - if (dca < mVrtParams[iteration].pairCut) { - clusterLines.emplace_back(line1, lines[line1], line2, lines[line2]); - std::array tmpVertex{clusterLines.back().getVertex()}; - if (tmpVertex[0] * tmpVertex[0] + tmpVertex[1] * tmpVertex[1] > 4.f) { - clusterLines.pop_back(); - break; - } - usedLines[line1] = true; - usedLines[line2] = true; - for (int tracklet3{0}; tracklet3 < numTracklets; ++tracklet3) { - if (usedLines[tracklet3]) { - continue; - } - if (Line::getDistanceFromPoint(lines[tracklet3], tmpVertex) < mVrtParams[iteration].pairCut) { - clusterLines.back().add(tracklet3, lines[tracklet3]); - usedLines[tracklet3] = true; - tmpVertex = clusterLines.back().getVertex(); - } - } - break; - } - } - } - - if (mVrtParams[iteration].allowSingleContribClusters) { - auto beamLine = Line{{tf->getBeamX(), tf->getBeamY(), -50.f}, {tf->getBeamX(), tf->getBeamY(), 50.f}}; // use beam position as contributor - for (size_t iLine{0}; iLine < numTracklets; ++iLine) { - if (!usedLines[iLine]) { - auto dca = Line::getDCA(lines[iLine], beamLine); - if (dca < mVrtParams[iteration].pairCut) { - clusterLines.emplace_back(iLine, lines[iLine], -1, beamLine); // beamline must be passed as second line argument - } - } - } - } - - // Cluster merging - std::sort(clusterLines.begin(), clusterLines.end(), [](ClusterLines& cluster1, ClusterLines& cluster2) { return cluster1.getSize() > cluster2.getSize(); }); - size_t nClusters{clusterLines.size()}; - for (int iCluster1{0}; iCluster1 < nClusters; ++iCluster1) { - std::array vertex1{clusterLines[iCluster1].getVertex()}; - std::array vertex2{}; - for (int iCluster2{iCluster1 + 1}; iCluster2 < nClusters; ++iCluster2) { - vertex2 = clusterLines[iCluster2].getVertex(); - if (o2::gpu::GPUCommonMath::Abs(vertex1[2] - vertex2[2]) < mVrtParams[iteration].clusterCut) { - float distance{(vertex1[0] - vertex2[0]) * (vertex1[0] - vertex2[0]) + - (vertex1[1] - vertex2[1]) * (vertex1[1] - vertex2[1]) + - (vertex1[2] - vertex2[2]) * (vertex1[2] - vertex2[2])}; - if (distance < mVrtParams[iteration].pairCut * mVrtParams[iteration].pairCut) { - for (auto label : clusterLines[iCluster2].getLabels()) { - clusterLines[iCluster1].add(label, lines[label]); - vertex1 = clusterLines[iCluster1].getVertex(); - } - clusterLines.erase(clusterLines.begin() + iCluster2); - --iCluster2; - --nClusters; - } - } - } - } - - std::sort(clusterLines.begin(), clusterLines.end(), - [](ClusterLines& cluster1, ClusterLines& cluster2) { return cluster1.getSize() > cluster2.getSize(); }); // ensure clusters are ordered by contributors, so that we can cut after the first. - bool atLeastOneFound{false}; - for (int iCluster{0}; iCluster < nClusters; ++iCluster) { - bool lowMultCandidate{false}; - double beamDistance2{(tf->getBeamX() - clusterLines[iCluster].getVertex()[0]) * (tf->getBeamX() - clusterLines[iCluster].getVertex()[0]) + - (tf->getBeamY() - clusterLines[iCluster].getVertex()[1]) * (tf->getBeamY() - clusterLines[iCluster].getVertex()[1])}; - - if (atLeastOneFound && (lowMultCandidate = clusterLines[iCluster].getSize() < mVrtParams[iteration].clusterContributorsCut)) { // We might have pile up with nContr > cut. - lowMultCandidate &= (beamDistance2 < mVrtParams[iteration].lowMultBeamDistCut * mVrtParams[iteration].lowMultBeamDistCut); - if (!lowMultCandidate) { // Not the first cluster and not a low multiplicity candidate, we can remove it - clusterLines.erase(clusterLines.begin() + iCluster); - nClusters--; - continue; - } - } - if (beamDistance2 < nsigmaCut && o2::gpu::GPUCommonMath::Abs(clusterLines[iCluster].getVertex()[2]) < mVrtParams[iteration].maxZPositionAllowed) { - atLeastOneFound = true; - ++foundVertices; - vertices.emplace_back(o2::math_utils::Point3D(clusterLines[iCluster].getVertex()[0], - clusterLines[iCluster].getVertex()[1], - clusterLines[iCluster].getVertex()[2]), - clusterLines[iCluster].getRMS2(), // Symm matrix. Diagonal: RMS2 components, - // off-diagonal: square mean of projections on planes. - clusterLines[iCluster].getSize(), // Contributors - clusterLines[iCluster].getAvgDistance2()); // In place of chi2 - vertices.back().setTimeStamp(clusterLines[iCluster].getROF()); - if (labels) { - for (auto& index : clusterLines[iCluster].getLabels()) { - labels->push_back(tf->getLinesLabel(rofId)[index]); // then we can use nContributors from vertices to get the labels - } - } - } - } - verticesInRof.push_back(foundVertices); -} - void VertexerTraits::addTruthSeedingVertices() { LOGP(info, "Using truth seeds as vertices; will skip computations");