@@ -362,8 +362,6 @@ GPUdi() void TPCFastSpaceChargeCorrection::convUVtoGrid(int32_t slice, int32_t r
362362 gu = 0 .f ;
363363 gv = 0 .f ;
364364
365- schrinkUV (slice, row, u, v);
366-
367365 const SliceRowInfo& info = getSliceRowInfo (slice, row);
368366 const SplineType& spline = getSpline (slice, row);
369367
@@ -372,11 +370,12 @@ GPUdi() void TPCFastSpaceChargeCorrection::convUVtoGrid(int32_t slice, int32_t r
372370 mGeo .convUVtoScaledUV (slice, row, u, v, gu, gv);
373371
374372 gv = (gv - sv0) / (1 .f - sv0);
373+
374+ gu = GPUCommonMath::Clamp (gu, 0 .f , 1 .f );
375+ gv = GPUCommonMath::Clamp (gv, 0 .f , 1 .f );
376+
375377 gu *= spline.getGridX1 ().getUmax ();
376378 gv *= spline.getGridX2 ().getUmax ();
377- if (gv < 0 .f ) {
378- gv = 0 .f ;
379- }
380379}
381380
382381GPUdi () void TPCFastSpaceChargeCorrection::convGridToUV (int32_t slice, int32_t row, float gridU, float gridV, float & u, float & v) const
@@ -403,12 +402,14 @@ GPUdi() float TPCFastSpaceChargeCorrection::getSplineScaleForV(int32_t slice, in
403402
404403GPUdi () void TPCFastSpaceChargeCorrection::convCorrectedUVtoGrid (int32_t slice, int32_t row, float corrU, float corrV, float & gridU, float & gridV) const
405404{
406- schrinkCorrectedUV (slice, row, corrU, corrV);
407405
408406 const SliceRowInfo& sliceRowInfo = getSliceRowInfo (slice, row);
409407
410408 gridU = (corrU - sliceRowInfo.gridCorrU0 ) * sliceRowInfo.scaleCorrUtoGrid ;
411409 gridV = (corrV - sliceRowInfo.gridCorrV0 ) * sliceRowInfo.scaleCorrVtoGrid ;
410+ const auto & spline = getSpline (slice, row);
411+ gridU = GPUCommonMath::Clamp (gridU, 0 .f , (float )spline.getGridX1 ().getUmax ());
412+ gridV = GPUCommonMath::Clamp (gridV, 0 .f , (float )spline.getGridX2 ().getUmax ());
412413}
413414
414415GPUdi () int32_t TPCFastSpaceChargeCorrection::getCorrection (int32_t slice, int32_t row, float u, float v, float & dx, float & du, float & dv) const
0 commit comments