Skip to content

Commit 283a706

Browse files
committed
GPU TPC: Dynamically increase the protection / decrease the removal tube at inner pad rows, edge pads, high local occupancy
1 parent e4df51f commit 283a706

File tree

5 files changed

+39
-21
lines changed

5 files changed

+39
-21
lines changed

GPU/GPUTracking/Base/GPUReconstruction.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ void* GPUReconstruction::AllocateDirectMemory(size_t size, int32_t type)
748748
void*& poolend = (type & GPUMemoryResource::MEMORY_GPU) ? mDeviceMemoryPoolEnd : mHostMemoryPoolEnd;
749749
char* retVal;
750750
if ((type & GPUMemoryResource::MEMORY_STACK)) {
751-
poolend = (char*)poolend - size;
751+
poolend = (char*)poolend - size; // TODO: Implement overflow check
752752
poolend = (char*)poolend - GPUProcessor::getAlignmentMod<GPUCA_MEMALIGN>(poolend);
753753
retVal = (char*)poolend;
754754
} else {

GPU/GPUTracking/Definitions/GPUSettingsList.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ AddOptionRTC(minNClustersFinalTrack, int32_t, -1, "", 0, "required min number of
6868
AddOptionRTC(searchWindowDZDR, float, 2.5f, "", 0, "Use DZDR window for seeding instead of neighboursSearchArea")
6969
AddOptionRTC(trackReferenceX, float, 1000.f, "", 0, "Transport all tracks to this X after tracking (disabled if > 500, auto = 1000)")
7070
AddOptionRTC(zsThreshold, float, 2.0f, "", 0, "Zero-Suppression threshold")
71-
AddOptionRTC(tubeProtectSigma2, float, 5.f * 5.f, "", 0, "Max sigma2 to mark adjacent cluster for protection")
72-
AddOptionRTC(tubeProtectMaxSize2, float, 3.5f * 3.5f, "", 0, "Square of max tube size (if smaller than tubeProtectChi2)")
73-
AddOptionRTC(tubeProtectMinSize2, float, 1.0f * 1.0f, "", 0, "Square of min tube size (if larger than tubeProtectChi2)")
74-
AddOptionRTC(tubeRemoveSigma2, float, 1.f * 1.f, "", 0, "Max sigma2 to mark adjacent cluster for removal")
75-
AddOptionRTC(tubeRemoveMaxSize2, float, 1.5f * 1.5f, "", 0, "Square of max tube size (if smaller than tubeRejectChi2)")
71+
AddOptionRTC(tubeProtectSigma2, float, 4.f * 4.f, "", 0, "Max sigma2 to mark adjacent cluster for protection")
72+
AddOptionRTC(tubeProtectMaxSize2, float, 2.f * 2.f, "", 0, "Square of max tube size (if smaller than tubeProtectChi2)")
73+
AddOptionRTC(tubeProtectMinSize2, float, 0.5f * 0.5f, "", 0, "Square of min tube size (if larger than tubeProtectChi2)")
74+
AddOptionRTC(tubeRemoveSigma2, float, 1.25f * 1.25f, "", 0, "Max sigma2 to mark adjacent cluster for removal")
75+
AddOptionRTC(tubeRemoveMaxSize2, float, 2.5f * 2.5f, "", 0, "Square of max tube size (if smaller than tubeRejectChi2)")
76+
AddOptionRTC(tubeExtraProtectMinOccupancy, uint32_t, 1500, "", 0, "Increase Protection, decrease removal by factor 2, when above this lokal occupancy / rowx")
7677
AddOptionRTC(clustersShiftTimebins, float, 0, "", 0, "Shift of TPC clusters (applied during CTF cluster decoding)")
7778
AddOptionRTC(clustersShiftTimebinsClusterizer, float, 0, "", 0, "Shift of TPC clusters (applied during CTF clusterization)")
7879
AddOptionRTC(clustersEdgeFixDistance, float, 0.f, "", 0, "If >0, revert cluster.flag edge bit distance to edge exceeds this parameter (fixed during CTF decoding)")
@@ -162,6 +163,9 @@ AddOptionRTC(dEdxClusterRejectionFlagMask, int8_t, o2::gpu::GPUTPCGMMergedTrackH
162163
AddOptionRTC(dEdxClusterRejectionFlagMaskAlt, int8_t, o2::gpu::GPUTPCGMMergedTrackHit::flagEdge, "", 0, "OR mask of TPC flags that will reject the cluster in alternative dEdx")
163164
AddOptionRTC(rejectEdgeClustersInSeeding, int8_t, 0, "", 0, "Reject edge clusters based on uncorrected track Y during seeding")
164165
AddOptionRTC(rejectEdgeClustersInTrackFit, int8_t, 0, "", 0, "Reject edge clusters based on uncorrected track Y during track fit")
166+
AddOptionRTC(tubeExtraProtectMinRow, uint8_t, 20, "", 0, "Increase Protection, decrease removal by factor 2, when below this row")
167+
AddOptionRTC(tubeExtraProtectEdgePads, uint8_t, 2, "", 0, "Increase Protection, decrease removal by factor 2, when on this number of pads from the edge")
168+
165169
AddOptionArray(PID_remap, int8_t, 9, (0, 1, 2, 3, 4, 5, 6, 7, 8), "", 0, "Remap Ipid to PID_reamp[Ipid] (no remap if<0)") // BUG: CUDA cannot yet hand AddOptionArrayRTC
166170
AddHelp("help", 'h')
167171
EndConfig()

GPU/GPUTracking/Merger/GPUTPCGMTrackParam.cxx

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ GPUd() bool GPUTPCGMTrackParam::Fit(GPUTPCGMMerger* GPUrestrict() merger, int32_
248248
const float invCharge = merger->GetConstantMem()->ioPtrs.clustersNative ? (1.f / merger->GetConstantMem()->ioPtrs.clustersNative->clustersLinear[cluster.num].qMax) : 0.f;
249249
float invAvgCharge = (sumInvSqrtCharge += invSqrtCharge) / ++nAvgCharge;
250250
invAvgCharge *= invAvgCharge;
251-
252251
prop.GetErr2(err2Y, err2Z, param, zz, cluster.row, clusterState, cluster.sector, time, invAvgCharge, invCharge);
253252

254253
if (rejectChi2 >= GPUTPCGMPropagator::rejectInterFill) {
@@ -491,7 +490,8 @@ GPUd() float GPUTPCGMTrackParam::AttachClusters(const GPUTPCGMMerger* GPUrestric
491490

492491
GPUd() float GPUTPCGMTrackParam::AttachClusters(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t sector, int32_t iRow, int32_t iTrack, bool goodLeg, float Y, float Z)
493492
{
494-
if (Merger->Param().rec.tpc.disableRefitAttachment & 1) {
493+
const auto& param = Merger->Param();
494+
if (param.rec.tpc.disableRefitAttachment & 1) {
495495
return -1e6f;
496496
}
497497
const GPUTPCTracker& GPUrestrict() tracker = *(Merger->GetConstantMem()->tpcTrackers + sector);
@@ -502,34 +502,40 @@ GPUd() float GPUTPCGMTrackParam::AttachClusters(const GPUTPCGMMerger* GPUrestric
502502
return -1e6f;
503503
}
504504

505-
const float zOffset = Merger->Param().par.continuousTracking ? Merger->GetConstantMem()->calibObjects.fastTransformHelper->getCorrMap()->convVertexTimeToZOffset(sector, mTOffset, Merger->Param().continuousMaxTimeBin) : 0;
505+
const float zOffset = param.par.continuousTracking ? Merger->GetConstantMem()->calibObjects.fastTransformHelper->getCorrMap()->convVertexTimeToZOffset(sector, mTOffset, param.continuousMaxTimeBin) : 0; // TODO: do some validatiomns for the transform conv functions...
506506
const float y0 = row.Grid().YMin();
507507
const float stepY = row.HstepY();
508508
const float z0 = row.Grid().ZMin() - zOffset; // We can use our own ZOffset, since this is only used temporarily anyway
509509
const float stepZ = row.HstepZ();
510510
int32_t bin, ny, nz;
511511

512-
bool protect = CAMath::Abs(GetQPt() * Merger->Param().qptB5Scaler) <= Merger->Param().rec.tpc.rejectQPtB5 && goodLeg;
512+
float uncorrectedY, uncorrectedZ;
513+
Merger->GetConstantMem()->calibObjects.fastTransformHelper->InverseTransformYZtoNominalYZ(sector, iRow, Y, Z, uncorrectedY, uncorrectedZ);
514+
if (CAMath::Abs(uncorrectedY) > row.getTPCMaxY()) {
515+
return uncorrectedY;
516+
}
513517

518+
bool protect = CAMath::Abs(GetQPt() * param.qptB5Scaler) <= param.rec.tpc.rejectQPtB5 && goodLeg;
514519
float err2Y, err2Z;
515-
Merger->Param().GetClusterErrors2(sector, iRow, Z, mP[2], mP[3], -1.f, 0.f, 0.f, err2Y, err2Z); // TODO: Use correct time/avgCharge
516-
const float tubeMaxSize2 = protect ? Merger->Param().rec.tpc.tubeProtectMaxSize2 : Merger->Param().rec.tpc.tubeRemoveMaxSize2;
517-
const float tubeMinSize2 = protect ? Merger->Param().rec.tpc.tubeProtectMinSize2 : 0.f;
518-
const float tubeSigma2 = protect ? Merger->Param().rec.tpc.tubeProtectSigma2 : Merger->Param().rec.tpc.tubeRemoveSigma2;
520+
param.GetClusterErrors2(sector, iRow, Z, mP[2], mP[3], -1.f, 0.f, 0.f, err2Y, err2Z); // TODO: Use correct time/avgCharge
521+
const float tubeMaxSize2 = protect ? param.rec.tpc.tubeProtectMaxSize2 : param.rec.tpc.tubeRemoveMaxSize2;
522+
const float tubeMinSize2 = protect ? param.rec.tpc.tubeProtectMinSize2 : 0.f;
523+
float tubeSigma2 = protect ? param.rec.tpc.tubeProtectSigma2 : param.rec.tpc.tubeRemoveSigma2;
524+
uint32_t pad = CAMath::Float2UIntRn(GPUTPCGeometry::LinearY2Pad(sector, iRow, uncorrectedY));
525+
float time = Merger->GetConstantMem()->calibObjects.fastTransformHelper->getCorrMap()->InverseTransformInTimeFrame(sector, mP[1] + (param.par.continuousTracking ? Merger->GetConstantMem()->calibObjects.fastTransformHelper->getCorrMap()->convVertexTimeToZOffset(sector, mTOffset, param.continuousMaxTimeBin) : 0), param.continuousMaxTimeBin); // TODO: Simplify this call in TPCFastTransform
526+
if (iRow < param.rec.tpc.tubeExtraProtectMinRow ||
527+
pad < param.rec.tpc.tubeExtraProtectEdgePads || pad >= (uint32_t)(GPUTPCGeometry::NPads(iRow) - param.rec.tpc.tubeExtraProtectEdgePads) ||
528+
param.GetUnscaledMult(time) / GPUTPCGeometry::Row2X(iRow) > param.rec.tpc.tubeExtraProtectMinOccupancy) {
529+
tubeSigma2 *= protect ? 2 : 0.5;
530+
}
519531
const float sy2 = CAMath::Max(tubeMinSize2, CAMath::Min(tubeMaxSize2, tubeSigma2 * (err2Y + CAMath::Abs(mC[0])))); // Cov can be bogus when following circle
520532
const float sz2 = CAMath::Max(tubeMinSize2, CAMath::Min(tubeMaxSize2, tubeSigma2 * (err2Z + CAMath::Abs(mC[2])))); // In that case we should provide the track error externally
521533
const float tubeY = CAMath::Sqrt(sy2);
522534
const float tubeZ = CAMath::Sqrt(sz2);
523535
const float sy21 = 1.f / sy2;
524536
const float sz21 = 1.f / sz2;
525-
float uncorrectedY, uncorrectedZ;
526-
Merger->GetConstantMem()->calibObjects.fastTransformHelper->InverseTransformYZtoNominalYZ(sector, iRow, Y, Z, uncorrectedY, uncorrectedZ);
527537

528-
if (CAMath::Abs(uncorrectedY) > row.getTPCMaxY()) {
529-
return uncorrectedY;
530-
}
531538
row.Grid().GetBinArea(uncorrectedY, uncorrectedZ + zOffset, tubeY, tubeZ, bin, ny, nz);
532-
533539
const int32_t nBinsY = row.Grid().Ny();
534540
const int32_t idOffset = tracker.Data().ClusterIdOffset();
535541
const int32_t* ids = &(tracker.Data().ClusterDataIndex()[row.HitNumberOffset()]);

GPU/GPUTracking/TPCConvert/GPUTPCConvertImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class GPUTPCConvertImpl
2828
public:
2929
GPUd() static void convert(const GPUConstantMem& GPUrestrict() cm, int32_t sector, int32_t row, float pad, float time, float& GPUrestrict() x, float& GPUrestrict() y, float& GPUrestrict() z)
3030
{
31-
if (cm.param.par.continuousTracking) {
31+
if (cm.param.par.continuousTracking) { // TODO: This might be wrong, don't we just need to do TransformInTimeframe always
3232
cm.calibObjects.fastTransformHelper->getCorrMap()->TransformInTimeFrame(sector, row, pad, time, x, y, z, cm.param.continuousMaxTimeBin);
3333
} else {
3434
cm.calibObjects.fastTransformHelper->Transform(sector, row, pad, time, x, y, z);

GPU/TPCFastTransformation/TPCFastTransform.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ class TPCFastTransform : public FlatObject
194194

195195
/// Inverse transformation
196196
GPUd() void InverseTransformInTimeFrame(int32_t slice, int32_t row, float /*x*/, float y, float z, float& pad, float& time, float maxTimeBin) const;
197+
GPUd() float InverseTransformInTimeFrame(int32_t slice, float z, float maxTimeBin) const;
197198

198199
/// Inverse transformation: Transformed Y and Z -> transformed X
199200
GPUd() void InverseTransformYZtoX(int32_t slice, int32_t row, float y, float z, float& x, const TPCFastTransform* ref = nullptr, const TPCFastTransform* ref2 = nullptr, float scale = 0.f, float scale2 = 0.f, int32_t scaleMode = 0) const;
@@ -667,6 +668,13 @@ GPUdi() void TPCFastTransform::InverseTransformInTimeFrame(int32_t slice, int32_
667668
convUVtoPadTimeInTimeFrame(slice, row, u, v, pad, time, maxTimeBin);
668669
}
669670

671+
GPUdi() float TPCFastTransform::InverseTransformInTimeFrame(int32_t slice, float z, float maxTimeBin) const
672+
{
673+
float pad, time;
674+
InverseTransformInTimeFrame(slice, 0, 0, 0, z, pad, time, maxTimeBin);
675+
return time;
676+
}
677+
670678
GPUdi() void TPCFastTransform::TransformIdealZ(int32_t slice, float time, float& z, float vertexTime) const
671679
{
672680
/// _______________ The main method: cluster transformation _______________________

0 commit comments

Comments
 (0)