Skip to content

Commit 42f78c7

Browse files
committed
TPC Splines: linear downscaling to 0 towards the readout outside the measured area
1 parent ee2b995 commit 42f78c7

1 file changed

Lines changed: 27 additions & 9 deletions

File tree

GPU/TPCFastTransformation/TPCFastSpaceChargeCorrection.h

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ class TPCFastSpaceChargeCorrection : public FlatObject
231231
GPUh() double testInverse(bool prn = 0);
232232
#endif
233233

234+
GPUd() float getSplineScaleForV(int32_t slice, int32_t row, float v) const;
235+
234236
private:
235237
/// relocate buffer pointers
236238
void relocateBufferPointers(const char* oldBuffer, char* newBuffer);
@@ -372,6 +374,9 @@ GPUdi() void TPCFastSpaceChargeCorrection::convUVtoGrid(int32_t slice, int32_t r
372374
gv = (gv - sv0) / (1.f - sv0);
373375
gu *= spline.getGridX1().getUmax();
374376
gv *= spline.getGridX2().getUmax();
377+
if (gv < 0.f) {
378+
gv = 0.f;
379+
}
375380
}
376381

377382
GPUdi() void TPCFastSpaceChargeCorrection::convGridToUV(int32_t slice, int32_t row, float gridU, float gridV, float& u, float& v) const
@@ -387,6 +392,15 @@ GPUdi() void TPCFastSpaceChargeCorrection::convGridToUV(int32_t slice, int32_t r
387392
mGeo.convScaledUVtoUV(slice, row, su, sv, u, v);
388393
}
389394

395+
GPUdi() float TPCFastSpaceChargeCorrection::getSplineScaleForV(int32_t slice, int32_t row, float v) const
396+
{
397+
const SliceRowInfo& info = getSliceRowInfo(slice, row);
398+
if (info.gridV0 < 1.e-4f) {
399+
return (v >= info.gridV0) ? 1.f : 0.f;
400+
}
401+
return GPUCommonMath::Clamp(v / info.gridV0, 0.f, 1.f);
402+
}
403+
390404
GPUdi() void TPCFastSpaceChargeCorrection::convCorrectedUVtoGrid(int32_t slice, int32_t row, float corrU, float corrV, float& gridU, float& gridV) const
391405
{
392406
schrinkCorrectedUV(slice, row, corrU, corrV);
@@ -408,9 +422,10 @@ GPUdi() int32_t TPCFastSpaceChargeCorrection::getCorrection(int32_t slice, int32
408422
if (CAMath::Abs(dxuv[0]) > 100 || CAMath::Abs(dxuv[1]) > 100 || CAMath::Abs(dxuv[2]) > 100) {
409423
dxuv[0] = dxuv[1] = dxuv[2] = 0;
410424
}
411-
dx = dxuv[0];
412-
du = dxuv[1];
413-
dv = dxuv[2];
425+
float scaleV = getSplineScaleForV(slice, row, v);
426+
dx = scaleV * dxuv[0];
427+
du = scaleV * dxuv[1];
428+
dv = scaleV * dxuv[2];
414429
return 0;
415430
}
416431

@@ -425,9 +440,10 @@ GPUdi() int32_t TPCFastSpaceChargeCorrection::getCorrectionOld(int32_t slice, in
425440
if (CAMath::Abs(dxuv[0]) > 100 || CAMath::Abs(dxuv[1]) > 100 || CAMath::Abs(dxuv[2]) > 100) {
426441
dxuv[0] = dxuv[1] = dxuv[2] = 0;
427442
}
428-
dx = dxuv[0];
429-
du = dxuv[1];
430-
dv = dxuv[2];
443+
float scaleV = getSplineScaleForV(slice, row, v);
444+
dx = scaleV * dxuv[0];
445+
du = scaleV * dxuv[1];
446+
dv = scaleV * dxuv[2];
431447
return 0;
432448
}
433449

@@ -444,7 +460,8 @@ GPUdi() void TPCFastSpaceChargeCorrection::getCorrectionInvCorrectedX(
444460
if (CAMath::Abs(dx) > 100) {
445461
dx = 0;
446462
}
447-
x = mGeo.getRowInfo(row).x + dx;
463+
float scaleV = getSplineScaleForV(slice, row, corrV);
464+
x = mGeo.getRowInfo(row).x + scaleV * dx;
448465
}
449466

450467
GPUdi() void TPCFastSpaceChargeCorrection::getCorrectionInvUV(
@@ -461,8 +478,9 @@ GPUdi() void TPCFastSpaceChargeCorrection::getCorrectionInvUV(
461478
if (CAMath::Abs(duv[0]) > 100 || CAMath::Abs(duv[1]) > 100) {
462479
duv[0] = duv[1] = 0;
463480
}
464-
nomU = corrU - duv[0];
465-
nomV = corrV - duv[1];
481+
float scaleV = getSplineScaleForV(slice, row, corrV);
482+
nomU = corrU - scaleV * duv[0];
483+
nomV = corrV - scaleV * duv[1];
466484
}
467485

468486
GPUdi() float TPCFastSpaceChargeCorrection::getMaxDriftLength(int32_t slice, int32_t row, float pad) const

0 commit comments

Comments
 (0)