Skip to content

Commit d526624

Browse files
sawenzelclaude
andcommitted
Keep strange tracks in decay order also with one vertexer thread
This makes the order of the tracked strangeness tables within a collision the same in MC as in data. - SVertexer sorted the strange tracks by decay only when running with more than one thread; MC reconstruction runs it with one. - The strange tracks are now sorted by decay in all cases. - The AOD producer groups them by collision with a stable sort, so the decay order within a collision is kept. https://its.cern.ch/jira/browse/O2-7197 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 29cf278 commit d526624

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎Detectors/AOD/src/AODProducerWorkflowSpec.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ void AODProducerWorkflowDPL::prepareStrangenessTracking(const o2::globaltracking
15271527
std::exclusive_scan(mVertexStrLUT.begin(), mVertexStrLUT.end(), mVertexStrLUT.begin(), 0);
15281528

15291529
// sort by collision ID
1530-
std::sort(mCollisionStrTrk.begin(), mCollisionStrTrk.end(), [](const auto& a, const auto& b) { return a.first < b.first; });
1530+
std::stable_sort(mCollisionStrTrk.begin(), mCollisionStrTrk.end(), [](const auto& a, const auto& b) { return a.first < b.first; });
15311531
mStrTrkIndices.clear();
15321532
mStrTrkIndices.resize(mCollisionStrTrk.size(), -1);
15331533
}

‎Detectors/Vertexing/src/SVertexer.cxx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ void SVertexer::produceOutput(o2::framework::ProcessingContext& pc)
225225

226226
std::vector<int> sortIdx(strTracksTmp.size());
227227
std::iota(sortIdx.begin(), sortIdx.end(), 0);
228-
// if mNTreads > 1 we need to sort tracks, clus and MCLabs by their mDecayRef
229-
if (mNThreads > 1 && mNStrangeTracks > 1) {
228+
// sort tracks, clus and MCLabs by their mDecayRef, also with one thread, so that they follow the vertex order
229+
if (mNStrangeTracks > 1) {
230230
std::sort(sortIdx.begin(), sortIdx.end(), [&strTracksTmp](int i1, int i2) { return strTracksTmp[i1].mDecayRef < strTracksTmp[i2].mDecayRef; });
231231
}
232232

0 commit comments

Comments
 (0)