@@ -1192,34 +1192,6 @@ struct GPUTPCGMMerger_CompareClusterIds {
11921192 }
11931193};
11941194
1195- struct GPUTPCGMMerger_CompareTracksAttachWeight {
1196- const GPUTPCGMMergedTrack* const mCmp ;
1197- GPUd () GPUTPCGMMerger_CompareTracksAttachWeight(GPUTPCGMMergedTrack* cmp) : mCmp (cmp) {}
1198- GPUd () bool operator ()(const int aa, const int bb)
1199- {
1200- const GPUTPCGMMergedTrack& GPUrestrict () a = mCmp [aa];
1201- const GPUTPCGMMergedTrack& GPUrestrict () b = mCmp [bb];
1202- return (CAMath::Abs (a.GetParam ().GetQPt ()) > CAMath::Abs (b.GetParam ().GetQPt ()));
1203- }
1204- };
1205-
1206- struct GPUTPCGMMerger_CompareTracksProcess {
1207- const GPUTPCGMMergedTrack* const mCmp ;
1208- GPUd () GPUTPCGMMerger_CompareTracksProcess(GPUTPCGMMergedTrack* cmp) : mCmp (cmp) {}
1209- GPUd () bool operator ()(const int aa, const int bb)
1210- {
1211- const GPUTPCGMMergedTrack& GPUrestrict () a = mCmp [aa];
1212- const GPUTPCGMMergedTrack& GPUrestrict () b = mCmp [bb];
1213- if (a.CCE () != b.CCE ()) {
1214- return a.CCE () > b.CCE ();
1215- }
1216- if (a.Legs () != b.Legs ()) {
1217- return a.Legs () > b.Legs ();
1218- }
1219- return a.NClusters () > b.NClusters ();
1220- }
1221- };
1222-
12231195GPUd () void GPUTPCGMMerger::LinkGlobalTracks(int nBlocks, int nThreads, int iBlock, int iThread)
12241196{
12251197 for (int itr = SliceTrackInfoGlobalFirst (0 ) + iBlock * nThreads + iThread; itr < SliceTrackInfoGlobalLast (NSLICES - 1 ); itr += nThreads * nBlocks) {
@@ -1536,7 +1508,19 @@ GPUd() void GPUTPCGMMerger::SortTracksPrepare(int nBlocks, int nThreads, int iBl
15361508
15371509GPUd () void GPUTPCGMMerger::SortTracks(int nBlocks, int nThreads, int iBlock, int iThread)
15381510{
1539- GPUCommonAlgorithm::sort (mTrackOrderProcess , mTrackOrderProcess + mMemory ->nOutputTracks , GPUTPCGMMerger_CompareTracksProcess (mOutputTracks ));
1511+ auto comp = [cmp = mOutputTracks ](const int aa, const int bb) {
1512+ const GPUTPCGMMergedTrack& GPUrestrict () a = cmp[aa];
1513+ const GPUTPCGMMergedTrack& GPUrestrict () b = cmp[bb];
1514+ if (a.CCE () != b.CCE ()) {
1515+ return a.CCE () > b.CCE ();
1516+ }
1517+ if (a.Legs () != b.Legs ()) {
1518+ return a.Legs () > b.Legs ();
1519+ }
1520+ return a.NClusters () > b.NClusters ();
1521+ };
1522+
1523+ GPUCommonAlgorithm::sortDeviceDynamic (mTrackOrderProcess , mTrackOrderProcess + mMemory ->nOutputTracks , comp);
15401524}
15411525
15421526GPUd () void GPUTPCGMMerger::PrepareClustersForFit0(int nBlocks, int nThreads, int iBlock, int iThread)
@@ -1550,7 +1534,13 @@ GPUd() void GPUTPCGMMerger::PrepareClustersForFit0(int nBlocks, int nThreads, in
15501534GPUd () void GPUTPCGMMerger::SortTracksQPt(int nBlocks, int nThreads, int iBlock, int iThread)
15511535{
15521536 unsigned int * trackSort = (unsigned int *)mTmpMem ;
1553- GPUCommonAlgorithm::sort (trackSort, trackSort + mMemory ->nOutputTracks , GPUTPCGMMerger_CompareTracksAttachWeight (mOutputTracks ));
1537+ auto comp = [cmp = mOutputTracks ](const int aa, const int bb) {
1538+ const GPUTPCGMMergedTrack& GPUrestrict () a = cmp[aa];
1539+ const GPUTPCGMMergedTrack& GPUrestrict () b = cmp[bb];
1540+ return (CAMath::Abs (a.GetParam ().GetQPt ()) > CAMath::Abs (b.GetParam ().GetQPt ()));
1541+ };
1542+
1543+ GPUCommonAlgorithm::sortDeviceDynamic (trackSort, trackSort + mMemory ->nOutputTracks , comp);
15541544}
15551545
15561546GPUd () void GPUTPCGMMerger::PrepareClustersForFit1(int nBlocks, int nThreads, int iBlock, int iThread)
0 commit comments