Project
Loading...
Searching...
No Matches
GPUTPCGMPropagator.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 GPUTPCGMPROPAGATOR_H
16#define GPUTPCGMPROPAGATOR_H
17
18#include "GPUCommonDef.h"
21#include "GPUCommonMath.h"
22
23namespace o2::base
24{
25struct MatBudget;
26class MatLayerCylSet;
27} // namespace o2::base
28
29namespace o2::gpu
30{
31class GPUTPCGMTrackParam;
32struct GPUParam;
33namespace gputpcgmmergertypes
34{
35struct InterpolationErrorHit;
36}
37
44{
45 public:
48 TPC = 0,
49 ITS = 1,
50 TRD = 2
51 };
65
67
69 GPUhd() MaterialCorrection() : radLen(28811.7f), rho(1.025e-3f), radLenInv(1.f / radLen), DLMax(0.f), EP2(0.f), sigmadE2(0.f), k22(0.f), k33(0.f), k43(0.f), k44(0.f) {}
70 float radLen; // [cm]
71 float rho; // [g/cm^3]
72 float radLenInv, DLMax, EP2, sigmadE2, k22, k33, k43, k44; // precalculated values for MS and EnergyLoss correction
73 };
74
76 int32_t retVal = -100;
77 float err2Y = -1e6f, err2Z = -1e6f;
78 };
79
80 GPUd() void SetMaterial(float radLen, float rho);
81 GPUd() void SetMaterialTPC() { SetMaterial(28811.7f, 1.025e-3f); }
82
84 GPUd() o2::base::MatBudget getMatBudget(const float* p1, const float* p2);
85
86 GPUd() void SetPolynomialField(const GPUTPCGMPolynomialField* field) { mField = field; }
87
88 GPUd() void SelectFieldRegion(FieldRegion region) { mFieldRegion = region; }
89
90 GPUd() void SetFitInProjections(bool Flag) { mFitInProjections = Flag; }
91 GPUd() void SetPropagateBzOnly(bool Flag) { mPropagateBzOnly = Flag; }
92 GPUd() void SetSeedingErrors(bool Flag) { mSeedingErrors = Flag; }
93 GPUd() void SetMatLUT(const o2::base::MatLayerCylSet* lut) { mMatLUT = lut; }
94
95 GPUd() void SetMaxSinPhi(float maxSinPhi) { mMaxSinPhi = maxSinPhi; }
96
97 GPUd() void SetTrack(GPUTPCGMTrackParam* track, float Alpha);
98 GPUd() void ResetT0()
99 {
100 if (!mT) {
101 return;
102 }
103 mT0.Set(*mT);
104 }
105
106 GPUd() int32_t RotateToAlpha(float newAlpha);
107
108 GPUd() int32_t PropagateToXAlpha(float posX, float posAlpha, bool inFlyDirection);
109
110 GPUd() int32_t PropagateToXAlphaBz(float posX, float posAlpha, bool inFlyDirection);
111
112 GPUd() int32_t Update(float posY, float posZ, int32_t iRow, const GPUParam& param, int16_t clusterState, int8_t rejectChi2, gputpcgmmergertypes::InterpolationErrorHit* inter, bool refit, int8_t sideC, float time, float avgInvCharge, float invCharge GPUCA_DEBUG_STREAMER_CHECK(, DebugStreamerVals* debugVals = nullptr));
113 GPUd() int32_t Update(float posY, float posZ, int16_t clusterState, bool rejectChi2, float err2Y, float err2Z, const GPUParam* param = nullptr);
114 GPUd() int32_t InterpolateReject(const GPUParam& param, float posY, float posZ, int16_t clusterState, int8_t rejectChi2, gputpcgmmergertypes::InterpolationErrorHit* inter, float err2Y, float err2Z);
115 GPUd() float PredictChi2(float posY, float posZ, int32_t iRow, const GPUParam& param, int16_t clusterState, int8_t sideC, float time, float avgCharge, float charge) const;
116 GPUd() float PredictChi2(float posY, float posZ, float err2Y, float err2Z) const;
117 GPUd() int32_t RejectCluster(float chiY, float chiZ, uint8_t clusterState)
118 {
119 if (chiY > 9.f || chiZ > 9.f) { // TODO: Check how a track can have chi2/ncl > 18
120 return 2;
121 }
123 return 2;
124 }
126 return 2;
127 }
128 return 0;
129 }
130
132 GPUd() float GetBz(float X, float Y, float Z) const;
134 GPUd() void GetBxByBz(float X, float Y, float Z, float B[3]) const;
135
137 GPUd() float GetBz(float Alpha, float X, float Y, float Z) const;
139 GPUd() void GetBxByBz(float Alpha, float X, float Y, float Z, float B[3]) const;
140
141 GPUd() void GetErr2(float& err2Y, float& err2Z, const GPUParam& param, float posZ, int32_t iRow, int16_t clusterState, int8_t sector, float time, float avgCharge, float charge) const;
142 GPUd() static void GetErr2(float& err2Y, float& err2Z, const GPUParam& param, float snp, float tgl, float posZ, float trackX, float trackY, int32_t iRow, int16_t clusterState, int8_t sector, float time, float avgCharge, float charge, bool seedingErrors);
143
144 GPUd() float GetAlpha() const { return mAlpha; }
145 GPUd() void SetAlpha(float v) { mAlpha = v; }
146 GPUd() float GetQPt0() const { return mT0.GetQPt(); }
147 GPUd() float GetSinPhi0() const { return mT0.GetSinPhi(); }
148 GPUd() float GetCosPhi0() const { return mT0.GetCosPhi(); }
149 GPUd() void Mirror(bool inFlyDirection);
150 GPUd() void Rotate180();
151 GPUd() void ChangeDirection();
152 GPUd() float GetMirroredYModel() const;
153 GPUd() float GetMirroredYTrack() const;
154 GPUd() int32_t GetPropagatedYZ(float x, float& projY, float& projZ);
155 GPUd() bool GetFitInProjections() const { return mFitInProjections; }
156
158 {
159 return mT0;
160 }
161 GPUd() void CalculateMaterialCorrection();
162
163 private:
164 GPUd() static float ApproximateBetheBloch(float beta2);
165 GPUd() int32_t FollowLinearization(const GPUTPCGMPhysicalTrackModel& t0e, float Bz, float dLp, bool inFlyDirection);
166
168 GPUd() float GetBzBase(float cosAlpha, float sinAlpha, float X, float Y, float Z) const;
170 GPUd() void GetBxByBzBase(float cosAlpha, float sinAlpha, float X, float Y, float Z, float B[3]) const;
171 // X in global coordinates
172 GPUd() float getGlobalX(float cosAlpha, float sinAlpha, float X, float Y) const;
173 // Y in global coordinates
174 GPUd() float getGlobalY(float cosAlpha, float sinAlpha, float X, float Y) const;
175 // X in global coordinates
176 GPUd() float getGlobalX(float X, float Y) const;
177 // Y in global coordinates
178 GPUd() float getGlobalY(float X, float Y) const;
179
180 const GPUTPCGMPolynomialField* mField = nullptr;
181 const o2::base::MatLayerCylSet* mMatLUT = nullptr;
182 GPUTPCGMTrackParam* mT = nullptr;
183 float mAlpha = 0.f; // rotation angle of the track coordinate system
184 float mCosAlpha = 1.f; // cos of the rotation angle
185 float mSinAlpha = 0.f; // sin of the rotation angle
186 float mMaxSinPhi = GPUCA_MAX_SIN_PHI;
188 MaterialCorrection mMaterial;
189 FieldRegion mFieldRegion = TPC;
190 bool mSeedingErrors = 0; // TODO: Hide variable in Run3 mode
191 bool mFitInProjections = 1; // fit (Y,SinPhi,QPt) and (Z,DzDs) paramteres separatelly
192 bool mPropagateBzOnly = 0; // Use Bz only in propagation
193};
194
195GPUdi() void GPUTPCGMPropagator::GetBxByBz(float Alpha, float X, float Y, float Z, float B[3]) const
196{
197 float c, s;
198 CAMath::SinCos(Alpha, s, c);
199 GetBxByBzBase(c, s, X, Y, Z, B);
200}
201
202GPUdi() float GPUTPCGMPropagator::GetBz(float Alpha, float X, float Y, float Z) const
203{
204 float c, s;
205 CAMath::SinCos(Alpha, s, c);
206 return GetBzBase(c, s, X, Y, Z);
207}
208
209GPUdi() void GPUTPCGMPropagator::GetBxByBz(float X, float Y, float Z, float B[3]) const
210{
211 GetBxByBzBase(mCosAlpha, mSinAlpha, X, Y, Z, B);
212}
213
214GPUdi() float GPUTPCGMPropagator::GetBz(float X, float Y, float Z) const
215{
216 return GetBzBase(mCosAlpha, mSinAlpha, X, Y, Z);
217}
218
219GPUdi() void GPUTPCGMPropagator::SetMaterial(float radLen, float rho)
220{
221 mMaterial.rho = rho;
222 mMaterial.radLen = radLen;
223 mMaterial.radLenInv = (radLen > 1.e-4f) ? 1.f / radLen : 0.f;
224 CalculateMaterialCorrection();
225}
226
227GPUdi() void GPUTPCGMPropagator::SetTrack(GPUTPCGMTrackParam* GPUrestrict() track, float Alpha)
228{
229 mT = track;
230 if (!mT) {
231 return;
232 }
233 mT0.Set(*mT);
234 mAlpha = Alpha;
235 CAMath::SinCos(mAlpha, mSinAlpha, mCosAlpha);
236 CalculateMaterialCorrection();
237}
238
239GPUdi() float GPUTPCGMPropagator::GetMirroredYModel() const
240{
241 float Bz = GetBz(mT0.GetX(), mT0.GetY(), mT0.GetZ());
242 return mT0.GetMirroredY(Bz);
243}
244
245GPUdi() float GPUTPCGMPropagator::GetMirroredYTrack() const
246{
247 if (!mT) {
248 return -1.E10f;
249 }
250 float Bz = GetBz(mT->GetX(), mT->GetY(), mT->GetZ());
251 return mT->GetMirroredY(Bz);
252}
253
254GPUdi() float GPUTPCGMPropagator::getGlobalX(float cosAlpha, float sinAlpha, float X, float Y) const
255{
256 return X * cosAlpha - Y * sinAlpha;
257}
258
259GPUdi() float GPUTPCGMPropagator::getGlobalY(float cosAlpha, float sinAlpha, float X, float Y) const
260{
261 return X * sinAlpha + Y * cosAlpha;
262}
263
264GPUdi() float GPUTPCGMPropagator::getGlobalX(float X, float Y) const
265{
266 return getGlobalX(mCosAlpha, mSinAlpha, X, Y);
267}
268
269GPUdi() float GPUTPCGMPropagator::getGlobalY(float X, float Y) const
270{
271 return getGlobalY(mCosAlpha, mSinAlpha, X, Y);
272}
273
274} // namespace o2::gpu
275
276#endif
#define GPUrestrict()
#define GPUCA_DEBUG_STREAMER_CHECK(...)
#define GPUCA_MAX_SIN_PHI
constexpr int p2()
constexpr int p1()
constexpr to accelerate the coordinates changing
uint32_t c
Definition RawData.h:2
Definition B.h:16
GPUd() float GetSinPhi0() const
GPUdDefault() GPUTPCGMPropagator()=default
float int32_t const GPUParam int16_t int8_t gputpcgmmergertypes::InterpolationErrorHit bool int8_t sideC
float int32_t const GPUParam int16_t clusterState
GPUd() void UpdateMaterial(const GPUTPCGMPhysicalTrackModel &GPUrestrict() t0e)
GPUd() void SetAlpha(float v)
float const GPUParam float float tgl
float int32_t const GPUParam int16_t int8_t rejectChi2
float const GPUParam float snp
float const GPUParam float float float float float trackY
GPUd() GPUTPCGMPhysicalTrackModel &Model()
GPUd() void SelectFieldRegion(FieldRegion region)
float const GPUParam float float float float trackX
float int16_t bool float float err2Z
GPUd() void SetPropagateBzOnly(bool Flag)
GPUd() float GetCosPhi0() const
FieldRegion
Enumeration of field regions.
@ TRD
outer TPC -> outer TRD
float int32_t const GPUParam int16_t int8_t gputpcgmmergertypes::InterpolationErrorHit bool int8_t float float avgInvCharge
float int32_t const GPUParam int16_t int8_t float float avgCharge
float const GPUParam float int32_t int16_t int8_t sector
float int32_t const GPUParam int16_t int8_t gputpcgmmergertypes::InterpolationErrorHit bool refit
GPUd() void SetMaterial(float radLen
GPUd() void Mirror(bool inFlyDirection)
float int32_t const GPUParam int16_t int8_t gputpcgmmergertypes::InterpolationErrorHit * inter
GPUd() void SetSeedingErrors(bool Flag)
GPUd() int32_t RotateToAlpha(float new Alpha)
float const GPUParam float float float float float int32_t int16_t int8_t float float float bool seedingErrors
GPUd() float GetQPt0() const
float const GPUParam float float float float float int32_t int16_t int8_t float float float charge
GPUd() void SetMatLUT(const o2
float int16_t bool float err2Y
float int32_t const GPUParam int16_t int8_t float float float charge const
GPUd() void SetFitInProjections(bool Flag)
GPUd() void CalculateMaterialCorrection()
GPUd() void SetMaxSinPhi(float maxSinPhi)
float int32_t const GPUParam int16_t int8_t gputpcgmmergertypes::InterpolationErrorHit bool int8_t float time
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
GPUdi() o2
Definition TrackTRD.h:38
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...