From 406792c44ec86f94bd787f319ab1803f34d0b9b6 Mon Sep 17 00:00:00 2001 From: Matthias Kleiner Date: Fri, 27 Nov 2026 13:29:42 +0100 Subject: [PATCH] SVertexer: fix V0 index of cascades when the V0 is cloned for other PVs Fixes two errors in the V0 index that SVertexer sets in cascades when a V0 is cloned with another primary vertex for a cascade: 1. checkCascades: when a second cascade reuses the clone already made for its primary vertex, the clone's index was taken from mV0sTmp.size(). mV0sTmp is only filled with createFullV0s=true, so with the default the index is 0 and the cascade points to V0 0 of the thread, a V0 with other tracks. Introduced in c07f254eb5. 2. checkV0: cascades that use the V0 with its own primary vertex got nV0Ini. The clones are added before the V0 itself, so these cascades pointed to the first clone: same tracks, but another primary vertex. This happens for any createFullV0s setting. Co-Authored-By: Claude Opus 5.5 --- Detectors/Vertexing/src/SVertexer.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Detectors/Vertexing/src/SVertexer.cxx b/Detectors/Vertexing/src/SVertexer.cxx index 44e78fd911056..a8601f2167065 100644 --- a/Detectors/Vertexing/src/SVertexer.cxx +++ b/Detectors/Vertexing/src/SVertexer.cxx @@ -830,9 +830,11 @@ bool SVertexer::checkV0(const TrackCand& seedP, const TrackCand& seedN, int iP, } if (nV0Used) { // need to fix the index of V0 for the cascades using this v0 + // it is added below, after the clones of it which checkCascades added for cascades at other vertices + const int v0ID = mV0sIdxTmp[ithread].size(); for (unsigned int ic = nCascIni; ic < mCascadesIdxTmp[ithread].size(); ic++) { if (mCascadesIdxTmp[ithread][ic].getV0ID() == -1) { - mCascadesIdxTmp[ithread][ic].setV0ID(nV0Ini); + mCascadesIdxTmp[ithread][ic].setV0ID(v0ID); } } } @@ -1005,7 +1007,7 @@ int SVertexer::checkCascades(const V0Index& v0Idx, const V0& v0, float rv0, std: } else { // add V0 clone for this cascade (may be used also by other cascades) const auto& pv = mPVertices[cascVtxID]; cascIdx.setV0ID(mV0sIdxTmp[ithread].size()); // set the new V0 index in the cascade - pvMap[cascVtxID] = mV0sTmp[ithread].size(); // add the new V0 index to the map + pvMap[cascVtxID] = mV0sIdxTmp[ithread].size(); // add the new V0 index to the map (mV0sTmp is filled only with createFullV0s) mV0sIdxTmp[ithread].emplace_back(cascVtxID, v0Idx.getProngs()); if (mSVParams->createFullV0s) { mV0sTmp[ithread].push_back(v0);