Skip to content

Commit

Permalink
TPC Splines: add limits for SP correction values per TPC row
Browse files Browse the repository at this point in the history
  • Loading branch information
sgorbuno committed Apr 18, 2024
1 parent 9a9aa80 commit 095c7ad
Showing 1 changed file with 62 additions and 6 deletions.
68 changes: 62 additions & 6 deletions GPU/TPCFastTransformation/TPCFastSpaceChargeCorrection.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,56 @@ class TPCFastSpaceChargeCorrection : public FlatObject
float scaleCorrUtoGrid{0.f}; ///< scale corrected U to U-grid coordinate
float gridCorrV0{0.f}; ///< V coordinate of the V-grid start for corrected V
float scaleCorrVtoGrid{0.f}; ///< scale corrected V to V-grid coordinate
float maxCorr[3]{10.f}; ///< max correction for dX, dU, dV
float minCorr[3]{-10.f}; ///< min correction for dX, dU, dV
float maxInvCorr[3]{10.f}; ///< max inverse correction for dX, dU, dV
float minInvCorr[3]{-10.f}; ///< min inverse correction for dX, dU, dV
RowActiveArea activeArea;

void resetMaxValues()
{
maxCorr[0] = 0.f;
minCorr[0] = 0.f;
maxCorr[1] = 0.f;
minCorr[1] = 0.f;
maxCorr[2] = 0.f;
minCorr[2] = 0.f;
}

void updateMaxValues(float dx, float du, float dv)
{
maxCorr[0] = std::max(maxCorr[0], dx);
minCorr[0] = std::min(minCorr[0], dx);

maxCorr[1] = std::max(maxCorr[1], du);
minCorr[1] = std::min(minCorr[1], du);

maxCorr[2] = std::max(maxCorr[2], dv);
minCorr[2] = std::min(minCorr[2], dv);
}

void resetMaxValuesInv()
{
maxInvCorr[0] = 0.f;
minInvCorr[0] = 0.f;
maxInvCorr[1] = 0.f;
minInvCorr[1] = 0.f;
maxInvCorr[2] = 0.f;
minInvCorr[2] = 0.f;
}

void updateMaxValuesInv(float dx, float du, float dv)
{
maxInvCorr[0] = std::max(maxInvCorr[0], dx);
minInvCorr[0] = std::min(minInvCorr[0], dx);

maxInvCorr[1] = std::max(maxInvCorr[1], du);
minInvCorr[1] = std::min(minInvCorr[1], du);

maxInvCorr[2] = std::max(maxInvCorr[2], dv);
minInvCorr[2] = std::min(minInvCorr[2], dv);
}

#ifndef GPUCA_ALIROOT_LIB
ClassDefNV(SliceRowInfo, 2);
#endif
Expand Down Expand Up @@ -406,9 +455,10 @@ GPUdi() int TPCFastSpaceChargeCorrection::getCorrection(int slice, int row, floa
convUVtoGrid(slice, row, u, v, gridU, gridV);
float dxuv[3];
spline.interpolateU(splineData, gridU, gridV, dxuv);
dx = dxuv[0];
du = dxuv[1];
dv = dxuv[2];
const auto& info = getSliceRowInfo(slice, row);
dx = std::max(info.minCorr[0], std::min(info.maxCorr[0], dxuv[0]));
du = std::max(info.minCorr[1], std::min(info.maxCorr[1], dxuv[1]));
dv = std::max(info.minCorr[2], std::min(info.maxCorr[2], dxuv[2]));
return 0;
}

Expand All @@ -420,9 +470,10 @@ GPUdi() int TPCFastSpaceChargeCorrection::getCorrectionOld(int slice, int row, f
convUVtoGrid(slice, row, u, v, gridU, gridV);
float dxuv[3];
spline.interpolateUold(splineData, gridU, gridV, dxuv);
dx = dxuv[0];
du = dxuv[1];
dv = dxuv[2];
const auto& info = getSliceRowInfo(slice, row);
dx = std::max(info.minCorr[0], std::min(info.maxCorr[0], dxuv[0]));
du = std::max(info.minCorr[1], std::min(info.maxCorr[1], dxuv[1]));
dv = std::max(info.minCorr[2], std::min(info.maxCorr[2], dxuv[2]));
return 0;
}

Expand All @@ -436,6 +487,8 @@ GPUdi() void TPCFastSpaceChargeCorrection::getCorrectionInvCorrectedX(
const float* splineData = getSplineData(slice, row, 1);
float dx = 0;
spline.interpolateU(splineData, gridU, gridV, &dx);
const auto& info = getSliceRowInfo(slice, row);
dx = std::max(info.minInvCorr[0], std::min(info.maxInvCorr[0], dx));
x = mGeo.getRowInfo(row).x + dx;
}

Expand All @@ -450,6 +503,9 @@ GPUdi() void TPCFastSpaceChargeCorrection::getCorrectionInvUV(

float duv[2];
spline.interpolateU(splineData, gridU, gridV, duv);
const auto& info = getSliceRowInfo(slice, row);
duv[0] = std::max(info.minInvCorr[1], std::min(info.maxInvCorr[1], duv[0]));
duv[1] = std::max(info.minInvCorr[2], std::min(info.maxInvCorr[2], duv[1]));
nomU = corrU - duv[0];
nomV = corrV - duv[1];
}
Expand Down

0 comments on commit 095c7ad

Please sign in to comment.