Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GPUTPCTrackParam.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GPUTPCTrackParam.h
1 // Copyright CERN and copyright holders of ALICE O2. This software is
2 // distributed under the terms of the GNU General Public License v3 (GPL
3 // Version 3), copied verbatim in the file "COPYING".
4 //
5 // See http://alice-o2.web.cern.ch/license for full licensing information.
6 //
7 // In applying this license CERN does not waive the privileges and immunities
8 // granted to it by virtue of its status as an Intergovernmental Organization
9 // or submit itself to any jurisdiction.
10 
13 
14 #ifndef GPUTPCTRACKPARAM_H
15 #define GPUTPCTRACKPARAM_H
16 
17 #include "GPUTPCBaseTrackParam.h"
18 #include <cmath>
19 
29 {
30  public:
32  double bethe, e, theta2, EP2, sigmadE2, k22, k33, k43, k44; // parameters
33  };
34 
35  const GPUTPCBaseTrackParam& GetParam() const { return mParam; }
36  void SetParam(const GPUTPCBaseTrackParam& v) { mParam = v; }
37  void InitParam();
38 
39  double X() const { return mParam.X(); }
40  double Y() const { return mParam.Y(); }
41  double Z() const { return mParam.Z(); }
42  double SinPhi() const { return mParam.SinPhi(); }
43  double DzDs() const { return mParam.DzDs(); }
44  double QPt() const { return mParam.QPt(); }
45  double ZOffset() const { return mParam.ZOffset(); }
46  double SignCosPhi() const { return mSignCosPhi; }
47  double Chi2() const { return mChi2; }
48  int NDF() const { return mNDF; }
49 
50  double Err2Y() const { return mC[0]; }
51  double Err2Z() const { return mC[2]; }
52  double Err2SinPhi() const { return mC[5]; }
53  double Err2DzDs() const { return mC[9]; }
54  double Err2QPt() const { return mC[14]; }
55 
56  double GetX() const { return mParam.GetX(); }
57  double GetY() const { return mParam.GetY(); }
58  double GetZ() const { return mParam.GetZ(); }
59  double GetSinPhi() const { return mParam.GetSinPhi(); }
60  double GetDzDs() const { return mParam.GetDzDs(); }
61  double GetQPt() const { return mParam.GetQPt(); }
62  double GetSignCosPhi() const { return mSignCosPhi; }
63  double GetChi2() const { return mChi2; }
64  int GetNDF() const { return mNDF; }
65 
66  double GetKappa(double Bz) const { return mParam.GetKappa(Bz); }
67  double GetCosPhi() const { return mSignCosPhi * sqrt(1 - SinPhi() * SinPhi()); }
68 
69  double GetErr2Y() const { return mC[0]; }
70  double GetErr2Z() const { return mC[2]; }
71  double GetErr2SinPhi() const { return mC[5]; }
72  double GetErr2DzDs() const { return mC[9]; }
73  double GetErr2QPt() const { return mC[14]; }
74 
75  const double* Par() const { return mParam.Par(); }
76  const double* Cov() const { return mC; }
77 
78  const double* GetPar() const { return mParam.GetPar(); }
79  double GetPar(int i) const { return (mParam.GetPar(i)); }
80  const double* GetCov() const { return mC; }
81  double GetCov(int i) const { return mC[i]; }
82 
83  void SetPar(int i, double v) { mParam.SetPar(i, v); }
84  void SetCov(int i, double v) { mC[i] = v; }
85 
86  void SetX(double v) { mParam.SetX(v); }
87  void SetY(double v) { mParam.SetY(v); }
88  void SetZ(double v) { mParam.SetZ(v); }
89  void SetSinPhi(double v) { mParam.SetSinPhi(v); }
90  void SetDzDs(double v) { mParam.SetDzDs(v); }
91  void SetQPt(double v) { mParam.SetQPt(v); }
92  void SetZOffset(double v) { mParam.SetZOffset(v); }
93  void SetSignCosPhi(double v) { mSignCosPhi = v >= 0 ? 1 : -1; }
94  void SetChi2(double v) { mChi2 = v; }
95  void SetNDF(int v) { mNDF = v; }
96 
97  double GetDist2(const GPUTPCTrackParam& t) const;
98  double GetDistXZ2(const GPUTPCTrackParam& t) const;
99 
100  double GetS(double x, double y, double Bz) const;
101 
102  void GetDCAPoint(double x, double y, double z, double& px, double& py, double& pz, double Bz) const;
103 
104  bool TransportToX(double x, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI);
105  bool TransportToXWithMaterial(double x, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI);
106 
107  bool TransportToX(double x, GPUTPCTrackLinearisation& t0, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI, double* DL = nullptr);
108 
109  bool TransportToX(double x, double sinPhi0, double cosPhi0, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI);
110 
111  bool TransportToXWithMaterial(double x, GPUTPCTrackLinearisation& t0, GPUTPCTrackFitParam& par, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI);
112 
113  bool TransportToXWithMaterial(double x, GPUTPCTrackFitParam& par, double Bz, double maxSinPhi = GPUCA_MAX_SIN_PHI);
114 
115  static double ApproximateBetheBloch(double beta2);
116  static double BetheBlochGeant(double bg, double kp0 = 2.33f, double kp1 = 0.20f, double kp2 = 3.00f, double kp3 = 173e-9f, double kp4 = 0.49848f);
117  static double BetheBlochSolid(double bg);
118  static double BetheBlochGas(double bg);
119 
120  void CalculateFitParameters(GPUTPCTrackFitParam& par, double mass = 0.13957f);
121  bool CorrectForMeanMaterial(double xOverX0, double xTimesRho, const GPUTPCTrackFitParam& par);
122 
123  bool Rotate(double alpha, double maxSinPhi = GPUCA_MAX_SIN_PHI);
124  bool Rotate(double alpha, GPUTPCTrackLinearisation& t0, double maxSinPhi = GPUCA_MAX_SIN_PHI);
125  bool Filter(double y, double z, double err2Y, double err2Z, double maxSinPhi = GPUCA_MAX_SIN_PHI, bool paramOnly = false);
126 
127  bool CheckNumericalQuality() const;
128 
129  void Print() const;
130 
131 #ifndef GPUCA_GPUCODE
132  private:
133 #endif
134  GPUTPCBaseTrackParam
135  mParam; // Track Parameters
136 
137  private:
138  // WARNING, Track Param Data is copied in the GPU Tracklet Constructor element by element instead of using copy constructor!!!
139  // This is neccessary for performance reasons!!!
140  // Changes to Elements of this class therefore must also be applied to TrackletConstructor!!!
141  double mC[15]; // the covariance matrix for Y,Z,SinPhi,..
142  double mSignCosPhi; // sign of cosPhi
143  double mChi2; // the chi^2 value
144  int mNDF; // the Number of Degrees of Freedom
145 };
146 
148 {
149  // Initialize Tracklet Parameters using default values
150  SetSinPhi(0);
151  SetDzDs(0);
152  SetQPt(0);
153  SetSignCosPhi(1);
154  SetChi2(0);
155  SetNDF(-3);
156  SetCov(0, 1);
157  SetCov(1, 0);
158  SetCov(2, 1);
159  SetCov(3, 0);
160  SetCov(4, 0);
161  SetCov(5, 1);
162  SetCov(6, 0);
163  SetCov(7, 0);
164  SetCov(8, 0);
165  SetCov(9, 1);
166  SetCov(10, 0);
167  SetCov(11, 0);
168  SetCov(12, 0);
169  SetCov(13, 0);
170  SetCov(14, 1000.f);
171  SetZOffset(0);
172 }
173 
174 #endif // GPUTPCTRACKPARAM_H