Skip to content

Commit 711eba5

Browse files
committed
Simplify HIP cluster creation
1 parent cf8c9dc commit 711eba5

1 file changed

Lines changed: 13 additions & 20 deletions

File tree

GPU/GPUTracking/TPCClusterFinder/GPUTPCCFCheckPadBaseline.cxx

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -519,28 +519,21 @@ GPUd() void GPUTPCCFHIPClusterizer::Thread<0>(int32_t nBlocks, int32_t nThreads,
519519

520520
for (uint32_t iTail = iThread + 1; iTail <= nTails; iTail += nThreads) {
521521

522-
auto* tail = &tails[iTail];
523-
522+
const auto* tail = &tails[iTail];
524523
if (tail->iPrev != 0) {
525524
continue;
526525
}
527526

528-
float qTot = tail->qTot;
529-
float qMax = tail->qMax;
530-
const float firstWeight = tail->qTot;
531-
const float firstPad = tail->pad;
532-
const float firstTime = HIPTailTimeMean(*tail);
533-
float padSum = firstWeight * firstPad;
534-
float padSqSum = firstWeight * firstPad * firstPad;
535-
float timeSum = firstWeight * firstTime;
536-
537-
uint32_t tailStart = tail->tailStart;
538-
uint32_t tailEnd = tail->tailEnd;
539-
540-
while (tail->iNext != 0) {
541-
542-
tail = &tails[tail->iNext];
527+
float qTot = 0;
528+
float qMax = 0;
529+
float padSum = 0;
530+
float padSqSum = 0;
531+
float timeSum = 0;
532+
uint32_t tailStart = (uint32_t)-1;
533+
uint32_t tailEnd = 0;
543534

535+
// Zero-th element is empty tail
536+
for (; tail != tails; tail = &tails[tail->iNext]) {
544537
const float tailWeight = tail->qTot;
545538
const float tailPad = tail->pad;
546539
const float tailTime = HIPTailTimeMean(*tail);
@@ -554,9 +547,9 @@ GPUd() void GPUTPCCFHIPClusterizer::Thread<0>(int32_t nBlocks, int32_t nThreads,
554547
}
555548

556549
const float weightSum = CAMath::Max(qTot, 1.f);
557-
float padMean = padSum / weightSum;
558-
float timeMean = timeSum / weightSum; // TODO: Use timebin of saturated signal instead! Time mean is biased for long tails.
559-
float padSigma = CAMath::Sqrt(CAMath::Max(0.f, padSqSum / weightSum - padMean * padMean));
550+
const float padMean = padSum / weightSum;
551+
const float timeMean = timeSum / weightSum; // TODO: Use timebin of saturated signal instead! Time mean is biased for long tails.
552+
const float padSigma = CAMath::Sqrt(CAMath::Max(0.f, padSqSum / weightSum - padMean * padMean));
560553

561554
tpc::ClusterNative cn;
562555
cn.qMax = qMax;

0 commit comments

Comments
 (0)