Skip to content

Commit 45115ce

Browse files
committed
GPU/TPC: Clamp gain correction of raw ADCs to 1022
1 parent 290b414 commit 45115ce

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

GPU/GPUTracking/TPCClusterFinder/GPUTPCCFDecodeZS.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,11 @@ GPUd() void GPUTPCCFDecodeZSLinkBase::WriteCharge(processorType& clusterer, floa
478478
positions[positionOffset] = pos;
479479

480480
// Only apply gain correction if ADC not fully saturated
481+
// and ensure gain correction doesn't accidentally saturate the ADC
481482
if (charge < 1023.f) {
482-
charge *= clusterer.GetConstantMem()->calibObjects.tpcPadGain->getGainCorrection(sector, padAndRow.getRow(), padAndRow.getPad());
483+
auto gain = clusterer.GetConstantMem()->calibObjects.tpcPadGain->getGainCorrection(sector, padAndRow.getRow(), padAndRow.getPad());
484+
charge *= gain;
485+
charge = CAMath::Min(charge, 1022.f);
483486
}
484487

485488
chargeMap[pos] = PackedCharge(charge);

0 commit comments

Comments
 (0)