29 const uint32_t iRow = iBlock;
32 for (uint32_t
i = iThread;
i < grid.N();
i += nThreads) {
33 uint32_t jMin = tracker.Data().FirstHitInBin(
row,
i);
34 uint32_t jMax = tracker.Data().FirstHitInBin(
row,
i + 1);
35 const uint32_t
n = jMax - jMin;
37 auto*
GPUrestrict() tmp2 = tracker.Data().HitWeights() +
row.HitNumberOffset() + jMin;
39 int32_t*
GPUrestrict() clusterId = tracker.Data().ClusterDataIndex() +
row.HitNumberOffset() + jMin;
40 for (uint32_t
j = 0;
j <
n;
j++) {
43 GPUCommonAlgorithm::sort(tmp1, tmp1 +
n, [&hitData, &clusterId](
const calink&
a,
const calink&
b) {
44 if (hitData[
a].
x != hitData[
b].
x) {
45 return hitData[
a].
x < hitData[
b].
x;
47 if (hitData[
a].
y != hitData[
b].
y) {
48 return hitData[
a].
y < hitData[
b].
y;
50 return clusterId[
a] < clusterId[
b];
52 for (uint32_t
j = 0;
j <
n;
j++) {
53 tmp2[
j] = hitData[
j].
x;
55 for (uint32_t
j = 0;
j <
n;
j++) {
56 hitData[
j].
x = tmp2[tmp1[
j]];
58 for (uint32_t
j = 0;
j <
n;
j++) {
59 tmp2[
j] = hitData[
j].
y;
61 for (uint32_t
j = 0;
j <
n;
j++) {
62 hitData[
j].
y = tmp2[tmp1[
j]];
64 for (uint32_t
j = 0;
j <
n;
j++) {
65 tmp2[
j] = clusterId[
j];
67 for (uint32_t
j = 0;
j <
n;
j++) {
68 clusterId[
j] = tmp2[tmp1[
j]];
76 if (iThread || iBlock) {
79 GPUCommonAlgorithm::sortDeviceDynamic(tracker.TrackletStartHits(), tracker.TrackletStartHits() + *tracker.NStartHits(), [](
const GPUTPCHitId&
a,
const GPUTPCHitId&
b) {
80 if (a.RowIndex() != b.RowIndex()) {
81 return (a.RowIndex() < b.RowIndex());
83 return (
a.HitIndex() <
b.HitIndex());
90 if (iThread || iBlock) {
94 if (trk1.NHits() != trk2.NHits()) {
95 return trk1.NHits() > trk2.NHits();
97 if (trk1.Param().Y() != trk2.Param().Y()) {
98 return trk1.Param().Y() > trk2.Param().Y();
100 if (trk1.Param().Z() != trk2.Param().Z()) {
101 return trk1.Param().Z() > trk2.Param().Z();
103 if (tracker.TrackHits()[trk1.FirstHitID()].RowIndex() != tracker.TrackHits()[trk2.FirstHitID()].RowIndex()) {
104 return tracker.TrackHits()[trk1.FirstHitID()].RowIndex() > tracker.TrackHits()[trk2.FirstHitID()].RowIndex();
106 return tracker.TrackHits()[trk1.FirstHitID()].HitIndex() > tracker.TrackHits()[trk2.FirstHitID()].HitIndex();
108 GPUCommonAlgorithm::sortDeviceDynamic(tracker.Tracks(), tracker.Tracks() + tracker.CommonMemory()->nLocalTracks, sorter);
109 GPUCommonAlgorithm::sortDeviceDynamic(tracker.Tracks() + tracker.CommonMemory()->nLocalTracks, tracker.Tracks() + *tracker.NTracks(), sorter);