Project
Loading...
Searching...
No Matches
GPUTPCGeometry.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef GPUTPCGEOMETRY_H
16#define GPUTPCGEOMETRY_H
17
18#include "GPUCommonDef.h"
20
21namespace o2::gpu
22{
23// Copy of TPC constants from AliRoot:TPCGeometry / O2:TPC/Base/Mapper, cannot take the contants from the official headers for now, since we want it to be const / constexpr
24
25namespace gputpcgeometry_internal
26{
27#ifndef GPUCA_RUN2 // clang-format off
28constexpr uint32_t NREGIONS = 10;
29GPUconstexpr() float mX[o2::tpc::constants::MAXGLOBALPADROW] = {85.225f, 85.975f, 86.725f, 87.475f, 88.225f, 88.975f, 89.725f, 90.475f, 91.225f, 91.975f, 92.725f, 93.475f, 94.225f, 94.975f, 95.725f, 96.475f, 97.225f, 97.975f, 98.725f, 99.475f, 100.225f, 100.975f,
30 101.725f, 102.475f, 103.225f, 103.975f, 104.725f, 105.475f, 106.225f, 106.975f, 107.725f, 108.475f, 109.225f, 109.975f, 110.725f, 111.475f, 112.225f, 112.975f, 113.725f, 114.475f, 115.225f, 115.975f, 116.725f, 117.475f,
31 118.225f, 118.975f, 119.725f, 120.475f, 121.225f, 121.975f, 122.725f, 123.475f, 124.225f, 124.975f, 125.725f, 126.475f, 127.225f, 127.975f, 128.725f, 129.475f, 130.225f, 130.975f, 131.725f, 135.2f, 136.2f, 137.2f,
32 138.2f, 139.2f, 140.2f, 141.2f, 142.2f, 143.2f, 144.2f, 145.2f, 146.2f, 147.2f, 148.2f, 149.2f, 150.2f, 151.2f, 152.2f, 153.2f, 154.2f, 155.2f, 156.2f, 157.2f, 158.2f, 159.2f,
33 160.2f, 161.2f, 162.2f, 163.2f, 164.2f, 165.2f, 166.2f, 167.2f, 168.2f, 171.4f, 172.6f, 173.8f, 175.f, 176.2f, 177.4f, 178.6f, 179.8f, 181.f, 182.2f, 183.4f, 184.6f, 185.8f,
34 187.f, 188.2f, 189.4f, 190.6f, 191.8f, 193.f, 194.2f, 195.4f, 196.6f, 197.8f, 199.f, 200.2f, 201.4f, 202.6f, 203.8f, 205.f, 206.2f, 209.65f, 211.15f, 212.65f, 214.15f, 215.65f,
35 217.15f, 218.65f, 220.15f, 221.65f, 223.15f, 224.65f, 226.15f, 227.65f, 229.15f, 230.65f, 232.15f, 233.65f, 235.15f, 236.65f, 238.15f, 239.65f, 241.15f, 242.65f, 244.15f, 245.65f};
36
37GPUconstexpr() uint8_t mNPads[o2::tpc::constants::MAXGLOBALPADROW] = {66, 66, 66, 68, 68, 68, 70, 70, 70, 72, 72, 72, 74, 74, 74, 74, 76, 76, 76, 76, 78, 78, 78, 80, 80, 80, 82, 82, 82, 84, 84, 84, 86, 86, 86, 88, 88, 88,
38 90, 90, 90, 90, 92, 92, 92, 94, 94, 94, 92, 92, 92, 94, 94, 94, 96, 96, 96, 98, 98, 98, 100, 100, 100, 76, 76, 76, 76, 78, 78, 78, 80, 80, 80, 80, 82, 82,
39 82, 84, 84, 84, 84, 86, 86, 86, 88, 88, 88, 90, 90, 90, 90, 92, 92, 92, 94, 94, 94, 94, 96, 96, 96, 98, 98, 98, 100, 100, 102, 102, 102, 104, 104, 104, 106, 110,
40 110, 112, 112, 112, 114, 114, 114, 116, 116, 116, 118, 118, 118, 118, 118, 120, 120, 122, 122, 124, 124, 124, 126, 126, 128, 128, 128, 130, 130, 132, 132, 132, 134, 134, 136, 136, 138, 138};
41
42GPUconstexpr() uint8_t mRegion[o2::tpc::constants::MAXGLOBALPADROW] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
43 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9};
44GPUconstexpr() uint8_t mRegionRows[NREGIONS] = {17, 15, 16, 15, 18, 16, 16, 14, 13, 12};
45GPUconstexpr() uint8_t mRegionStart[NREGIONS] = {0, 17, 32, 48, 63, 81, 97, 113, 127, 140};
46
47GPUconstexpr() uint8_t mSampaMapping[NREGIONS] = {0, 0, 1, 1, 2, 3, 3, 4, 4, 2};
48GPUconstexpr() uint8_t mChannelOffset[NREGIONS] = {0, 16, 0, 16, 0, 0, 16, 0, 16, 16};
49GPUconstexpr() uint8_t mSectorFECOffset[5] = {0, 15, 15 + 18, 15 + 18 + 18, 15 + 18 + 18 + 20};
50
51GPUconstexpr() float mPadHeight[NREGIONS] = {.75f, .75f, .75f, .75f, 1.f, 1.f, 1.2f, 1.2f, 1.5f, 1.5f};
52GPUconstexpr() float mPadWidth[NREGIONS] = {.416f, .420f, .420f, .436f, .6f, .6f, .608f, .588f, .604f, .607f};
53GPUconstexpr() float mPadWidthRow[o2::tpc::constants::MAXGLOBALPADROW] = {.416, .416, .416, .416, .416, .416, .416, .416, .416, .416, .416, .416, .416, .416, .416, .416, .416,
54 .420, .420, .420, .420, .420, .420, .420, .420, .420, .420, .420, .420, .420, .420, .420,
55 .420, .420, .420, .420, .420, .420, .420, .420, .420, .420, .420, .420, .420, .420, .420, .420,
56 .436, .436, .436, .436, .436, .436, .436, .436, .436, .436, .436, .436, .436, .436, .436,
57 .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600,
58 .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600, .600,
59 .608, .608, .608, .608, .608, .608, .608, .608, .608, .608, .608, .608, .608, .608, .608, .608,
60 .588, .588, .588, .588, .588, .588, .588, .588, .588, .588, .588, .588, .588, .588,
61 .604, .604, .604, .604, .604, .604, .604, .604, .604, .604, .604, .604, .604,
62 .607, .607, .607, .607, .607, .607, .607, .607, .607, .607, .607, .607};
63
64constexpr float TPC_LENGTH = 250.f;
65constexpr float FACTOR_T2Z = 250.f / 512.f; // Used in compression, must remain constant at 250cm, 512 time bins!
66#else
67constexpr uint32_t NREGIONS = 3;
68GPUconstexpr() float mX[o2::tpc::constants::MAXGLOBALPADROW] = {85.195f, 85.945f, 86.695f, 87.445f, 88.195f, 88.945f, 89.695f, 90.445f, 91.195f, 91.945f, 92.695f, 93.445f, 94.195f, 94.945f, 95.695f, 96.445f, 97.195f, 97.945f, 98.695f, 99.445f, 100.195f, 100.945f, 101.695f,
69 102.445f, 103.195f, 103.945f, 104.695f, 105.445f, 106.195f, 106.945f, 107.695f, 108.445f, 109.195f, 109.945f, 110.695f, 111.445f, 112.195f, 112.945f, 113.695f, 114.445f, 115.195f, 115.945f, 116.695f, 117.445f, 118.195f, 118.945f,
70 119.695f, 120.445f, 121.195f, 121.945f, 122.695f, 123.445f, 124.195f, 124.945f, 125.695f, 126.445f, 127.195f, 127.945f, 128.695f, 129.445f, 130.195f, 130.945f, 131.695f, 135.180f, 136.180f, 137.180f, 138.180f, 139.180f, 140.180f,
71 141.180f, 142.180f, 143.180f, 144.180f, 145.180f, 146.180f, 147.180f, 148.180f, 149.180f, 150.180f, 151.180f, 152.180f, 153.180f, 154.180f, 155.180f, 156.180f, 157.180f, 158.180f, 159.180f, 160.180f, 161.180f, 162.180f, 163.180f,
72 164.180f, 165.180f, 166.180f, 167.180f, 168.180f, 169.180f, 170.180f, 171.180f, 172.180f, 173.180f, 174.180f, 175.180f, 176.180f, 177.180f, 178.180f, 179.180f, 180.180f, 181.180f, 182.180f, 183.180f, 184.180f, 185.180f, 186.180f,
73 187.180f, 188.180f, 189.180f, 190.180f, 191.180f, 192.180f, 193.180f, 194.180f, 195.180f, 196.180f, 197.180f, 198.180f, 199.430f, 200.930f, 202.430f, 203.930f, 205.430f, 206.930f, 208.430f, 209.930f, 211.430f, 212.930f, 214.430f,
74 215.930f, 217.430f, 218.930f, 220.430f, 221.930f, 223.430f, 224.930f, 226.430f, 227.930f, 229.430f, 230.930f, 232.430f, 233.930f, 235.430f, 236.930f, 238.430f, 239.930f, 241.430f, 242.930f, 244.430f, 245.930f};
75
76GPUconstexpr() uint8_t mNPads[o2::tpc::constants::MAXGLOBALPADROW] = {68, 68, 68, 68, 70, 70, 70, 72, 72, 72, 74, 74, 74, 76, 76, 76, 78, 78, 78, 80, 80, 80, 82, 82, 82, 84, 84, 84, 86, 86, 86, 88, 88, 88, 90, 90, 90, 92, 92, 92,
77 94, 94, 94, 96, 96, 96, 98, 98, 98, 100, 100, 100, 102, 102, 102, 104, 104, 104, 106, 106, 106, 108, 108, 74, 76, 76, 76, 76, 78, 78, 78, 80, 80, 80, 80, 82, 82, 82, 84, 84,
78 84, 86, 86, 86, 86, 88, 88, 88, 90, 90, 90, 90, 92, 92, 92, 94, 94, 94, 96, 96, 96, 96, 98, 98, 98, 100, 100, 100, 100, 102, 102, 102, 104, 104, 104, 106, 106, 106, 106, 108,
79 108, 108, 110, 110, 110, 110, 112, 112, 114, 114, 114, 116, 116, 118, 118, 120, 120, 122, 122, 122, 124, 124, 126, 126, 128, 128, 130, 130, 130, 132, 132, 134, 134, 136, 136, 138, 138, 138, 140};
80
81GPUconstexpr() float mPadHeight[NREGIONS] = {.75f, 1.f, 1.5f};
82GPUconstexpr() float mPadWidth[NREGIONS] = {.4f, .6f, .6f};
83
84constexpr float TPC_LENGTH = 250.f - 0.275f;
85constexpr float FACTOR_T2Z = 250.f / 1024.f; // Used in compression, must remain constant at 250cm, 1024 time bins!
86#endif
87
88GPUconstexpr() 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
95GPUconstexpr() 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
100} // namespace gputpcgeometry_internal
101
103{
104 static constexpr float FACTOR_Z2T = 1.f / gputpcgeometry_internal::FACTOR_T2Z;
105
106 public:
107 static constexpr uint32_t NSECTORS = o2::tpc::constants::MAXSECTOR;
108 static constexpr uint32_t NROWS = o2::tpc::constants::MAXGLOBALPADROW;
109
110#ifndef GPUCA_RUN2
111 GPUd() static constexpr int32_t GetRegion(int32_t row) { return gputpcgeometry_internal::mRegion[row]; }
112 GPUd() static constexpr int32_t GetRegionRows(int32_t region) { return gputpcgeometry_internal::mRegionRows[region]; }
113 GPUd() static constexpr int32_t GetRegionStart(int32_t region) { return gputpcgeometry_internal::mRegionStart[region]; }
114 GPUd() static constexpr int32_t GetSampaMapping(int32_t region) { return gputpcgeometry_internal::mSampaMapping[region]; }
115 GPUd() static constexpr int32_t GetChannelOffset(int32_t region) { return gputpcgeometry_internal::mChannelOffset[region]; }
116 GPUd() static constexpr int32_t GetSectorFECOffset(int32_t partition) { return gputpcgeometry_internal::mSectorFECOffset[partition]; }
117 GPUd() static constexpr int32_t GetROC(int32_t row) { return row < 97 ? (row < 63 ? 0 : 1) : (row < 127 ? 2 : 3); }
118 GPUd() static constexpr int32_t EndIROC() { return 63; }
119 GPUd() static constexpr int32_t EndOROC1() { return 97; }
120 GPUd() static constexpr int32_t EndOROC2() { return 127; }
121 GPUd() static constexpr int32_t MaxNPadsPerRow() { return 138; }
122 GPUd() static constexpr float PadWidth(int32_t row) { return (gputpcgeometry_internal::mPadWidthRow[row]); }
123#else
124 GPUd() static constexpr int32_t GetRegion(int32_t row) { return (row < 63 ? 0 : row < 63 + 64 ? 1 : 2); }
125 GPUd() static constexpr int32_t GetRegionRows(int32_t region) { return 0; } // dummy
126 GPUd() static constexpr int32_t GetRegionStart(int32_t region) { return 0; } // dummy
127 GPUd() static constexpr int32_t GetROC(int32_t row) { return GetRegion(row); }
128 GPUd() static constexpr int32_t EndIROC() { return 63; }
129 GPUd() static constexpr int32_t EndOROC1() { return 63 + 64; }
130 GPUd() static constexpr int32_t EndOROC2() { return GPUTPCGeometry::NROWS; }
131 GPUd() static constexpr int32_t MaxNPadsPerRow() { return 140; }
132 GPUd() static constexpr float PadWidth(int32_t row) { return (gputpcgeometry_internal::mPadWidth[GetRegion(row)]); }
133#endif
134
135 GPUd() static constexpr float Row2X(uint32_t row) { return (gputpcgeometry_internal::mX[row]); }
136 GPUd() static constexpr float NRegions() { return gputpcgeometry_internal::NREGIONS; }
137 GPUd() static constexpr float TPCLength() { return gputpcgeometry_internal::TPC_LENGTH; }
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]; }
145
146 GPUd() static constexpr float LinearPad2Y(uint32_t sector, uint32_t row, float pad)
147 {
148#ifndef GPUCA_RUN2
149 const float u = (pad - 0.5f * (gputpcgeometry_internal::mNPads[row] - 1)) * PadWidth(row);
150#else
151 const float u = (pad - 0.5f * gputpcgeometry_internal::mNPads[row]) * PadWidth(row);
152#endif
153 return (sector >= NSECTORS / 2) ? -u : u;
154 }
155
156 GPUd() static constexpr float LinearTime2Z(uint32_t sector, float time)
157 {
158 const float v = 250.f - time * gputpcgeometry_internal::FACTOR_T2Z; // Used in compression, must remain constant at 250cm!
159 return (sector >= NSECTORS / 2) ? -v : v;
160 }
161
162 GPUd() static constexpr float LinearY2Pad(uint32_t sector, uint32_t row, float y)
163 {
164 const float u = (sector >= NSECTORS / 2) ? -y : y;
165#ifndef GPUCA_RUN2
166 return u / PadWidth(row) + 0.5f * (gputpcgeometry_internal::mNPads[row] - 1);
167#else
168 return u / PadWidth(row) + 0.5f * gputpcgeometry_internal::mNPads[row];
169#endif
170 }
171
172 GPUd() static constexpr float LinearZ2Time(uint32_t sector, float z)
173 {
174 const float v = (sector >= NSECTORS / 2) ? -z : z;
175 return (250.f - v) * FACTOR_Z2T; // Used in compression, must remain constant at 250cm
176 }
177};
178
179} // namespace o2::gpu
180#endif
static constexpr uint32_t NROWS
GPUd() static const expr int32_t GetRegion(int32_t row)
static constexpr uint32_t NSECTORS
GPUd() static const expr float PadWidth(int32_t row)
GPUd() static const expr int32_t GetChannelOffset(int32_t region)
return(sector >=NSECTORS/2) ? -v GPUd() static const expr float LinearY2Pad(uint32_t sector
GPUd() static const expr int32_t GetRegionRows(int32_t region)
GPUd() static const expr float TPCLength()
GPUd() static const expr float SectorAlpha(uint32_t sector)
GPUd() static const expr int32_t GetROC(int32_t row)
GPUd() static const expr float PadWidthByRegion(uint32_t region)
GPUd() static const expr int32_t EndIROC()
GPUd() static const expr int32_t EndOROC1()
GPUd() static const expr int32_t GetSectorFECOffset(int32_t partition)
GPUd() static const expr float PadHeightByRegion(uint32_t region)
GPUd() static const expr float PadHeight(uint32_t row)
GPUd() static const expr uint8_t NPads(uint32_t row)
GPUd() static const expr float LinearPad2Y(uint32_t sector
GPUd() static const expr float NRegions()
GPUd() static const expr float SectorCos(uint32_t sector)
GPUd() static const expr int32_t EndOROC2()
return(sector >=NSECTORS/2) ? -u float time
return u PadWidth(row)+0.5f *(gputpcgeometry_internal float z
return(sector >=NSECTORS/2) ? -v uint32_t float y
GPUd() static const expr int32_t GetRegionStart(int32_t region)
return(sector >=NSECTORS/2) ? -u GPUd() static const expr float LinearTime2Z(uint32_t sector
GPUd() static const expr float Row2X(uint32_t row)
GPUd() static const expr int32_t MaxNPadsPerRow()
return u PadWidth(row)+0.5f *(gputpcgeometry_internal GPUd() static const expr float LinearZ2Time(uint32_t sector
GPUd() static const expr float SectorSin(uint32_t sector)
GPUd() static const expr int32_t GetSampaMapping(int32_t region)
const GLdouble * v
Definition glcorearb.h:832
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
constexpr int MAXSECTOR
Definition Constants.h:28
constexpr int MAXGLOBALPADROW
Definition Constants.h:34
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...