Skip to content

Commit 46445fa

Browse files
committed
GPU TPC CF: Use corrected check also for edge cluster tagging
1 parent 641977c commit 46445fa

File tree

4 files changed

+45
-59
lines changed

4 files changed

+45
-59
lines changed

GPU/GPUTracking/TPCClusterFinder/CfUtils.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ class CfUtils
2727
{
2828

2929
public:
30-
static GPUdi() bool isAtEdge(const ChargePos& pos, tpccf::GlobalPad padsPerRow)
31-
{
32-
return (pos.pad() < 2 || pos.pad() >= padsPerRow - 2);
33-
}
34-
3530
static GPUdi() bool innerAboveThreshold(uint8_t aboveThreshold, uint16_t outerIdx)
3631
{
3732
return aboveThreshold & (1 << cfconsts::OuterToInner[outerIdx]);

GPU/GPUTracking/TPCClusterFinder/ClusterAccumulator.cxx

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -21,45 +21,6 @@
2121
using namespace o2::gpu;
2222
using namespace o2::gpu::tpccf;
2323

24-
GPUd() bool ClusterAccumulator::toNative(const ChargePos& pos, Charge q, tpc::ClusterNative& cn, const GPUParam& param) const
25-
{
26-
cn.qTot = CAMath::Float2UIntRn(mQtot);
27-
if (cn.qTot <= param.rec.tpc.cfQTotCutoff) {
28-
return false;
29-
}
30-
cn.qMax = q;
31-
if (cn.qMax <= param.rec.tpc.cfQMaxCutoff) {
32-
return false;
33-
}
34-
if (mTimeMean < param.rec.tpc.clustersShiftTimebinsClusterizer) {
35-
return false;
36-
}
37-
if (q <= param.rec.tpc.cfQMaxCutoffSingleTime && mTimeSigma == 0) {
38-
return false;
39-
}
40-
if (q <= param.rec.tpc.cfQMaxCutoffSinglePad && mPadSigma == 0) {
41-
return false;
42-
}
43-
44-
bool isEdgeCluster = CfUtils::isAtEdge(pos, param.tpcGeometry.NPads(pos.row()));
45-
bool wasSplitInTime = mSplitInTime >= param.rec.tpc.cfMinSplitNum;
46-
bool wasSplitInPad = mSplitInPad >= param.rec.tpc.cfMinSplitNum;
47-
bool isSingleCluster = (mPadSigma == 0) || (mTimeSigma == 0);
48-
49-
uint8_t flags = 0;
50-
flags |= (isEdgeCluster) ? tpc::ClusterNative::flagEdge : 0;
51-
flags |= (wasSplitInTime) ? tpc::ClusterNative::flagSplitTime : 0;
52-
flags |= (wasSplitInPad) ? tpc::ClusterNative::flagSplitPad : 0;
53-
flags |= (isSingleCluster) ? tpc::ClusterNative::flagSingle : 0;
54-
55-
cn.setTimeFlags(mTimeMean - param.rec.tpc.clustersShiftTimebinsClusterizer, flags);
56-
cn.setPad(mPadMean);
57-
cn.setSigmaTime(mTimeSigma);
58-
cn.setSigmaPad(mPadSigma);
59-
60-
return true;
61-
}
62-
6324
GPUd() void ClusterAccumulator::update(Charge splitCharge, Delta2 d)
6425
{
6526
mQtot += splitCharge;
@@ -97,7 +58,7 @@ GPUd() Charge ClusterAccumulator::updateOuter(PackedCharge charge, Delta2 d)
9758
return q;
9859
}
9960

100-
GPUd() void ClusterAccumulator::finalize(const ChargePos& pos, Charge q, TPCTime timeOffset, const GPUTPCGeometry& geo, Charge* padBoundaryCharges)
61+
GPUd() bool ClusterAccumulator::toNative(const ChargePos& pos, Charge q, tpc::ClusterNative& cn, const GPUParam& param, TPCTime timeOffset, const Array2D<PackedCharge>& chargeMap)
10162
{
10263
mQtot += q;
10364

@@ -113,14 +74,48 @@ GPUd() void ClusterAccumulator::finalize(const ChargePos& pos, Charge q, TPCTime
11374
mPadMean += pad;
11475
mTimeMean += timeOffset + pos.time();
11576

116-
if (CfUtils::isAtEdge(pos, geo.NPads(pos.row()))) {
77+
bool isEdgeCluster = pos.pad() < 2 || pos.pad() >= param.tpcGeometry.NPads(pos.row()) - 2; // Geometrical edge check, peak within 2 pads of sector edge
78+
if (isEdgeCluster) {
11779
bool leftEdge = (pad < 2);
118-
bool correct = (leftEdge) ? (pad < mPadMean) : (pad > mPadMean);
119-
if (leftEdge && pad == 1) { // only check charge at boundary if maximum is at least one pad away from boundary
120-
correct = correct && (padBoundaryCharges[0] > 0); // Only correct if cluster is asymmetric with charge > 0 towards sector boundary, otherwise all charge is found
121-
} else if (!leftEdge && pad == (geo.NPads(pos.row()) - 2)) {
122-
correct = correct && (padBoundaryCharges[1] > 0);
80+
if (leftEdge ? (pad == 1 && chargeMap[pos.delta({-1, 0})].unpack() < 1) : (pad == (param.tpcGeometry.NPads(pos.row()) - 2) && chargeMap[pos.delta({1, 0})].unpack() < 1)) {
81+
isEdgeCluster = false; // No edge cluster if peak is close to edge but no charge at the edge.
82+
} else if (leftEdge ? (pad < mPadMean) : (pad > mPadMean)) {
83+
mPadMean = pad; // Correct to peak position if COG is close to middle of pad than peak
12384
}
124-
mPadMean = (correct) ? pad : mPadMean;
12585
}
86+
87+
cn.qTot = CAMath::Float2UIntRn(mQtot);
88+
if (cn.qTot <= param.rec.tpc.cfQTotCutoff) {
89+
return false;
90+
}
91+
cn.qMax = q;
92+
if (cn.qMax <= param.rec.tpc.cfQMaxCutoff) {
93+
return false;
94+
}
95+
if (mTimeMean < param.rec.tpc.clustersShiftTimebinsClusterizer) {
96+
return false;
97+
}
98+
if (q <= param.rec.tpc.cfQMaxCutoffSingleTime && mTimeSigma == 0) {
99+
return false;
100+
}
101+
if (q <= param.rec.tpc.cfQMaxCutoffSinglePad && mPadSigma == 0) {
102+
return false;
103+
}
104+
105+
bool wasSplitInTime = mSplitInTime >= param.rec.tpc.cfMinSplitNum;
106+
bool wasSplitInPad = mSplitInPad >= param.rec.tpc.cfMinSplitNum;
107+
bool isSingleCluster = (mPadSigma == 0) || (mTimeSigma == 0);
108+
109+
uint8_t flags = 0;
110+
flags |= (isEdgeCluster) ? tpc::ClusterNative::flagEdge : 0;
111+
flags |= (wasSplitInTime) ? tpc::ClusterNative::flagSplitTime : 0;
112+
flags |= (wasSplitInPad) ? tpc::ClusterNative::flagSplitPad : 0;
113+
flags |= (isSingleCluster) ? tpc::ClusterNative::flagSingle : 0;
114+
115+
cn.setTimeFlags(mTimeMean - param.rec.tpc.clustersShiftTimebinsClusterizer, flags);
116+
cn.setPad(mPadMean);
117+
cn.setSigmaTime(mTimeSigma);
118+
cn.setSigmaPad(mPadSigma);
119+
120+
return true;
126121
}

GPU/GPUTracking/TPCClusterFinder/ClusterAccumulator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "clusterFinderDefs.h"
1919
#include "PackedCharge.h"
20+
#include "Array2D.h"
2021

2122
namespace o2
2223
{
@@ -40,8 +41,7 @@ class ClusterAccumulator
4041
GPUd() tpccf::Charge updateInner(PackedCharge, tpccf::Delta2);
4142
GPUd() tpccf::Charge updateOuter(PackedCharge, tpccf::Delta2);
4243

43-
GPUd() void finalize(const ChargePos&, tpccf::Charge, tpccf::TPCTime, const GPUTPCGeometry&, tpccf::Charge*);
44-
GPUd() bool toNative(const ChargePos&, tpccf::Charge, tpc::ClusterNative&, const GPUParam&) const;
44+
GPUd() bool toNative(const ChargePos&, tpccf::Charge, tpc::ClusterNative&, const GPUParam&, tpccf::TPCTime, const Array2D<PackedCharge>&);
4545

4646
private:
4747
float mQtot = 0;

GPU/GPUTracking/TPCClusterFinder/GPUTPCCFClusterizer.cxx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ GPUdii() void GPUTPCCFClusterizer::computeClustersImpl(int32_t nBlocks, int32_t
5858
ChargePos pos = filteredPeakPositions[CAMath::Min(idx, clusternum - 1)];
5959
Charge charge = chargeMap[pos].unpack();
6060

61-
Charge padBoundaryCharges[2] = {chargeMap[pos.delta({-1, 0})].unpack(), chargeMap[pos.delta({1, 0})].unpack()};
62-
6361
ClusterAccumulator pc;
6462
CPU_ONLY(labelAcc->collect(pos, charge));
6563

@@ -82,10 +80,8 @@ GPUdii() void GPUTPCCFClusterizer::computeClustersImpl(int32_t nBlocks, int32_t
8280
}
8381
return;
8482
}
85-
pc.finalize(pos, charge, fragment.start, clusterer.Param().tpcGeometry, padBoundaryCharges);
86-
8783
tpc::ClusterNative myCluster;
88-
bool rejectCluster = !pc.toNative(pos, charge, myCluster, clusterer.Param());
84+
bool rejectCluster = !pc.toNative(pos, charge, myCluster, clusterer.Param(), fragment.start, chargeMap);
8985

9086
if (rejectCluster) {
9187
if (clusterPosInRow) {

0 commit comments

Comments
 (0)