Project
Loading...
Searching...
No Matches
GPUTPCGMPhysicalTrackModel.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 GPUTPCGMPHYSICALTRACKMODEL_H
16#define GPUTPCGMPHYSICALTRACKMODEL_H
17
18#include "GPUTPCGMTrackParam.h"
19
30namespace o2::gpu
31{
33{
34 public:
37
38 GPUd() void Set(const GPUTPCGMTrackParam& t);
39 GPUd() void Set(float X, float Y, float Z, float Px, float Py, float Pz, float Q);
40
41 GPUd() float& X()
42 {
43 return mX;
44 }
45 GPUd() float& Y()
46 {
47 return mY;
48 }
49 GPUd() float& Z()
50 {
51 return mZ;
52 }
53 GPUd() float& Px()
54 {
55 return mPx;
56 }
57 GPUd() float& Py()
58 {
59 return mPy;
60 }
61 GPUd() float& Pz()
62 {
63 return mPz;
64 }
65 GPUd() float& Q()
66 {
67 return mQ;
68 }
69
70 GPUd() float& SinPhi()
71 {
72 return mSinPhi;
73 }
74 GPUd() float& CosPhi()
75 {
76 return mCosPhi;
77 }
78 GPUd() float& SecPhi()
79 {
80 return mSecPhi;
81 }
82 GPUd() float& DzDs()
83 {
84 return mDzDs;
85 }
86 GPUd() float& DlDs()
87 {
88 return mDlDs;
89 }
90 GPUd() float& QPt()
91 {
92 return mQPt;
93 }
94 GPUd() float& P()
95 {
96 return mP;
97 }
98 GPUd() float& Pt()
99 {
100 return mPt;
101 }
102
103 GPUd() const float& SinPhi() const { return mSinPhi; }
104 GPUd() const float& DzDs() const { return mDzDs; }
105
106 GPUd() float GetX() const { return mX; }
107 GPUd() float GetY() const { return mY; }
108 GPUd() float GetZ() const { return mZ; }
109 GPUd() float GetPx() const { return mPx; }
110 GPUd() float GetPy() const { return mPy; }
111 GPUd() float GetPz() const { return mPz; }
112 GPUd() float GetQ() const { return mQ; }
113
114 GPUd() float GetSinPhi() const { return mSinPhi; }
115 GPUd() float GetCosPhi() const { return mCosPhi; }
116 GPUd() float GetSecPhi() const { return mSecPhi; }
117 GPUd() float GetDzDs() const { return mDzDs; }
118 GPUd() float GetDlDs() const { return mDlDs; }
119 GPUd() float GetQPt() const { return mQPt; }
120 GPUd() float GetP() const { return mP; }
121 GPUd() float GetPt() const { return mPt; }
122
123 GPUd() int32_t PropagateToXBzLightNoUpdate(float x, float Bz, float& dLp);
124 GPUd() int32_t PropagateToXBzLight(float x, float Bz, float& dLp);
125
126 GPUd() int32_t PropagateToXBxByBz(float x, float Bx, float By, float Bz, float& dLp);
127
128 GPUd() int32_t PropagateToLpBz(float Lp, float Bz);
129
130 GPUd() bool SetDirectionAlongX();
131
132 GPUd() void UpdateValues();
133
134 GPUd() void Print() const;
135
136 GPUd() float GetMirroredY(float Bz) const;
137
138 GPUd() void Rotate(float alpha);
139 GPUd() void RotateLight(float alpha);
140
141 private:
142 // physical parameters of the trajectory
143
144 float mX = 0.f; // X
145 float mY = 0.f; // Y
146 float mZ = 0.f; // Z
147 float mPx = 1.e4f; // Px, >0
148 float mPy = 0.f; // Py
149 float mPz = 0.f; // Pz
150 float mQ = 1.f; // charge, +-1
151
152 // some additional variables needed for GMTrackParam transport
153
154 float mSinPhi = 0.f; // SinPhi = Py/Pt
155 float mCosPhi = 1.f; // CosPhi = abs(Px)/Pt
156 float mSecPhi = 1.f; // 1/cos(phi) = Pt/abs(Px)
157 float mDzDs = 0.f; // DzDs = Pz/Pt
158 float mDlDs = 0.f; // DlDs = P/Pt
159 float mQPt = 0.f; // QPt = q/Pt
160 float mP = 1.e4f; // momentum
161 float mPt = 1.e4f; // Pt momentum
162};
163
165
167{
168 float pti = CAMath::Abs(t.GetQPt());
169 if (pti < 1.e-4f) {
170 pti = 1.e-4f; // set 10000 GeV momentum for straight track
171 }
172 mQ = (t.GetQPt() >= 0) ? 1.f : -1.f; // only charged tracks are considered
173 mX = t.GetX();
174 mY = t.GetY();
175 mZ = t.GetZ();
176
177 mPt = 1.f / pti;
178 mSinPhi = t.GetSinPhi();
179 if (mSinPhi > GPUCA_MAX_SIN_PHI) {
180 mSinPhi = GPUCA_MAX_SIN_PHI;
181 }
182 if (mSinPhi < -GPUCA_MAX_SIN_PHI) {
183 mSinPhi = -GPUCA_MAX_SIN_PHI;
184 }
185 mCosPhi = CAMath::Sqrt((1.f - mSinPhi) * (1.f + mSinPhi));
186 mSecPhi = 1.f / mCosPhi;
187 mDzDs = t.GetDzDs();
188 mDlDs = CAMath::Sqrt(1.f + mDzDs * mDzDs);
189 mP = mPt * mDlDs;
190
191 mPy = mPt * mSinPhi;
192 mPx = mPt * mCosPhi;
193 mPz = mPt * mDzDs;
194 mQPt = mQ * pti;
195}
196
197GPUdi() void GPUTPCGMPhysicalTrackModel::Set(float X, float Y, float Z, float Px, float Py, float Pz, float Q)
198{
199 mX = X;
200 mY = Y;
201 mZ = Z;
202 mPx = Px;
203 mPy = Py;
204 mPz = Pz;
205 mQ = (Q >= 0) ? 1 : -1;
206 UpdateValues();
207}
208
209GPUdi() void GPUTPCGMPhysicalTrackModel::UpdateValues()
210{
211 float px = mPx;
212 if (CAMath::Abs(px) < 1.e-4f) {
213 px = copysign(1.e-4f, px);
214 }
215
216 mPt = CAMath::Sqrt(px * px + mPy * mPy);
217 float pti = 1.f / mPt;
218 mP = CAMath::Sqrt(px * px + mPy * mPy + mPz * mPz);
219 mSinPhi = mPy * pti;
220 mCosPhi = px * pti;
221 mSecPhi = mPt / px;
222 mDzDs = mPz * pti;
223 mDlDs = mP * pti;
224 mQPt = mQ * pti;
225}
226
227GPUdi() bool GPUTPCGMPhysicalTrackModel::SetDirectionAlongX()
228{
229 //
230 // set direction of movenment collinear to X axis
231 // return value is true when direction has been changed
232 //
233 if (mPx >= 0) {
234 return 0;
235 }
236
237 mPx = -mPx;
238 mPy = -mPy;
239 mPz = -mPz;
240 mQ = -mQ;
241 UpdateValues();
242 return 1;
243}
244
245GPUdi() float GPUTPCGMPhysicalTrackModel::GetMirroredY(float Bz) const
246{
247 // get Y of the point which has the same X, but located on the other side of trajectory
248 if (CAMath::Abs(Bz) < 1.e-8f) {
249 Bz = 1.e-8f;
250 }
251 return mY - 2.f * mQ * mPx / Bz;
252}
253
254GPUdi() void GPUTPCGMPhysicalTrackModel::RotateLight(float alpha)
255{
256 //* Rotate the coordinate system in XY on the angle alpha
257
258 float cA = CAMath::Cos(alpha);
259 float sA = CAMath::Sin(alpha);
260 float x = mX, y = mY, px = mPx, py = mPy;
261 mX = x * cA + y * sA;
262 mY = -x * sA + y * cA;
263 mPx = px * cA + py * sA;
264 mPy = -px * sA + py * cA;
265}
266
268{
269 //* Rotate the coordinate system in XY on the angle alpha
270 RotateLight(alpha);
271 UpdateValues();
272}
273} // namespace o2::gpu
274
275#endif
#define GPUrestrict()
#define GPUCA_MAX_SIN_PHI
GPUdDefault() GPUTPCGMPhysicalTrackModel()=default
float float float float float float Q
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
GLint GLenum GLint x
Definition glcorearb.h:403
GLdouble f
Definition glcorearb.h:310
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GPUdi() o2
Definition TrackTRD.h:38