|
17 | 17 | #include <thrust/execution_policy.h> |
18 | 18 | #include <thrust/device_ptr.h> |
19 | 19 | #include <thrust/device_vector.h> |
| 20 | +#include <thrust/sequence.h> |
20 | 21 | #include <thrust/sort.h> |
21 | 22 | #include <thrust/reduce.h> |
22 | 23 | #include <thrust/functional.h> |
@@ -86,10 +87,12 @@ struct is_valid_pair { |
86 | 87 | } |
87 | 88 | }; |
88 | 89 |
|
89 | | -struct compare_track_chi2 { |
90 | | - GPUhd() bool operator()(const TrackITSExt& a, const TrackITSExt& b) const |
| 90 | +struct compare_track_index_chi2 { |
| 91 | + const TrackITSExt* tracks; |
| 92 | + |
| 93 | + GPUhd() bool operator()(const int a, const int b) const |
91 | 94 | { |
92 | | - return o2::its::track::isBetter(a, b); |
| 95 | + return o2::its::track::isBetter(tracks[a], tracks[b]); |
93 | 96 | } |
94 | 97 | }; |
95 | 98 |
|
@@ -1159,6 +1162,7 @@ void computeTrackSeedHandler(TrackSeed<NLayers>* trackSeeds, |
1159 | 1162 | const int** clustersIndexTables, |
1160 | 1163 | const int** ROFClusters, |
1161 | 1164 | o2::its::TrackITSExt* tracks, |
| 1165 | + int* trackIndices, |
1162 | 1166 | const int* seedLUT, |
1163 | 1167 | TrackExtensionHypothesis<NLayers>* activeHypotheses, |
1164 | 1168 | TrackExtensionHypothesis<NLayers>* nextHypotheses, |
@@ -1222,8 +1226,9 @@ void computeTrackSeedHandler(TrackSeed<NLayers>* trackSeeds, |
1222 | 1226 | propagator, // const o2::base::Propagator* |
1223 | 1227 | matCorrType); // o2::base::PropagatorF::MatCorrType |
1224 | 1228 | auto sync_policy = THRUST_NAMESPACE::par(gpu::TypedAllocator<char>(alloc)); |
1225 | | - thrust::device_ptr<o2::its::TrackITSExt> tr_ptr(tracks); |
1226 | | - thrust::sort(sync_policy, tr_ptr, tr_ptr + nTracks, gpu::compare_track_chi2()); |
| 1229 | + thrust::device_ptr<int> trackIndicesPtr(trackIndices); |
| 1230 | + thrust::sequence(sync_policy, trackIndicesPtr, trackIndicesPtr + nTracks); |
| 1231 | + thrust::sort(sync_policy, trackIndicesPtr, trackIndicesPtr + nTracks, gpu::compare_track_index_chi2{tracks}); |
1227 | 1232 | } |
1228 | 1233 |
|
1229 | 1234 | /// Explicit instantiation of ITS2 handlers |
@@ -1401,6 +1406,7 @@ template void computeTrackSeedHandler(TrackSeed<7>* trackSeeds, |
1401 | 1406 | const int** clustersIndexTables, |
1402 | 1407 | const int** ROFClusters, |
1403 | 1408 | o2::its::TrackITSExt* tracks, |
| 1409 | + int* trackIndices, |
1404 | 1410 | const int* seedLUT, |
1405 | 1411 | TrackExtensionHypothesis<7>* activeHypotheses, |
1406 | 1412 | TrackExtensionHypothesis<7>* nextHypotheses, |
@@ -1602,6 +1608,7 @@ template void computeTrackSeedHandler(TrackSeed<11>* trackSeeds, |
1602 | 1608 | const int** clustersIndexTables, |
1603 | 1609 | const int** ROFClusters, |
1604 | 1610 | o2::its::TrackITSExt* tracks, |
| 1611 | + int* trackIndices, |
1605 | 1612 | const int* seedLUT, |
1606 | 1613 | TrackExtensionHypothesis<11>* activeHypotheses, |
1607 | 1614 | TrackExtensionHypothesis<11>* nextHypotheses, |
|
0 commit comments