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