Skip to content

Commit e208112

Browse files
committed
GPU: Add sector angles to GPUTPCGeometry
1 parent cadc356 commit e208112

File tree

8 files changed

+92
-199
lines changed

8 files changed

+92
-199
lines changed

GPU/GPUTracking/Base/GPUParam.cxx

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,6 @@ void GPUParam::SetDefaults(float solenoidBz, bool assumeConstantBz)
8787
UpdateBzOnly(solenoidBz, assumeConstantBz);
8888
par.dodEdx = 0;
8989

90-
constexpr float plusZmin = 0.0529937;
91-
constexpr float plusZmax = 249.778;
92-
constexpr float minusZmin = -249.645;
93-
constexpr float minusZmax = -0.0799937;
94-
for (uint32_t i = 0; i < GPUTPCGeometry::NSECTORS; i++) {
95-
const bool zPlus = (i < GPUTPCGeometry::NSECTORS / 2);
96-
SectorParam[i].ZMin = zPlus ? plusZmin : minusZmin;
97-
SectorParam[i].ZMax = zPlus ? plusZmax : minusZmax;
98-
int32_t tmp = i;
99-
if (tmp >= (int32_t)GPUTPCGeometry::NSECTORS / 2) {
100-
tmp -= GPUTPCGeometry::NSECTORS / 2;
101-
}
102-
if (tmp >= (int32_t)GPUTPCGeometry::NSECTORS / 4) {
103-
tmp -= GPUTPCGeometry::NSECTORS / 2;
104-
}
105-
SectorParam[i].Alpha = 0.174533f + dAlpha * tmp;
106-
SectorParam[i].CosAlpha = CAMath::Cos(SectorParam[i].Alpha);
107-
SectorParam[i].SinAlpha = CAMath::Sin(SectorParam[i].Alpha);
108-
SectorParam[i].AngleMin = SectorParam[i].Alpha - dAlpha / 2.f;
109-
SectorParam[i].AngleMax = SectorParam[i].Alpha + dAlpha / 2.f;
110-
}
111-
11290
par.continuousTracking = false;
11391
continuousMaxTimeBin = 0;
11492
tpcCutTimeBin = 0;

GPU/GPUTracking/Base/GPUParam.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ struct GPUSettingsRec;
3737
struct GPUSettingsGTP;
3838
struct GPURecoStepConfiguration;
3939

40-
struct GPUParamSector {
41-
float Alpha; // sector angle
42-
float CosAlpha, SinAlpha; // sign and cosine of the sector angle
43-
float AngleMin, AngleMax; // minimal and maximal angle
44-
float ZMin, ZMax; // sector Z range
45-
};
46-
4740
namespace internal
4841
{
4942
template <class T, class S>
@@ -66,8 +59,6 @@ struct GPUParam_t {
6659
uint32_t occupancyTotal; // Total occupancy in the TPC (nCl / nHbf)
6760
uint32_t occupancyMapSize; // Size of occupancy map
6861

69-
GPUParamSector SectorParam[o2::tpc::constants::MAXSECTOR];
70-
7162
protected:
7263
#ifndef GPUCA_RUN2
7364
float ParamErrors[2][4][4]; // cluster error parameterization used during seeding and fit
@@ -89,7 +80,7 @@ struct GPUParam : public internal::GPUParam_t<GPUSettingsRec, GPUSettingsParam>
8980
#endif
9081

9182
GPUd() constexpr uint32_t tpcMinHitsB5(float qPtB5) const { return CAMath::Abs(qPtB5) > 10 ? 10 : (CAMath::Abs(qPtB5) > 5 ? 15 : 29); } // Minimum hits should depend on Pt, low Pt tracks can have few hits. 29 Hits default, 15 for < 200 mev, 10 for < 100 mev
92-
GPUd() constexpr float Alpha(int32_t iSector) const
83+
GPUd() constexpr float Alpha(int32_t iSector) const // TODO: Check if this is faster, or the lookup from GPUTPCGeometry
9384
{
9485
if (iSector >= (int32_t)o2::tpc::constants::MAXSECTOR / 2) {
9586
iSector -= o2::tpc::constants::MAXSECTOR / 2;

GPU/GPUTracking/Base/GPUParam.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ namespace o2::gpu
2626
GPUdi() void GPUParam::Sector2Global(int32_t iSector, float x, float y, float z, float* X, float* Y, float* Z) const
2727
{
2828
// conversion of coordinates sector->global
29-
*X = x * SectorParam[iSector].CosAlpha - y * SectorParam[iSector].SinAlpha;
30-
*Y = y * SectorParam[iSector].CosAlpha + x * SectorParam[iSector].SinAlpha;
29+
*X = x * GPUTPCGeometry::SectorCos(iSector) - y * GPUTPCGeometry::SectorSin(iSector);
30+
*Y = y * GPUTPCGeometry::SectorCos(iSector) + x * GPUTPCGeometry::SectorSin(iSector);
3131
*Z = z;
3232
}
3333

3434
GPUdi() void GPUParam::Global2Sector(int32_t iSector, float X, float Y, float Z, float* x, float* y, float* z) const
3535
{
3636
// conversion of coordinates global->sector
37-
*x = X * SectorParam[iSector].CosAlpha + Y * SectorParam[iSector].SinAlpha;
38-
*y = Y * SectorParam[iSector].CosAlpha - X * SectorParam[iSector].SinAlpha;
37+
*x = X * GPUTPCGeometry::SectorCos(iSector) + Y * GPUTPCGeometry::SectorSin(iSector);
38+
*y = Y * GPUTPCGeometry::SectorCos(iSector) - X * GPUTPCGeometry::SectorSin(iSector);
3939
*z = Z;
4040
}
4141

GPU/GPUTracking/DataCompression/GPUTPCCompressionKernels.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ GPUdii() void GPUTPCCompressionKernels::Thread<GPUTPCCompressionKernels::step0at
7676
if ((hit.sector < GPUTPCGeometry::NSECTORS) ^ (lastSector < GPUTPCGeometry::NSECTORS)) {
7777
break;
7878
}
79-
if (track.Propagate(geo.Row2X(hit.row), param.SectorParam[hit.sector].Alpha)) {
79+
if (track.Propagate(geo.Row2X(hit.row), GPUTPCGeometry::SectorAlpha(hit.sector))) {
8080
break;
8181
}
8282
}
@@ -87,7 +87,7 @@ GPUdii() void GPUTPCCompressionKernels::Thread<GPUTPCCompressionKernels::step0at
8787
if (nClustersStored == 1) {
8888
uint8_t qpt = fabs(trk.GetParam().GetQPt()) < 20.f ? (trk.GetParam().GetQPt() * (127.f / 20.f) + 127.5f) : (trk.GetParam().GetQPt() > 0 ? 254 : 0);
8989
zOffset = z;
90-
track.Init(x, y, z - zOffset, param.SectorParam[hit.sector].Alpha, qpt, param);
90+
track.Init(x, y, z - zOffset, GPUTPCGeometry::SectorAlpha(hit.sector), qpt, param);
9191

9292
myTrack = CAMath::AtomicAdd(&compressor.mMemory->nStoredTracks, 1u);
9393
compressor.mAttachedClusterFirstIndex[myTrack] = trk.FirstClusterRef();

GPU/GPUTracking/DataCompression/TPCClusterDecompressionCore.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class TPCClusterDecompressionCore
107107
if (changeLeg && track.Mirror()) {
108108
break;
109109
}
110-
if (track.Propagate(geo.Row2X(row), param.SectorParam[slice].Alpha)) {
110+
if (track.Propagate(geo.Row2X(row), GPUTPCGeometry::SectorAlpha(slice))) {
111111
break;
112112
}
113113
uint32_t timeTmp = cmprClusters.timeResA[clusterOffset - trackIndex - 1];
@@ -142,7 +142,7 @@ class TPCClusterDecompressionCore
142142
float z = geo.LinearTime2Z(slice, cluster.getTime());
143143
if (clusterIndex == 0) {
144144
zOffset = z;
145-
track.Init(geo.Row2X(row), y, z - zOffset, param.SectorParam[slice].Alpha, cmprClusters.qPtA[trackIndex], param);
145+
track.Init(geo.Row2X(row), y, z - zOffset, GPUTPCGeometry::SectorAlpha(slice), cmprClusters.qPtA[trackIndex], param);
146146
}
147147
if (clusterIndex + 1 < cmprClusters.nTrackClusters[trackIndex] && track.Filter(y, z - zOffset, row)) {
148148
break;

GPU/GPUTracking/DataTypes/GPUTPCGeometry.h

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,20 @@ GPUconstexpr() float mPadWidth[NREGIONS] = {.4f, .6f, .6f};
8383

8484
constexpr float TPC_LENGTH = 250.f - 0.275f;
8585
constexpr float FACTOR_T2Z = 250.f / 1024.f; // Used in compression, must remain constant at 250cm, 1024 time bins!
86-
#endif // clang-format on
86+
#endif
87+
88+
GPUconstexpr() float mSectorAngle[o2::tpc::constants::MAXSECTOR][2] = {{0x1.63a1a8p-3f, 0x1.f838b8p-1f}, {0x1p-1f, 0x1.bb67aep-1f}, {0x1.8836fap-1f, 0x1.491b76p-1f}, {0x1.e11f64p-1f, 0x1.5e3a88p-2f}, {0x1p+0f, 0x1.1a6264p-54f}, {0x1.e11f64p-1f, -0x1.5e3a88p-2f},
89+
{0x1.8836fap-1f, -0x1.491b76p-1f}, {0x1p-1f, -0x1.bb67aep-1f}, {0x1.63a1a8p-3f, -0x1.f838b8p-1f}, {-0x1.63a1a8p-3f, -0x1.f838b8p-1f}, {-0x1p-1f, -0x1.bb67aep-1f}, {-0x1.8836fap-1f, -0x1.491b76p-1f},
90+
{-0x1.e11f64p-1f, -0x1.5e3a88p-2f}, {-0x1p+0f, -0x1.a79394p-53f}, {-0x1.e11f64p-1f, 0x1.5e3a88p-2f}, {-0x1.8836fap-1f, 0x1.491b76p-1f}, {-0x1p-1f, 0x1.bb67aep-1f}, {-0x1.63a1a8p-3f, 0x1.f838b8p-1f},
91+
{0x1.63a1a8p-3f, 0x1.f838b8p-1f}, {0x1p-1f, 0x1.bb67aep-1f}, {0x1.8836fap-1f, 0x1.491b76p-1f}, {0x1.e11f64p-1f, 0x1.5e3a88p-2f}, {0x1p+0f, 0x1.60fafcp-52f}, {0x1.e11f64p-1f, -0x1.5e3a88p-2f},
92+
{0x1.8836fap-1f, -0x1.491b76p-1f}, {0x1p-1f, -0x1.bb67aep-1f}, {0x1.63a1a8p-3f, -0x1.f838b8p-1f}, {-0x1.63a1a8p-3f, -0x1.f838b8p-1f}, {-0x1p-1f, -0x1.bb67aep-1f}, {-0x1.8836fap-1f, -0x1.491b76p-1f},
93+
{-0x1.e11f64p-1f, -0x1.5e3a88p-2f}, {-0x1p+0f, -0x1.ee2c2ep-52f}, {-0x1.e11f64p-1f, 0x1.5e3a88p-2f}, {-0x1.8836fap-1f, 0x1.491b76p-1f}, {-0x1p-1f, 0x1.bb67aep-1f}, {-0x1.63a1a8p-3f, 0x1.f838b8p-1f}};
94+
95+
GPUconstexpr() float mSectorAlpha[o2::tpc::constants::MAXSECTOR] = {0x1.65718ep-3f, 0x1.0c152ap-1f, 0x1.becdf2p-1f, 0x1.38c35cp+0f, 0x1.921fcp+0f, 0x1.eb7c24p+0f, 0x1.226c44p+1f, 0x1.4f1a76p+1f, 0x1.7bc8a6p+1f,
96+
-0x1.7bc8a6p+1f, -0x1.4f1a76p+1f, -0x1.226c44p+1f, -0x1.eb7c24p+0f, -0x1.921fcp+0f, -0x1.38c35cp+0f, -0x1.becdf2p-1f, -0x1.0c152ap-1f, -0x1.65718ep-3f,
97+
0x1.65718ep-3f, 0x1.0c152ap-1f, 0x1.becdf2p-1f, 0x1.38c35cp+0f, 0x1.921fcp+0f, 0x1.eb7c24p+0f, 0x1.226c44p+1f, 0x1.4f1a76p+1f, 0x1.7bc8a6p+1f,
98+
-0x1.7bc8a6p+1f, -0x1.4f1a76p+1f, -0x1.226c44p+1f, -0x1.eb7c24p+0f, -0x1.921fcp+0f, -0x1.38c35cp+0f, -0x1.becdf2p-1f, -0x1.0c152ap-1f, -0x1.65718ep-3f};
99+
// clang-format on
87100
} // namespace gputpcgeometry_internal
88101

89102
class GPUTPCGeometry
@@ -119,13 +132,16 @@ class GPUTPCGeometry
119132
GPUd() static constexpr float PadWidth(int32_t row) { return (gputpcgeometry_internal::mPadWidth[GetRegion(row)]); }
120133
#endif
121134

135+
GPUd() static constexpr float Row2X(uint32_t row) { return (gputpcgeometry_internal::mX[row]); }
122136
GPUd() static constexpr float NRegions() { return gputpcgeometry_internal::NREGIONS; }
123137
GPUd() static constexpr float TPCLength() { return gputpcgeometry_internal::TPC_LENGTH; }
124-
GPUd() static constexpr float Row2X(int32_t row) { return (gputpcgeometry_internal::mX[row]); }
125-
GPUd() static constexpr float PadHeight(int32_t row) { return (gputpcgeometry_internal::mPadHeight[GetRegion(row)]); }
126-
GPUd() static constexpr float PadHeightByRegion(int32_t region) { return (gputpcgeometry_internal::mPadHeight[region]); }
127-
GPUd() static constexpr float PadWidthByRegion(int32_t region) { return (gputpcgeometry_internal::mPadWidth[region]); }
128-
GPUd() static constexpr uint8_t NPads(int32_t row) { return gputpcgeometry_internal::mNPads[row]; }
138+
GPUd() static constexpr float PadHeight(uint32_t row) { return (gputpcgeometry_internal::mPadHeight[GetRegion(row)]); }
139+
GPUd() static constexpr float PadHeightByRegion(uint32_t region) { return (gputpcgeometry_internal::mPadHeight[region]); }
140+
GPUd() static constexpr float PadWidthByRegion(uint32_t region) { return (gputpcgeometry_internal::mPadWidth[region]); }
141+
GPUd() static constexpr uint8_t NPads(uint32_t row) { return gputpcgeometry_internal::mNPads[row]; }
142+
GPUd() static constexpr float SectorSin(uint32_t sector) { return gputpcgeometry_internal::mSectorAngle[sector][0]; }
143+
GPUd() static constexpr float SectorCos(uint32_t sector) { return gputpcgeometry_internal::mSectorAngle[sector][1]; }
144+
GPUd() static constexpr float SectorAlpha(uint32_t sector) { return gputpcgeometry_internal::mSectorAlpha[sector]; }
129145

130146
GPUd() static constexpr float LinearPad2Y(uint32_t sector, uint32_t row, float pad)
131147
{

0 commit comments

Comments
 (0)