Skip to content

Commit 7b2c021

Browse files
committed
Fix GPUTPCGeometry LinearPad2Y/Y2Pad methods, define biased ones in GPUTPCCompressionTrackModel
1 parent e082562 commit 7b2c021

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

GPU/GPUTracking/DataCompression/GPUTPCCompressionKernels.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ GPUdii() void GPUTPCCompressionKernels::Thread<GPUTPCCompressionKernels::step0at
6969
}
7070
const ClusterNative& GPUrestrict() orgCl = clusters->clusters[hit.slice][hit.row][hit.num - clusters->clusterOffset[hit.slice][hit.row]];
7171
float x = param.tpcGeometry.Row2X(hit.row);
72-
float y = param.tpcGeometry.LinearPad2Y(hit.slice, hit.row, orgCl.getPad());
72+
float y = track.LinearPad2Y(hit.slice, orgCl.getPad(), param.tpcGeometry.PadWidth(hit.row), param.tpcGeometry.NPads(hit.row));
7373
float z = param.tpcGeometry.LinearTime2Z(hit.slice, orgCl.getTime());
7474
if (nClustersStored) {
7575
if ((hit.slice < GPUCA_NSLICES) ^ (lastSlice < GPUCA_NSLICES)) {
@@ -115,7 +115,7 @@ GPUdii() void GPUTPCCompressionKernels::Thread<GPUTPCCompressionKernels::step0at
115115
}
116116
c.rowDiffA[cidx] = row;
117117
c.sliceLegDiffA[cidx] = (hit.leg == lastLeg ? 0 : compressor.NSLICES) + slice;
118-
float pad = CAMath::Max(0.f, CAMath::Min((float)param.tpcGeometry.NPads(GPUCA_ROW_COUNT - 1), param.tpcGeometry.LinearY2Pad(hit.slice, hit.row, track.Y())));
118+
float pad = CAMath::Max(0.f, CAMath::Min((float)param.tpcGeometry.NPads(GPUCA_ROW_COUNT - 1), track.LinearY2Pad(hit.slice, track.Y(), param.tpcGeometry.PadWidth(hit.row), param.tpcGeometry.NPads(hit.row))));
119119
c.padResA[cidx] = orgCl.padPacked - orgCl.packPad(pad);
120120
float time = CAMath::Max(0.f, param.tpcGeometry.LinearZ2Time(hit.slice, track.Z() + zOffset));
121121
c.timeResA[cidx] = (orgCl.getTimePacked() - orgCl.packTime(time)) & 0xFFFFFF;

GPU/GPUTracking/DataCompression/GPUTPCCompressionTrackModel.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,18 @@ class GPUTPCCompressionTrackModel
100100
GPUd() void getClusterErrors2(int32_t iRow, float z, float sinPhi, float DzDs, float& ErrY2, float& ErrZ2) const;
101101
GPUd() void resetCovariance();
102102

103+
GPUd() float LinearPad2Y(int32_t slice, float pad, float padWidth, int8_t npads) const
104+
{
105+
const float u = (pad - 0.5f * npads) * padWidth;
106+
return (slice >= GPUCA_NSLICES / 2) ? -u : u;
107+
}
108+
109+
GPUd() float LinearY2Pad(int32_t slice, float y, float padWidth, int8_t npads) const
110+
{
111+
const float u = (slice >= GPUCA_NSLICES / 2) ? -y : y;
112+
return u / padWidth + 0.5f * npads;
113+
}
114+
103115
#endif
104116

105117
protected:

GPU/GPUTracking/DataCompression/TPCClusterDecompressionCore.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class TPCClusterDecompressionCore
113113
timeTmp |= 0xFF000000;
114114
}
115115
time = timeTmp + ClusterNative::packTime(CAMath::Max(0.f, param.tpcGeometry.LinearZ2Time(slice, track.Z() + zOffset)));
116-
float tmpPad = CAMath::Max(0.f, CAMath::Min((float)param.tpcGeometry.NPads(GPUCA_ROW_COUNT - 1), param.tpcGeometry.LinearY2Pad(slice, row, track.Y())));
116+
float tmpPad = CAMath::Max(0.f, CAMath::Min((float)param.tpcGeometry.NPads(GPUCA_ROW_COUNT - 1), track.LinearY2Pad(slice, track.Y(), param.tpcGeometry.PadWidth(row), param.tpcGeometry.NPads(row))));
117117
pad = cmprClusters.padResA[clusterOffset - trackIndex - 1] + ClusterNative::packPad(tmpPad);
118118
time = time & 0xFFFFFF;
119119
pad = (uint16_t)pad;
@@ -136,7 +136,7 @@ class TPCClusterDecompressionCore
136136
pad = cmprClusters.padA[trackIndex];
137137
}
138138
const auto cluster = decompressTrackStore(cmprClusters, clusterOffset, slice, row, pad, time, args...);
139-
float y = param.tpcGeometry.LinearPad2Y(slice, row, cluster.getPad());
139+
float y = track.LinearPad2Y(slice, cluster.getPad(), param.tpcGeometry.PadWidth(row), param.tpcGeometry.NPads(row));
140140
float z = param.tpcGeometry.LinearTime2Z(slice, cluster.getTime());
141141
if (clusterIndex == 0) {
142142
zOffset = z;
@@ -187,4 +187,4 @@ class TPCClusterDecompressionCore
187187
};
188188
} // namespace GPUCA_NAMESPACE::gpu
189189

190-
#endif
190+
#endif

GPU/GPUTracking/DataTypes/GPUTPCGeometry.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ class GPUTPCGeometry // TODO: Make values constexpr
114114

115115
GPUd() float LinearPad2Y(int32_t slice, int32_t row, float pad) const
116116
{
117+
#ifdef GPUCA_TPC_GEOMETRY_O2
118+
const float u = (pad - 0.5f * (mNPads[row] - 1)) * PadWidth(row);
119+
#else
117120
const float u = (pad - 0.5f * mNPads[row]) * PadWidth(row);
121+
#endif
118122
return (slice >= GPUCA_NSLICES / 2) ? -u : u;
119123
}
120124

@@ -127,7 +131,11 @@ class GPUTPCGeometry // TODO: Make values constexpr
127131
GPUd() float LinearY2Pad(int32_t slice, int32_t row, float y) const
128132
{
129133
const float u = (slice >= GPUCA_NSLICES / 2) ? -y : y;
134+
#ifdef GPUCA_TPC_GEOMETRY_O2
135+
return u / PadWidth(row) + 0.5f * (mNPads[row] - 1);
136+
#else
130137
return u / PadWidth(row) + 0.5f * mNPads[row];
138+
#endif
131139
}
132140

133141
GPUd() static float LinearZ2Time(int32_t slice, float z)

0 commit comments

Comments
 (0)