Project
Loading...
Searching...
No Matches
GPUTPCGMTrackParam.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 GPUTPCGMTRACKPARAM_H
16#define GPUTPCGMTRACKPARAM_H
17
18#include "GPUTPCDef.h"
20#include "GPUTPCGMMergerTypes.h"
21#include "GPUCommonMath.h"
22#include "GPUdEdxInfo.h"
23
24#ifndef GPUCA_GPUCODE_DEVICE
25#include <cstddef>
26#endif
27
28class AliExternalTrackParam;
29
30namespace o2::gpu
31{
32class GPUTPCGMMerger;
33class GPUTPCGMBorderTrack;
34struct GPUParam;
36class GPUTPCGMPolynomialField;
37class GPUTPCGMMergedTrack;
38class GPUTPCGMPropagator;
39
48{
49 public:
50 GPUd() float& X()
51 {
52 return mX;
53 }
54 GPUd() float& Y()
55 {
56 return mP[0];
57 }
58 GPUd() float& Z()
59 {
60 return mP[1];
61 }
62 GPUd() float& SinPhi()
63 {
64 return mP[2];
65 }
66 GPUd() float& DzDs()
67 {
68 return mP[3];
69 }
70 GPUd() float& QPt()
71 {
72 return mP[4];
73 }
74 GPUd() float& TOffset()
75 {
76 return mTOffset;
77 }
78
79 GPUhd() float GetX() const { return mX; }
80 GPUhd() float GetY() const { return mP[0]; }
81 GPUhd() float GetZ() const { return mP[1]; }
82 GPUd() float GetSinPhi() const { return mP[2]; }
83 GPUd() float GetDzDs() const { return mP[3]; }
84 GPUd() float GetQPt() const { return mP[4]; }
85 GPUd() float GetTOffset() const { return mTOffset; }
86
87 GPUd() float GetKappa(float Bz) const { return -mP[4] * Bz; }
88
89 GPUd() void SetX(float v) { mX = v; }
90
91 GPUd() float* Par()
92 {
93 return mP;
94 }
95 GPUd() const float* GetPar() const { return mP; }
96 GPUd() float GetPar(int32_t i) const { return (mP[i]); }
97 GPUd() void SetPar(int32_t i, float v) { mP[i] = v; }
98
99 GPUd() float& Chi2()
100 {
101 return mChi2;
102 }
103 GPUd() int32_t& NDF()
104 {
105 return mNDF;
106 }
107
108 GPUd() float Err2Y() const { return mC[0]; }
109 GPUd() float Err2Z() const { return mC[2]; }
110 GPUd() float Err2SinPhi() const { return mC[5]; }
111 GPUd() float Err2DzDs() const { return mC[9]; }
112 GPUd() float Err2QPt() const { return mC[14]; }
113
114 GPUd() float GetChi2() const { return mChi2; }
115 GPUd() int32_t GetNDF() const { return mNDF; }
116
117 GPUd() float GetCosPhi() const { return CAMath::Sqrt(float(1.f) - GetSinPhi() * GetSinPhi()); }
118
119 GPUd() float GetErr2Y() const { return mC[0]; }
120 GPUd() float GetErr2Z() const { return mC[2]; }
121 GPUd() float GetErr2SinPhi() const { return mC[5]; }
122 GPUd() float GetErr2DzDs() const { return mC[9]; }
123 GPUd() float GetErr2QPt() const { return mC[14]; }
124
125 GPUd() float* Cov()
126 {
127 return mC;
128 }
129
130 GPUd() const float* GetCov() const { return mC; }
131 GPUd() float GetCov(int32_t i) const { return mC[i]; }
132
133 GPUd() void SetCov(int32_t i, float v) { mC[i] = v; }
134 GPUd() void SetChi2(float v) { mChi2 = v; }
135 GPUd() void SetNDF(int32_t v) { mNDF = v; }
136
137 GPUd() float GetMirroredY(float Bz) const;
138
139 GPUd() void ResetCovariance();
140
141 GPUd() bool CheckNumericalQuality(float overrideCovYY = -1.f) const;
142 GPUd() bool CheckCov() const;
143
144 GPUd() bool Fit(GPUTPCGMMerger* merger, int32_t iTrk, GPUTPCGMMergedTrackHit* clusters, int32_t& N, int32_t& NTolerated, float& Alpha, int32_t attempt, float maxSinPhi, GPUTPCGMMergedTrack& track);
145 GPUd() void MoveToReference(GPUTPCGMPropagator& prop, const GPUParam& param, float& alpha);
146 GPUd() void MirrorTo(GPUTPCGMPropagator& prop, float toY, float toZ, bool inFlyDirection, const GPUParam& param, uint8_t row, uint8_t clusterState, bool mirrorParameters, int8_t sector);
147 GPUd() int32_t MergeDoubleRowClusters(int32_t& ihit, int32_t wayDirection, GPUTPCGMMergedTrackHit* clusters, const GPUTPCGMMerger* merger, GPUTPCGMPropagator& prop, float& xx, float& yy, float& zz, int32_t maxN, float clAlpha, uint8_t& clusterState, bool rejectChi2);
148
149 GPUd() bool AttachClustersPropagate(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t sector, int32_t lastRow, int32_t toRow, int32_t iTrack, bool goodLeg, GPUTPCGMPropagator& prop, bool inFlyDirection, float maxSinPhi = GPUCA_MAX_SIN_PHI, bool checkdEdx = false);
150 GPUd() float AttachClusters(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t sector, int32_t iRow, int32_t iTrack, bool goodLeg, GPUTPCGMPropagator& prop); // Returns uncorrectedY for later use
151 GPUd() float AttachClusters(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t sector, int32_t iRow, int32_t iTrack, bool goodLeg, float Y, float Z);
152 GPUd() void AttachClustersLooper(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t sector, int32_t iRow, int32_t iTrack, bool outwards, GPUTPCGMPropagator& prop);
153 GPUd() void AttachClustersLooperFollow(const GPUTPCGMMerger* GPUrestrict() Merger, GPUTPCGMPropagator& prop, int32_t sector, int32_t iRow, int32_t iTrack, bool outwards);
154 GPUd() void StoreLoopPropagation(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t sector, int32_t iRow, int32_t iTrack, bool outwards, float alpha);
155 GPUd() void StoreOuter(gputpcgmmergertypes::GPUTPCOuterParam* outerParam, float alpha);
156 GPUd() static void PropagateLooper(const GPUTPCGMMerger* GPUrestrict() Merger, int32_t loopIdx);
157
158 GPUd() void AddCovDiagErrors(const float* GPUrestrict() errors2);
159 GPUd() void AddCovDiagErrorsWithCorrelations(const float* GPUrestrict() errors2);
160
161 GPUdi() void MarkClusters(GPUTPCGMMergedTrackHit* GPUrestrict() clusters, int32_t ihitFirst, int32_t ihitLast, int32_t wayDirection, uint8_t state)
162 {
167 }
168 GPUdi() void UnmarkClusters(GPUTPCGMMergedTrackHit* GPUrestrict() clusters, int32_t ihitFirst, int32_t ihitLast, int32_t wayDirection, uint8_t state)
169 {
170 clusters[ihitFirst].state &= ~state;
171 while (ihitFirst != ihitLast) {
172 clusters[ihitFirst += wayDirection].state &= ~state;
173 }
174 }
175 GPUdi() static void NormalizeAlpha(float& alpha)
176 {
177 if (alpha > CAMath::Pi()) {
178 alpha -= CAMath::TwoPi();
179 } else if (alpha <= -CAMath::Pi()) {
180 alpha += CAMath::TwoPi();
181 }
182 }
183
184 GPUd() void Rotate(float alpha);
185 GPUd() float ShiftZ(const GPUTPCGMMerger* merger, int32_t sector, float cltmax, float cltmin, float clx);
186 GPUd() float ShiftZ(const GPUTPCGMMergedTrackHit* clusters, const GPUTPCGMMerger* merger, int32_t N);
187
188 GPUd() static float Reciprocal(float x) { return 1.f / x; }
189 GPUdi() static void Assign(float& x, bool mask, float v)
190 {
191 if (mask) {
192 x = v;
193 }
194 }
195
196 GPUdi() static void Assign(int32_t& x, bool mask, int32_t v)
197 {
198 if (mask) {
199 x = v;
200 }
201 }
202
203 GPUd() static void RefitTrack(GPUTPCGMMergedTrack& track, int32_t iTrk, GPUTPCGMMerger* merger, int32_t attempt);
204
205 GPUdi() void ConstrainSinPhi(float limit = GPUCA_MAX_SIN_PHI)
206 {
207 if (mP[2] > limit) {
208 mP[2] = limit;
209 } else if (mP[2] < -limit) {
210 mP[2] = -limit;
211 }
212 }
213
214 private:
215 GPUd() int32_t initResetT0();
216
217 float mX; // x position
218 float mTOffset; // Z offset with early transform, T offset otherwise
219 float mP[5]; // 'active' track parameters: Y, Z, SinPhi, DzDs, q/Pt
220 float mC[15]; // the covariance matrix for Y,Z,SinPhi,..
221 float mChi2; // the chi^2 value
222 int32_t mNDF; // the Number of Degrees of Freedom
223};
224
227 uint32_t track;
228 float alpha;
229 uint8_t sector;
230 uint8_t row;
231 uint8_t outwards;
232};
233
234GPUdi() int32_t GPUTPCGMTrackParam::initResetT0()
235{
236 const float absQPt = CAMath::Abs(mP[4]);
237 if (absQPt < (150.f / 40.f)) {
238 return 150.f / 40.f;
239 }
240 return CAMath::Max(10.f, 150.f / mP[4]);
241}
242
243GPUdi() void GPUTPCGMTrackParam::ResetCovariance()
244{
245 mC[0] = 100.f;
246 mC[1] = 0.f;
247 mC[2] = 100.f;
248 mC[3] = 0.f;
249 mC[4] = 0.f;
250 mC[5] = 1.f;
251 mC[6] = 0.f;
252 mC[7] = 0.f;
253 mC[8] = 0.f;
254 mC[9] = 10.f;
255 mC[10] = 0.f;
256 mC[11] = 0.f;
257 mC[12] = 0.f;
258 mC[13] = 0.f;
259 mC[14] = 10.f;
260 mChi2 = 0;
261 mNDF = -5;
262}
263
264GPUdi() float GPUTPCGMTrackParam::GetMirroredY(float Bz) const
265{
266 // get Y of the point which has the same X, but located on the other side of trajectory
267 float qptBz = GetQPt() * Bz;
268 float cosPhi2 = 1.f - GetSinPhi() * GetSinPhi();
269 if (CAMath::Abs(qptBz) < 1.e-8f) {
270 qptBz = 1.e-8f;
271 }
272 if (cosPhi2 < 0.f) {
273 cosPhi2 = 0.f;
274 }
275 return GetY() - 2.f * CAMath::Sqrt(cosPhi2) / qptBz;
276}
277} // namespace o2::gpu
278
279#endif
int32_t i
#define GPUrestrict()
#define GPUCA_MAX_SIN_PHI
GPUdi() void UnmarkClusters(GPUTPCGMMergedTrackHit *GPUrestrict() clusters
int32_t GPUTPCGMMergedTrackHit int32_t int32_t & NTolerated
GPUd() void Rotate(float alpha)
GPUd() void SetCov(int32_t i
GPUd() float GetPar(int32_t i) const
GPUd() float GetKappa(float Bz) const
GPUd() void StoreOuter(gputpcgmmergertypes int32_t loopIdx
GPUd() float GetErr2Y() const
GPUd() float GetErr2QPt() const
GPUd() float GetQPt() const
GPUd() void SetPar(int32_t i
GPUd() void SetNDF(int32_t v)
GPUd() float GetErr2Z() const
int32_t int32_t int32_t toRow
int32_t GPUTPCGMMergedTrackHit const GPUTPCGMMerger GPUTPCGMPropagator float float & yy
int32_t int32_t int32_t int32_t bool goodLeg
float float bool const GPUParam uint8_t uint8_t bool mirrorParameters
int32_t GPUTPCGMMergedTrackHit const GPUTPCGMMerger GPUTPCGMPropagator float float float int32_t maxN
int32_t GPUTPCGMMergedTrackHit int32_t int32_t float & Alpha
GPUd() float Err2SinPhi() const
int32_t GPUTPCGMMergedTrackHit int32_t int32_t float int32_t float GPUTPCGMMergedTrack & track
GPUd() void SetChi2(float v)
int32_t GPUTPCGMMergedTrackHit const GPUTPCGMMerger GPUTPCGMPropagator float float float & zz
int32_t GPUTPCGMMergedTrackHit const GPUTPCGMMerger GPUTPCGMPropagator & prop
GPUd() float GetChi2() const
GPUd() int32_t GetNDF() const
float float bool const GPUParam uint8_t row
GPUd() float GetTOffset() const
float float bool const GPUParam uint8_t uint8_t bool int8_t sector
float float bool const GPUParam uint8_t uint8_t clusterState
GPUd() float GetErr2SinPhi() const
GPUd() float GetMirroredY(float Bz) const
GPUd() const float *GetPar() const
int32_t GPUTPCGMMergedTrackHit * clusters
GPUd() float GetCov(int32_t i) const
GPUdi() static void NormalizeAlpha(float &alpha)
int32_t int32_t int32_t bool float float Z
int32_t GPUTPCGMMergedTrackHit const GPUTPCGMMerger * merger
int32_t GPUTPCGMMergedTrackHit const GPUTPCGMMerger GPUTPCGMPropagator float & xx
GPUd() float GetDzDs() const
int32_t int32_t int32_t uint8_t state
int32_t GPUTPCGMMergedTrackHit int32_t int32_t float int32_t attempt
int32_t int32_t int32_t bool float Y
GPUd() float Err2DzDs() const
int32_t GPUTPCGMMergedTrackHit const GPUTPCGMMerger GPUTPCGMPropagator float float float int32_t float uint8_t bool rejectChi2
int32_t GPUTPCGMMergedTrackHit int32_t & N
GPUd() float GetSinPhi() const
GPUd() float GetErr2DzDs() const
GPUdi() void MarkClusters(GPUTPCGMMergedTrackHit *GPUrestrict() clusters
int32_t GPUTPCGMMergedTrackHit const GPUTPCGMMerger GPUTPCGMPropagator float float float int32_t float clAlpha
int32_t int32_t int32_t int32_t iTrack
GPUd() const float *GetCov() const
GPUd() float Err2QPt() const
int32_t int32_t int32_t bool outwards
int32_t GPUTPCGMMergedTrackHit int32_t int32_t float int32_t float maxSinPhi
int32_t float float float clx
GPUdi() static void Assign(float &x
GPUd() float GetCosPhi() const
int32_t int32_t int32_t int32_t bool GPUTPCGMPropagator bool float bool checkdEdx
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
GLint GLenum GLint x
Definition glcorearb.h:403
const GLdouble * v
Definition glcorearb.h:832
GLdouble f
Definition glcorearb.h:310
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLenum GLfloat param
Definition glcorearb.h:271
GLint GLuint mask
Definition glcorearb.h:291