Project
Loading...
Searching...
No Matches
GPUTPCCompressionTrackModel.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 GPUTPCCOMPRESSIONTRACKMODEL_H
16#define GPUTPCCOMPRESSIONTRACKMODEL_H
17
18// For debugging purposes, we provide means to use other track models
19// #define GPUCA_COMPRESSION_TRACK_MODEL_MERGER
20// #define GPUCA_COMPRESSION_TRACK_MODEL_SECTORTRACKER
21
22#include "GPUDef.h"
23
24#ifdef GPUCA_COMPRESSION_TRACK_MODEL_MERGER
25#include "GPUTPCGMPropagator.h"
26#include "GPUTPCGMTrackParam.h"
27
28#elif defined(GPUCA_COMPRESSION_TRACK_MODEL_SECTORTRACKER)
29#include "GPUTPCTrackParam.h"
30
31#else // Default internal track model for compression
32#endif
33
34namespace o2::gpu
35{
36// ATTENTION! This track model is used for the data compression.
37// Changes to the propagation and fit will prevent the decompression of data
38// encoded with the old version!!!
39
40struct GPUParam;
41
42constexpr float MaxSinPhi = 0.999f;
43
45{
46 public:
47 GPUd() void Init(float x, float y, float z, float alpha, uint8_t qPt, const GPUParam& proc);
48 GPUd() int32_t Propagate(float x, float alpha);
49 GPUd() int32_t Filter(float y, float z, int32_t iRow);
50 GPUd() int32_t Mirror();
51
52#if defined(GPUCA_COMPRESSION_TRACK_MODEL_MERGER) || defined(GPUCA_COMPRESSION_TRACK_MODEL_SECTORTRACKER)
53 GPUd() float X() const
54 {
55 return mTrk.GetX();
56 }
57 GPUd() float Y() const { return mTrk.GetY(); }
58 GPUd() float Z() const { return mTrk.GetZ(); }
59 GPUd() float SinPhi() const { return mTrk.GetSinPhi(); }
60 GPUd() float DzDs() const { return mTrk.GetDzDs(); }
61 GPUd() float QPt() const { return mTrk.GetQPt(); }
62
63#else // Default internal track model for compression
64
65 struct PhysicalTrackModel { // see GPUTPCGMPhysicalTrackModel
66 // physical parameters of the trajectory
67
68 float x = 0.f; // X
69 float y = 0.f; // Y
70 float z = 0.f; // Z
71 float px = 1.e4f; // Px, >0
72 float py = 0.f; // Py
73 float pz = 0.f; // Pz
74 float q = 1.f; // charge, +-1
75
76 // some additional variables needed for GMTrackParam transport
77
78 float sinphi = 0.f; // SinPhi = Py/Pt
79 float cosphi = 1.f; // CosPhi = abs(Px)/Pt
80 float secphi = 1.f; // 1/cos(phi) = Pt/abs(Px)
81 float dzds = 0.f; // DzDs = Pz/Pt
82 float dlds = 1.f; // DlDs = P/Pt
83 float qpt = 0.f; // QPt = q/Pt
84 float p = 1.e4f; // momentum
85 float pt = 1.e4f; // Pt momentum
86 };
87
88 GPUd() float Y() const { return mP[0]; }
89 GPUd() float Z() const { return mP[1]; }
90
91 // helper functions for standalone propagation and update methods
92 GPUd() void updatePhysicalTrackValues(PhysicalTrackModel& trk);
93 GPUd() void changeDirection();
94 GPUd() int32_t rotateToAlpha(float newAlpha);
95 GPUd() int32_t propagateToXBzLightNoUpdate(PhysicalTrackModel& t, float x, float Bz, float& dLp);
96 GPUd() bool setDirectionAlongX(PhysicalTrackModel& t);
97 GPUd() int32_t followLinearization(const PhysicalTrackModel& t0e, float Bz, float dLp);
98 GPUd() void calculateMaterialCorrection();
99 GPUd() float approximateBetheBloch(float beta2);
100 GPUd() void getClusterErrors2(int32_t iRow, float z, float sinPhi, float DzDs, float& ErrY2, float& ErrZ2) const;
101 GPUd() void resetCovariance();
102
103 GPUd() float LinearPad2Y(int32_t sector, float pad, float padWidth, uint8_t npads) const
104 {
105 const float u = (pad - 0.5f * npads) * padWidth;
106 return (sector >= GPUCA_NSECTORS / 2) ? -u : u;
107 }
108
109 GPUd() float LinearY2Pad(int32_t sector, float y, float padWidth, uint8_t npads) const
110 {
111 const float u = (sector >= GPUCA_NSECTORS / 2) ? -y : y;
112 return u / padWidth + 0.5f * npads;
113 }
114
115#endif
116
117 protected:
118#ifdef GPUCA_COMPRESSION_TRACK_MODEL_MERGER
119 GPUTPCGMPropagator mProp;
121 const GPUParam* mParam;
122
123#elif defined(GPUCA_COMPRESSION_TRACK_MODEL_SECTORTRACKER)
125 float mAlpha;
126 const GPUParam* mParam;
127
128#else // Default internal track model for compression
129
131 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) {}
132
133 float radLen; // [cm]
134 float rho; // [g/cm^3]
135 float radLenInv, DLMax, EP2, sigmadE2, k22, k33, k43, k44; // precalculated values for MS and EnergyLoss correction
136 };
137
138 // default TPC cluster error parameterization taken from GPUParam.cxx
139 // clang-format off
140 const float mParamErrors0[2][3][4] =
141 {
142 { { 4.17516864836e-02, 1.87623649254e-04, 5.63788712025e-02, 5.38373768330e-01, },
143 { 8.29434990883e-02, 2.03291710932e-04, 6.81538805366e-02, 9.70965325832e-01, },
144 { 8.67543518543e-02, 2.10733342101e-04, 1.38366967440e-01, 2.55089461803e-01, }
145 }, {
146 { 5.96254616976e-02, 8.62886518007e-05, 3.61776389182e-02, 4.79704320431e-01, },
147 { 6.12571723759e-02, 7.23929333617e-05, 3.93057651818e-02, 9.29222583771e-01, },
148 { 6.58465921879e-02, 1.03639606095e-04, 6.07583411038e-02, 9.90289509296e-01, } }
149 };
150 // clang-format on
151
152 float mX;
153 float mAlpha;
154 float mP[5];
155 float mC[15];
156 int32_t mNDF = -5;
159
160 // propagation parameters
161 float mBz;
163
165#endif
166};
167} // namespace o2::gpu
168
169#endif
#define GPUCA_NSECTORS
float float float float float &ErrZ2 const
float float float uint8_t const GPUParam & proc
GPUd() void updatePhysicalTrackValues(PhysicalTrackModel &trk)
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)
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
constexpr float MaxSinPhi