Skip to content

Commit

Permalink
invert z for correct definition
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-kleiner committed Jan 3, 2024
1 parent 62c2e49 commit 8485d8f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions GPU/TPCFastTransformation/TPCFastTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,24 @@ class TPCFastTransform : public FlatObject

GPUd() float getScaling(int slice, float z, const float* scale) const
{
// invert to have 0 at central electrode and 250 at readout
z = GPUCommonMath::Abs(z - mCorrection.getMaxDriftLength(slice));

const int idxValOffs = (slice < getGeometry().getNumberOfSlicesA()) ? 0 : NLUMIZBINS;

float scaleVal = 0;
// find closest z bins
const float absZ = GPUCommonMath::Abs(z);
// const float absZ = GPUCommonMath::Abs(z);
const int offsZIdx = 2 * NLUMIZBINS;
const float zMin = scale[offsZIdx];
const float zMax = scale[offsZIdx + NLUMIZBINS - 1];

int type = 0;
if (absZ < zMin) {
if (z < zMin) {
type = 0;
// if z value is smaller than min value return last valid value
scaleVal = scale[idxValOffs];
} else if (absZ > zMax) {
} else if (z > zMax) {
type = 1;
// if z value is larger than max value return last valid value
scaleVal = scale[idxValOffs + NLUMIZBINS - 1];
Expand All @@ -295,9 +298,9 @@ class TPCFastTransform : public FlatObject
if (deltaZScaler < deltaZClosest) {
deltaZClosest = deltaZScaler;
idxZClosest = iz;
if (absZ == scale[idxZ]) {
if (z == scale[idxZ]) {
idxZClosestN = iz;
} else if (absZ < scale[idxZ]) {
} else if (z < scale[idxZ]) {
idxZClosestN = iz - 1;
} else {
idxZClosestN = iz + 1;
Expand All @@ -318,7 +321,7 @@ class TPCFastTransform : public FlatObject
const float y1 = scale[idxValOffs + idx1];
const float x0 = scale[offsZIdx + idx0];
const float x1 = scale[offsZIdx + idx1];
const float x = absZ;
const float x = z;
scaleVal = (y0 * (x1 - x) + y1 * (x - x0)) / (x1 - x0);

GPUCA_DEBUG_STREAMER_CHECK(if (o2::utils::DebugStreamer::checkStream(o2::utils::StreamFlags::streamFastTransform)) {
Expand Down

0 comments on commit 8485d8f

Please sign in to comment.