30 const uint32_t iRow = iBlock;
33 for (uint32_t
i = iThread;
i < grid.N();
i += nThreads) {
34 uint32_t jMin = tracker.Data().FirstHitInBin(
row,
i);
35 uint32_t jMax = tracker.Data().FirstHitInBin(
row,
i + 1);
36 const uint32_t
n = jMax - jMin;
38 auto*
GPUrestrict() tmp2 = tracker.Data().HitWeights() +
row.HitNumberOffset() + jMin;
40 int32_t*
GPUrestrict() clusterId = tracker.Data().ClusterDataIndex() +
row.HitNumberOffset() + jMin;
41 for (uint32_t
j = 0;
j <
n;
j++) {
44 GPUCommonAlgorithm::sort(tmp1, tmp1 +
n, [&hitData, &clusterId](
const calink&
a,
const calink&
b) {
45 if (hitData[
a].
x != hitData[
b].
x) {
46 return hitData[
a].
x < hitData[
b].
x;
48 if (hitData[
a].
y != hitData[
b].
y) {
49 return hitData[
a].
y < hitData[
b].
y;
51 return clusterId[
a] < clusterId[
b];
53 for (uint32_t
j = 0;
j <
n;
j++) {
54 tmp2[
j] = hitData[
j].
x;
56 for (uint32_t
j = 0;
j <
n;
j++) {
57 hitData[
j].
x = tmp2[tmp1[
j]];
59 for (uint32_t
j = 0;
j <
n;
j++) {
60 tmp2[
j] = hitData[
j].
y;
62 for (uint32_t
j = 0;
j <
n;
j++) {
63 hitData[
j].
y = tmp2[tmp1[
j]];
65 for (uint32_t
j = 0;
j <
n;
j++) {
66 tmp2[
j] = clusterId[
j];
68 for (uint32_t
j = 0;
j <
n;
j++) {
69 clusterId[
j] = tmp2[tmp1[
j]];
77 if (iThread || iBlock) {
80 GPUCommonAlgorithm::sortDeviceDynamic(tracker.TrackletStartHits(), tracker.TrackletStartHits() + *tracker.NStartHits(), [](
const GPUTPCHitId&
a,
const GPUTPCHitId&
b) {
81 if (a.RowIndex() != b.RowIndex()) {
82 return (a.RowIndex() < b.RowIndex());
84 return (
a.HitIndex() <
b.HitIndex());
91 if (iThread || iBlock) {
95 if (trk1.NHits() != trk2.NHits()) {
96 return trk1.NHits() > trk2.NHits();
98 if (trk1.Param().Y() != trk2.Param().Y()) {
99 return trk1.Param().Y() > trk2.Param().Y();
101 if (trk1.Param().Z() != trk2.Param().Z()) {
102 return trk1.Param().Z() > trk2.Param().Z();
104 if (tracker.TrackHits()[trk1.FirstHitID()].RowIndex() != tracker.TrackHits()[trk2.FirstHitID()].RowIndex()) {
105 return tracker.TrackHits()[trk1.FirstHitID()].RowIndex() > tracker.TrackHits()[trk2.FirstHitID()].RowIndex();
107 return tracker.TrackHits()[trk1.FirstHitID()].HitIndex() > tracker.TrackHits()[trk2.FirstHitID()].HitIndex();
109 GPUCommonAlgorithm::sortDeviceDynamic(tracker.Tracks(), tracker.Tracks() + tracker.CommonMemory()->nLocalTracks, sorter);
110 GPUCommonAlgorithm::sortDeviceDynamic(tracker.Tracks() + tracker.CommonMemory()->nLocalTracks, tracker.Tracks() + *tracker.NTracks(), sorter);