diff --git a/GPU/GPUTracking/TPCClusterFinder/ClusterAccumulator.cxx b/GPU/GPUTracking/TPCClusterFinder/ClusterAccumulator.cxx index d145aaed705d9..a826cdf71f575 100644 --- a/GPU/GPUTracking/TPCClusterFinder/ClusterAccumulator.cxx +++ b/GPU/GPUTracking/TPCClusterFinder/ClusterAccumulator.cxx @@ -97,7 +97,7 @@ GPUd() Charge ClusterAccumulator::updateOuter(PackedCharge charge, Delta2 d) return q; } -GPUd() void ClusterAccumulator::finalize(const ChargePos& pos, Charge q, TPCTime timeOffset, const GPUTPCGeometry& geo) +GPUd() void ClusterAccumulator::finalize(const ChargePos& pos, Charge q, TPCTime timeOffset, const GPUTPCGeometry& geo, Charge* padBoundaryCharges) { mQtot += q; @@ -116,6 +116,11 @@ GPUd() void ClusterAccumulator::finalize(const ChargePos& pos, Charge q, TPCTime if (CfUtils::isAtEdge(pos, geo.NPads(pos.row()))) { bool leftEdge = (pad < 2); bool correct = (leftEdge) ? (pad < mPadMean) : (pad > mPadMean); + if (leftEdge && pad == 1) { // only check charge at boundary if maximum is at least one pad away from boundary + correct = correct && (padBoundaryCharges[0] > 0); // Only correct if cluster is asymmetric with charge > 0 towards sector boundary, otherwise all charge is found + } else if (!leftEdge && pad == (geo.NPads(pos.row()) - 2)) { + correct = correct && (padBoundaryCharges[1] > 0); + } mPadMean = (correct) ? pad : mPadMean; } } diff --git a/GPU/GPUTracking/TPCClusterFinder/ClusterAccumulator.h b/GPU/GPUTracking/TPCClusterFinder/ClusterAccumulator.h index 26decbf0a5b14..c409a6cced3a5 100644 --- a/GPU/GPUTracking/TPCClusterFinder/ClusterAccumulator.h +++ b/GPU/GPUTracking/TPCClusterFinder/ClusterAccumulator.h @@ -40,7 +40,7 @@ class ClusterAccumulator GPUd() tpccf::Charge updateInner(PackedCharge, tpccf::Delta2); GPUd() tpccf::Charge updateOuter(PackedCharge, tpccf::Delta2); - GPUd() void finalize(const ChargePos&, tpccf::Charge, tpccf::TPCTime, const GPUTPCGeometry&); + GPUd() void finalize(const ChargePos&, tpccf::Charge, tpccf::TPCTime, const GPUTPCGeometry&, tpccf::Charge*); GPUd() bool toNative(const ChargePos&, tpccf::Charge, tpc::ClusterNative&, const GPUParam&) const; private: diff --git a/GPU/GPUTracking/TPCClusterFinder/GPUTPCCFClusterizer.cxx b/GPU/GPUTracking/TPCClusterFinder/GPUTPCCFClusterizer.cxx index ad07f2b93f3e0..6de1730d67fbd 100644 --- a/GPU/GPUTracking/TPCClusterFinder/GPUTPCCFClusterizer.cxx +++ b/GPU/GPUTracking/TPCClusterFinder/GPUTPCCFClusterizer.cxx @@ -58,6 +58,8 @@ GPUdii() void GPUTPCCFClusterizer::computeClustersImpl(int32_t nBlocks, int32_t ChargePos pos = filteredPeakPositions[CAMath::Min(idx, clusternum - 1)]; Charge charge = chargeMap[pos].unpack(); + Charge padBoundaryCharges[2] = {chargeMap[pos.delta({-1, 0})].unpack(), chargeMap[pos.delta({1, 0})].unpack()}; + ClusterAccumulator pc; CPU_ONLY(labelAcc->collect(pos, charge)); @@ -80,7 +82,7 @@ GPUdii() void GPUTPCCFClusterizer::computeClustersImpl(int32_t nBlocks, int32_t } return; } - pc.finalize(pos, charge, fragment.start, clusterer.Param().tpcGeometry); + pc.finalize(pos, charge, fragment.start, clusterer.Param().tpcGeometry, padBoundaryCharges); tpc::ClusterNative myCluster; bool rejectCluster = !pc.toNative(pos, charge, myCluster, clusterer.Param());