@@ -56,29 +56,29 @@ class TPCFastSpaceChargeCorrection : public FlatObject
5656 float splineScalingWithZ{0 .f }; // /< spline scaling factor in the Z region between the zOut and the readout plane
5757
5858 public:
59- void set (float y0 , float yScale , float z0 , float zScale , float zOut , float zReadout )
59+ void set (float y0_ , float yScale_ , float z0_ , float zScale_ , float zOut_ , float zReadout_ )
6060 {
61- this ->y0 = y0 ;
62- this ->yScale = yScale ;
63- this ->z0 = z0 ;
64- this ->zScale = zScale ;
65- this ->zOut = zOut ;
61+ this ->y0 = y0_ ;
62+ this ->yScale = yScale_ ;
63+ this ->z0 = z0_ ;
64+ this ->zScale = zScale_ ;
65+ this ->zOut = zOut_ ;
6666 // no scaling when the distance to the readout is too small
67- this ->splineScalingWithZ = fabs (zReadout - zOut ) > 1 . ? 1 . / (zReadout - zOut ) : 0 .;
67+ this ->splineScalingWithZ = fabs (zReadout_ - zOut_ ) > 1 . ? 1 . / (zReadout_ - zOut_ ) : 0 .;
6868 }
6969
7070 float getY0 () const { return y0; }
7171 float getYscale () const { return yScale; }
7272 float getZ0 () const { return z0; }
7373 float getZscale () const { return zScale; }
7474
75- float getSpineScaleForZ (float z) const
75+ GPUd () float getSpineScaleForZ (float z) const
7676 {
7777 return 1 .f - GPUCommonMath::Clamp ((z - zOut) * splineScalingWithZ, 0 .f , 1 .f );
7878 }
7979
8080 // / convert local y, z to internal grid coordinates u,v, and spline scale
81- std::array<float , 3 > convLocalToGridUntruncated (float y, float z) const
81+ GPUd () std::array<float , 3 > convLocalToGridUntruncated (float y, float z) const
8282 {
8383 return {(y - y0) * yScale, (z - z0) * zScale, getSpineScaleForZ (z)};
8484 }
@@ -458,21 +458,21 @@ GPUdi() std::array<float, 3> TPCFastSpaceChargeCorrection::convLocalToGrid(int32
458458 // / convert local y, z to internal grid coordinates u,v
459459 // / return values: u, v, scaling factor
460460 const SplineType& spline = getSpline (sector, row);
461- auto [gridU, gridV, scale] = getSectorRowInfo (sector, row).gridMeasured .convLocalToGridUntruncated (y, z);
461+ auto val = getSectorRowInfo (sector, row).gridMeasured .convLocalToGridUntruncated (y, z);
462462 // shrink to the grid
463- gridU = GPUCommonMath::Clamp (gridU , 0 .f , (float )spline.getGridX1 ().getUmax ());
464- gridV = GPUCommonMath::Clamp (gridV , 0 .f , (float )spline.getGridX2 ().getUmax ());
465- return {gridU, gridV, scale} ;
463+ val[ 0 ] = GPUCommonMath::Clamp (val[ 0 ] , 0 .f , (float )spline.getGridX1 ().getUmax ());
464+ val[ 1 ] = GPUCommonMath::Clamp (val[ 1 ] , 0 .f , (float )spline.getGridX2 ().getUmax ());
465+ return val ;
466466}
467467
468468GPUdi () bool TPCFastSpaceChargeCorrection::isLocalInsideGrid(int32_t sector, int32_t row, float y, float z) const
469469{
470470 // / check if local y, z are inside the grid
471- auto [gridU, gridV, scale] = getSectorRowInfo (sector, row).gridMeasured .convLocalToGridUntruncated (y, z);
471+ auto val = getSectorRowInfo (sector, row).gridMeasured .convLocalToGridUntruncated (y, z);
472472 const auto & spline = getSpline (sector, row);
473473 // shrink to the grid
474- if (gridU < 0 .f || gridU > (float )spline.getGridX1 ().getUmax () || //
475- gridV < 0 .f || gridV > (float )spline.getGridX2 ().getUmax ()) {
474+ if (val[ 0 ] < 0 .f || val[ 0 ] > (float )spline.getGridX1 ().getUmax () || //
475+ val[ 1 ] < 0 .f || val[ 1 ] > (float )spline.getGridX2 ().getUmax ()) {
476476 return false ;
477477 }
478478 return true ;
@@ -481,11 +481,11 @@ GPUdi() bool TPCFastSpaceChargeCorrection::isLocalInsideGrid(int32_t sector, int
481481GPUdi () bool TPCFastSpaceChargeCorrection::isRealLocalInsideGrid(int32_t sector, int32_t row, float y, float z) const
482482{
483483 // / check if local y, z are inside the grid
484- auto [gridU, gridV, scale] = getSectorRowInfo (sector, row).gridReal .convLocalToGridUntruncated (y, z);
484+ auto val = getSectorRowInfo (sector, row).gridReal .convLocalToGridUntruncated (y, z);
485485 const auto & spline = getSpline (sector, row);
486486 // shrink to the grid
487- if (gridU < 0 .f || gridU > (float )spline.getGridX1 ().getUmax () || //
488- gridV < 0 .f || gridV > (float )spline.getGridX2 ().getUmax ()) {
487+ if (val[ 0 ] < 0 .f || val[ 0 ] > (float )spline.getGridX1 ().getUmax () || //
488+ val[ 1 ] < 0 .f || val[ 1 ] > (float )spline.getGridX2 ().getUmax ()) {
489489 return false ;
490490 }
491491 return true ;
@@ -501,11 +501,11 @@ GPUdi() std::array<float, 3> TPCFastSpaceChargeCorrection::convRealLocalToGrid(i
501501{
502502 // / convert real y, z to the internal grid coordinates + scale
503503 const SplineType& spline = getSpline (sector, row);
504- auto [gridU, gridV, scale] = getSectorRowInfo (sector, row).gridReal .convLocalToGridUntruncated (y, z);
504+ auto val = getSectorRowInfo (sector, row).gridReal .convLocalToGridUntruncated (y, z);
505505 // shrink to the grid
506- gridU = GPUCommonMath::Clamp (gridU , 0 .f , (float )spline.getGridX1 ().getUmax ());
507- gridV = GPUCommonMath::Clamp (gridV , 0 .f , (float )spline.getGridX2 ().getUmax ());
508- return {gridU, gridV, scale} ;
506+ val[ 0 ] = GPUCommonMath::Clamp (val[ 0 ] , 0 .f , (float )spline.getGridX1 ().getUmax ());
507+ val[ 1 ] = GPUCommonMath::Clamp (val[ 1 ] , 0 .f , (float )spline.getGridX2 ().getUmax ());
508+ return val ;
509509}
510510
511511GPUdi () std::array<float, 2> TPCFastSpaceChargeCorrection::convGridToRealLocal(int32_t sector, int32_t row, float gridU, float gridV) const
@@ -520,35 +520,35 @@ GPUdi() std::array<float, 3> TPCFastSpaceChargeCorrection::getCorrectionLocal(in
520520 const SplineType& spline = getSpline (sector, row);
521521 const float * splineData = getSplineData (sector, row);
522522
523- auto [gridU, gridV, scale] = convLocalToGrid (sector, row, y, z);
523+ auto val = convLocalToGrid (sector, row, y, z);
524524
525525 float dxyz[3 ];
526- spline.interpolateAtU (splineData, gridU, gridV , dxyz);
526+ spline.interpolateAtU (splineData, val[ 0 ], val[ 1 ] , dxyz);
527527
528- float dx = scale * GPUCommonMath::Clamp (dxyz[0 ], info.minCorr [0 ], info.maxCorr [0 ]);
529- float dy = scale * GPUCommonMath::Clamp (dxyz[1 ], info.minCorr [1 ], info.maxCorr [1 ]);
530- float dz = scale * GPUCommonMath::Clamp (dxyz[2 ], info.minCorr [2 ], info.maxCorr [2 ]);
528+ float dx = val[ 2 ] * GPUCommonMath::Clamp (dxyz[0 ], info.minCorr [0 ], info.maxCorr [0 ]);
529+ float dy = val[ 2 ] * GPUCommonMath::Clamp (dxyz[1 ], info.minCorr [1 ], info.maxCorr [1 ]);
530+ float dz = val[ 2 ] * GPUCommonMath::Clamp (dxyz[2 ], info.minCorr [2 ], info.maxCorr [2 ]);
531531 return {dx, dy, dz};
532532}
533533
534534GPUdi () float TPCFastSpaceChargeCorrection::getCorrectionXatRealYZ(int32_t sector, int32_t row, float realY, float realZ) const
535535{
536536 const auto & info = getSectorRowInfo (sector, row);
537- auto [gridU, gridV, scale] = convRealLocalToGrid (sector, row, realY, realZ);
537+ auto val = convRealLocalToGrid (sector, row, realY, realZ);
538538 float dx = 0 ;
539- getSplineInvX (sector, row).interpolateAtU (getSplineDataInvX (sector, row), gridU, gridV , &dx);
540- dx = scale * GPUCommonMath::Clamp (dx, info.minCorr [0 ], info.maxCorr [0 ]);
539+ getSplineInvX (sector, row).interpolateAtU (getSplineDataInvX (sector, row), val[ 0 ], val[ 1 ] , &dx);
540+ dx = val[ 2 ] * GPUCommonMath::Clamp (dx, info.minCorr [0 ], info.maxCorr [0 ]);
541541 return dx;
542542}
543543
544544GPUdi () std::array<float, 2> TPCFastSpaceChargeCorrection::getCorrectionYZatRealYZ(int32_t sector, int32_t row, float realY, float realZ) const
545545{
546- auto [gridU, gridV, scale] = convRealLocalToGrid (sector, row, realY, realZ);
546+ auto val = convRealLocalToGrid (sector, row, realY, realZ);
547547 const auto & info = getSectorRowInfo (sector, row);
548548 float dyz[2 ];
549- getSplineInvYZ (sector, row).interpolateAtU (getSplineDataInvYZ (sector, row), gridU, gridV , dyz);
550- dyz[0 ] = scale * GPUCommonMath::Clamp (dyz[0 ], info.minCorr [1 ], info.maxCorr [1 ]);
551- dyz[1 ] = scale * GPUCommonMath::Clamp (dyz[1 ], info.minCorr [2 ], info.maxCorr [2 ]);
549+ getSplineInvYZ (sector, row).interpolateAtU (getSplineDataInvYZ (sector, row), val[ 0 ], val[ 1 ] , dyz);
550+ dyz[0 ] = val[ 2 ] * GPUCommonMath::Clamp (dyz[0 ], info.minCorr [1 ], info.maxCorr [1 ]);
551+ dyz[1 ] = val[ 2 ] * GPUCommonMath::Clamp (dyz[1 ], info.minCorr [2 ], info.maxCorr [2 ]);
552552 return {dyz[0 ], dyz[1 ]};
553553}
554554
0 commit comments