Skip to content

Commit f488c19

Browse files
committed
GPU TPC: Add attachProtect flag, and mark all clusters also in the history of protected tracks such
1 parent b4180ad commit f488c19

File tree

5 files changed

+38
-10
lines changed

5 files changed

+38
-10
lines changed

GPU/GPUTracking/DataCompression/GPUTPCClusterRejection.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,19 @@ struct GPUTPCClusterRejection {
2525
{
2626
(void)counts; // FIXME: Avoid incorrect -Wunused-but-set-parameter warning
2727
(void)mev200;
28+
bool retVal = false;
2829
if (attach == 0) {
29-
return false;
30+
retVal = false;
3031
} else if ((attach & gputpcgmmergertypes::attachGoodLeg) == 0) {
3132
if constexpr (C) {
3233
counts->nLoopers++;
3334
}
34-
return true;
35+
retVal = true;
3536
} else if (attach & gputpcgmmergertypes::attachHighIncl) {
3637
if constexpr (C) {
3738
counts->nHighIncl++;
3839
}
39-
return true;
40+
retVal = true;
4041
} else if (attach & gputpcgmmergertypes::attachTube) {
4142
protect = true;
4243
if constexpr (C) {
@@ -46,17 +47,23 @@ struct GPUTPCClusterRejection {
4647
counts->nTube++;
4748
}
4849
}
49-
return false;
50+
retVal = false;
5051
} else if ((attach & gputpcgmmergertypes::attachGood) == 0) {
5152
protect = true;
5253
if constexpr (C) {
5354
counts->nRejected++;
5455
}
55-
return false;
56+
retVal = false;
5657
} else {
5758
physics = true;
58-
return false;
59+
retVal = false;
5960
}
61+
62+
if (attach & gputpcgmmergertypes::attachProtect) {
63+
protect = true;
64+
retVal = false;
65+
}
66+
return retVal;
6067
}
6168

6269
static constexpr inline bool GetIsRejected(int32_t attach)

GPU/GPUTracking/DataCompression/GPUTPCCompressionKernels.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ GPUdii() void GPUTPCCompressionKernels::Thread<GPUTPCCompressionKernels::step0at
5656
if ((attach & gputpcgmmergertypes::attachTrackMask) != i) {
5757
continue; // Main attachment to different track
5858
}
59-
bool rejectCluster = processors.param.rec.tpc.rejectionStrategy >= GPUSettings::RejectionStrategyA && (rejectTrk || GPUTPCClusterRejection::GetIsRejected(attach));
59+
bool rejectCluster = processors.param.rec.tpc.rejectionStrategy >= GPUSettings::RejectionStrategyA && !(attach & gputpcgmmergertypes::attachProtect) && (rejectTrk || GPUTPCClusterRejection::GetIsRejected(attach));
6060
if (rejectCluster) {
6161
compressor.mClusterStatus[hitId] = 1; // Cluster rejected, do not store
6262
continue;
63+
} else if (processors.param.rec.tpc.rejectionStrategy >= GPUSettings::RejectionStrategyA && rejectTrk) {
64+
continue;
6365
}
6466

6567
if (!(param.rec.tpc.compressionTypeMask & GPUSettings::CompressionTrackModel)) {
@@ -199,6 +201,9 @@ GPUd() bool GPUTPCCompression::rejectCluster(int32_t idx, GPUParam& GPUrestrict(
199201
if (GPUTPCClusterRejection::GetIsRejected(attach)) {
200202
return true;
201203
}
204+
if (attach & gputpcgmmergertypes::attachProtect) {
205+
return false;
206+
}
202207
int32_t id = attach & gputpcgmmergertypes::attachTrackMask;
203208
auto& trk = ioPtrs.mergedTracks[id];
204209
if (CAMath::Abs(trk.GetParam().GetQPt() * param.qptB5Scaler) > param.rec.tpc.rejectQPtB5 || trk.MergedLooper()) {

GPU/GPUTracking/Merger/GPUTPCGMMerger.cxx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,11 @@ GPUd() void GPUTPCGMMerger::PrepareForFit1(int32_t nBlocks, int32_t nThreads, in
18481848
GPUTPCGMMergedTrack& trk = mMergedTracks[i];
18491849
if (trk.OK()) {
18501850
for (uint32_t j = 0; j < trk.NClusters(); j++) {
1851-
mClusterAttachment[mClusters[trk.FirstClusterRef() + j].num] = attachAttached | attachGood;
1851+
uint32_t weight = attachAttached | attachGood;
1852+
if (CAMath::Abs(trk.GetParam().GetQPt() * Param().qptB5Scaler) <= Param().rec.tpc.rejectQPtB5 && !trk.MergedLooper() && trk.Leg() == 0) {
1853+
weight |= attachProtect;
1854+
}
1855+
mClusterAttachment[mClusters[trk.FirstClusterRef() + j].num] = weight;
18521856
CAMath::AtomicAdd(&mSharedCount[mClusters[trk.FirstClusterRef() + j].num], 1u);
18531857
}
18541858
if (!trk.CCE() && !trk.MergedLooper()) {
@@ -1896,7 +1900,9 @@ GPUd() void GPUTPCGMMerger::Finalize0(int32_t nBlocks, int32_t nThreads, int32_t
18961900
mTrackSort[mTrackOrderAttach[i]] = i;
18971901
}
18981902
for (uint32_t i = iBlock * nThreads + iThread; i < mMemory->nMergedTrackClusters; i += nThreads * nBlocks) {
1899-
mClusterAttachment[mClusters[i].num] = 0; // Reset adjacent attachment for attached clusters, set correctly below
1903+
if (!(mClusterAttachment[mClusters[i].num] & attachProtect)) {
1904+
mClusterAttachment[mClusters[i].num] = 0; // Reset adjacent attachment for attached clusters, set correctly below
1905+
}
19001906
}
19011907
}
19021908

@@ -1919,6 +1925,9 @@ GPUd() void GPUTPCGMMerger::Finalize1(int32_t nBlocks, int32_t nThreads, int32_t
19191925
if (trk.Leg() == 0) {
19201926
weight |= attachGoodLeg;
19211927
}
1928+
if (CAMath::Abs(trk.GetParam().GetQPt() * Param().qptB5Scaler) <= Param().rec.tpc.rejectQPtB5 && !trk.MergedLooper() && trk.Leg() == 0) {
1929+
weight |= attachProtect;
1930+
}
19221931
CAMath::AtomicMax(&mClusterAttachment[id], weight);
19231932
}
19241933
}

GPU/GPUTracking/Merger/GPUTPCGMMergerTypes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
namespace o2::gpu::gputpcgmmergertypes
2222
{
2323

24-
enum attachTypes { attachAttached = 0x40000000,
24+
enum attachTypes { attachProtect = 0x80000000,
25+
attachAttached = 0x40000000,
2526
attachGood = 0x20000000,
2627
attachGoodLeg = 0x10000000,
2728
attachTube = 0x08000000,

GPU/GPUTracking/Merger/GPUTPCGMTrackParam.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ GPUd() float GPUTPCGMTrackParam::AttachClusters(const GPUTPCGMMerger* GPUrestric
514514
const float stepZ = row.HstepZ();
515515
int32_t bin, ny, nz;
516516

517+
bool protect = CAMath::Abs(GetQPt() * Merger->Param().qptB5Scaler) <= Merger->Param().rec.tpc.rejectQPtB5 && goodLeg;
518+
517519
float err2Y, err2Z;
518520
Merger->Param().GetClusterErrors2(sector, iRow, Z, mP[2], mP[3], -1.f, 0.f, 0.f, err2Y, err2Z); // TODO: Use correct time/avgCharge
519521
const float sy2 = CAMath::Min(Merger->Param().rec.tpc.tubeMaxSize2, Merger->Param().rec.tpc.tubeChi2 * (err2Y + CAMath::Abs(mC[0]))); // Cov can be bogus when following circle
@@ -538,6 +540,10 @@ GPUd() float GPUTPCGMTrackParam::AttachClusters(const GPUTPCGMMerger* GPUrestric
538540
if (goodLeg) {
539541
myWeight |= gputpcgmmergertypes::attachGoodLeg;
540542
}
543+
if (protect) {
544+
myWeight |= gputpcgmmergertypes::attachProtect;
545+
}
546+
541547
for (int32_t k = 0; k <= nz; k++) {
542548
const int32_t mybin = bin + k * nBinsY;
543549
const uint32_t hitFst = firsthit[mybin];

0 commit comments

Comments
 (0)