From 72686871aa6538ff79b66f36705a26e734c6a0e5 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Sun, 17 Mar 2024 12:12:50 +0100 Subject: [PATCH] Sort by pT only good-quality tracks Port from CUDA to Alpaka the changes in #42428 by Silvio Donato. --- .../plugins/PixelTrackProducerFromSoAAlpaka.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RecoTracker/PixelTrackFitting/plugins/PixelTrackProducerFromSoAAlpaka.cc b/RecoTracker/PixelTrackFitting/plugins/PixelTrackProducerFromSoAAlpaka.cc index b6b21d5c17199..5769c8c53976c 100644 --- a/RecoTracker/PixelTrackFitting/plugins/PixelTrackProducerFromSoAAlpaka.cc +++ b/RecoTracker/PixelTrackFitting/plugins/PixelTrackProducerFromSoAAlpaka.cc @@ -178,8 +178,12 @@ void PixelTrackProducerFromSoAAlpaka::produce(edm::StreamID strea //sort index by pt std::vector sortIdxs(nTracks); std::iota(sortIdxs.begin(), sortIdxs.end(), 0); + // sort good-quality tracks by pt, keep bad-quality tracks at the bottom std::sort(sortIdxs.begin(), sortIdxs.end(), [&](int32_t const i1, int32_t const i2) { - return tsoa.view()[i1].pt() > tsoa.view()[i2].pt(); + if (quality[i1] >= minQuality_ && quality[i2] >= minQuality_) + return tsoa.view()[i1].pt() > tsoa.view()[i2].pt(); + else + return quality[i1] > quality[i2]; }); //store the index of the SoA: indToEdm[index_SoAtrack] -> index_edmTrack (if it exists)