@@ -179,7 +179,6 @@ void GPUTPCGMMerger::CheckMergedTracks()
179179 if (track.PrevNeighbour () >= 0 ) {
180180 continue ;
181181 }
182- int32_t leg = 0 ;
183182 GPUTPCGMSectorTrack *trbase = &track, *tr = &track;
184183 while (true ) {
185184 int32_t iTrk = tr - mSectorTrackInfos ;
@@ -200,7 +199,6 @@ void GPUTPCGMMerger::CheckMergedTracks()
200199 if (tr->PrevSegmentNeighbour () >= 0 ) {
201200 break ;
202201 }
203- leg++;
204202 continue ;
205203 }
206204 break ;
@@ -1463,15 +1461,15 @@ GPUd() void GPUTPCGMMerger::CollectMergedTracks(int32_t nBlocks, int32_t nThread
14631461 int32_t leg = 0 ;
14641462 int32_t lastMergedSegment = -1 ;
14651463 while (true ) {
1466- if (trbase) {
1464+ if (trbase && ! Param (). rec . tpc . dropLoopers ) {
14671465 int32_t jtr = trbase->NextNeighbour ();
14681466 if (jtr >= 0 ) {
14691467 trbase = &(mSectorTrackInfos [jtr]);
14701468 if (trbase->PrevSegmentNeighbour () >= 0 ) {
14711469 trbase = nullptr ;
14721470 } else {
14731471 trbase->SetPrevSegmentNeighbour (1000000001 );
1474- leg++ ;
1472+ leg-- ;
14751473 }
14761474 } else {
14771475 trbase = nullptr ;
@@ -1492,7 +1490,12 @@ GPUd() void GPUTPCGMMerger::CollectMergedTracks(int32_t nBlocks, int32_t nThread
14921490 }
14931491 itr += nThreads * nBlocks;
14941492 trbase->SetPrevSegmentNeighbour (1000000000 );
1493+ int32_t jtr = trbase->NextNeighbour ();
14951494 leg = 0 ;
1495+ while (jtr >= 0 ) {
1496+ leg++;
1497+ jtr = mSectorTrackInfos [jtr].NextNeighbour ();
1498+ }
14961499 lastMergedSegment = -1 ;
14971500 }
14981501
@@ -1535,7 +1538,7 @@ GPUd() void GPUTPCGMMerger::CollectMergedTracks(int32_t nBlocks, int32_t nThread
15351538 }
15361539
15371540 // unpack and sort clusters
1538- if (nParts > 1 && leg == 0 ) {
1541+ if (nParts > 1 ) {
15391542 GPUCommonAlgorithm::sort (trackParts, trackParts + nParts, [](const GPUTPCGMSectorTrack* a, const GPUTPCGMSectorTrack* b) {
15401543 GPUCA_DETERMINISTIC_CODE ( // clang-format off
15411544 if (a->X () != b->X ()) {
@@ -1554,11 +1557,6 @@ GPUd() void GPUTPCGMMerger::CollectMergedTracks(int32_t nBlocks, int32_t nThread
15541557 });
15551558 }
15561559
1557- if (Param ().rec .tpc .dropLoopers && leg > 0 ) {
1558- nParts = 1 ;
1559- leg = 0 ;
1560- }
1561-
15621560 trackCluster trackClusters[kMaxClusters ];
15631561 nHits = 0 ;
15641562 for (int32_t ipart = 0 ; ipart < nParts; ipart++) {
@@ -1570,7 +1568,7 @@ GPUd() void GPUTPCGMMerger::CollectMergedTracks(int32_t nBlocks, int32_t nThread
15701568 const GPUTPCTracker& trk = GetConstantMem ()->tpcTrackers [t->Sector ()];
15711569 const GPUTPCHitId& ic = trk.TrackHits ()[t->OrigTrack ()->FirstHitID () + i];
15721570 uint32_t id = trk.Data ().ClusterDataIndex (trk.Data ().Row (ic.RowIndex ()), ic.HitIndex ()) + GetConstantMem ()->ioPtrs .clustersNative ->clusterOffset [t->Sector ()][0 ];
1573- *c2 = trackCluster{id, (uint8_t )ic.RowIndex (), t->Sector (), t-> Leg () };
1571+ *c2 = trackCluster{id, (uint8_t )ic.RowIndex (), t->Sector ()};
15741572 }
15751573 nHits += nTrackHits;
15761574 }
@@ -1651,7 +1649,6 @@ GPUd() void GPUTPCGMMerger::CollectMergedTracks(int32_t nBlocks, int32_t nThread
16511649 cl[i].row = trackClusters[i].row ;
16521650 cl[i].num = trackClusters[i].id ;
16531651 cl[i].sector = trackClusters[i].sector ;
1654- cl[i].leg = trackClusters[i].leg ;
16551652 }
16561653
16571654 uint32_t iOutputTrack = CAMath::AtomicAdd (&mMemory ->nMergedTracks , 1u );
@@ -1664,7 +1661,7 @@ GPUd() void GPUTPCGMMerger::CollectMergedTracks(int32_t nBlocks, int32_t nThread
16641661 GPUTPCGMMergedTrack& mergedTrack = mMergedTracks [iOutputTrack];
16651662 mergedTrack.SetFlags (0 );
16661663 mergedTrack.SetOK (true );
1667- mergedTrack.SetLooper (leg > 0 || trbase-> NextNeighbour () >= 0 );
1664+ mergedTrack.SetLooper (leg > 0 || lastMergedSegment >= 0 );
16681665 mergedTrack.SetNClusters (nHits);
16691666 mergedTrack.SetFirstClusterRef (iMergedTrackFirstCluster);
16701667 GPUTPCGMTrackParam& p1 = mergedTrack.Param ();
@@ -1799,7 +1796,6 @@ GPUd() void GPUTPCGMMerger::Finalize1(int32_t nBlocks, int32_t nThreads, int32_t
17991796 if (!trk.OK () || trk.NClusters () == 0 ) {
18001797 continue ;
18011798 }
1802- uint8_t goodLeg = mClusters [trk.FirstClusterRef () + trk.NClusters () - 1 ].leg ;
18031799 for (uint32_t j = 0 ; j < trk.NClusters (); j++) {
18041800 int32_t id = mClusters [trk.FirstClusterRef () + j].num ;
18051801 uint32_t weight = mTrackOrderAttach [i] | attachAttached;
@@ -1809,7 +1805,7 @@ GPUd() void GPUTPCGMMerger::Finalize1(int32_t nBlocks, int32_t nThreads, int32_t
18091805 } else if (clusterState & GPUTPCGMMergedTrackHit::flagHighIncl) {
18101806 weight |= attachHighIncl;
18111807 }
1812- if (mClusters [ trk.FirstClusterRef () + j]. leg == goodLeg ) {
1808+ if (trk.Leg () == 0 ) {
18131809 weight |= attachGoodLeg;
18141810 }
18151811 CAMath::AtomicMax (&mClusterAttachment [id], weight);
0 commit comments