@@ -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,7 @@ 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 ) gv = 0 .f ;
375378}
376379
377380GPUdi () void TPCFastSpaceChargeCorrection::convGridToUV (int32_t slice, int32_t row, float gridU, float gridV, float & u, float & v) const
@@ -387,6 +390,12 @@ GPUdi() void TPCFastSpaceChargeCorrection::convGridToUV(int32_t slice, int32_t r
387390 mGeo .convScaledUVtoUV (slice, row, su, sv, u, v);
388391}
389392
393+ GPUdi () float TPCFastSpaceChargeCorrection::getSplineScaleForV (int32_t slice, int32_t row, float v) const
394+ {
395+ const SliceRowInfo& info = getSliceRowInfo (slice, row);
396+ return 1 .f - GPUCommonMath::Clamp (( info.gridV0 - v) / info.gridV0 , 0 .f , 1 .f );
397+ }
398+
390399GPUdi () void TPCFastSpaceChargeCorrection::convCorrectedUVtoGrid (int32_t slice, int32_t row, float corrU, float corrV, float & gridU, float & gridV) const
391400{
392401 schrinkCorrectedUV (slice, row, corrU, corrV);
@@ -408,9 +417,10 @@ GPUdi() int32_t TPCFastSpaceChargeCorrection::getCorrection(int32_t slice, int32
408417 if (CAMath::Abs (dxuv[0 ]) > 100 || CAMath::Abs (dxuv[1 ]) > 100 || CAMath::Abs (dxuv[2 ]) > 100 ) {
409418 dxuv[0 ] = dxuv[1 ] = dxuv[2 ] = 0 ;
410419 }
411- dx = dxuv[0 ];
412- du = dxuv[1 ];
413- dv = dxuv[2 ];
420+ float scaleV = getSplineScaleForV (slice, row, v);
421+ dx = scaleV * dxuv[0 ];
422+ du = scaleV * dxuv[1 ];
423+ dv = scaleV * dxuv[2 ];
414424 return 0 ;
415425}
416426
@@ -425,9 +435,10 @@ GPUdi() int32_t TPCFastSpaceChargeCorrection::getCorrectionOld(int32_t slice, in
425435 if (CAMath::Abs (dxuv[0 ]) > 100 || CAMath::Abs (dxuv[1 ]) > 100 || CAMath::Abs (dxuv[2 ]) > 100 ) {
426436 dxuv[0 ] = dxuv[1 ] = dxuv[2 ] = 0 ;
427437 }
428- dx = dxuv[0 ];
429- du = dxuv[1 ];
430- dv = dxuv[2 ];
438+ float scaleV = getSplineScaleForV (slice, row, v);
439+ dx = scaleV * dxuv[0 ];
440+ du = scaleV * dxuv[1 ];
441+ dv = scaleV * dxuv[2 ];
431442 return 0 ;
432443}
433444
@@ -444,7 +455,8 @@ GPUdi() void TPCFastSpaceChargeCorrection::getCorrectionInvCorrectedX(
444455 if (CAMath::Abs (dx) > 100 ) {
445456 dx = 0 ;
446457 }
447- x = mGeo .getRowInfo (row).x + dx;
458+ float scaleV = getSplineScaleForV (slice, row, corrV);
459+ x = mGeo .getRowInfo (row).x + scaleV * dx;
448460}
449461
450462GPUdi () void TPCFastSpaceChargeCorrection::getCorrectionInvUV (
@@ -461,8 +473,9 @@ GPUdi() void TPCFastSpaceChargeCorrection::getCorrectionInvUV(
461473 if (CAMath::Abs (duv[0 ]) > 100 || CAMath::Abs (duv[1 ]) > 100 ) {
462474 duv[0 ] = duv[1 ] = 0 ;
463475 }
464- nomU = corrU - duv[0 ];
465- nomV = corrV - duv[1 ];
476+ float scaleV = getSplineScaleForV (slice, row, corrV);
477+ nomU = corrU - scaleV * duv[0 ];
478+ nomV = corrV - scaleV * duv[1 ];
466479}
467480
468481GPUdi () float TPCFastSpaceChargeCorrection::getMaxDriftLength (int32_t slice, int32_t row, float pad) const
0 commit comments