]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCATrackParam.h
coverity 17742 fixed
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCATrackParam.h
1 //-*- Mode: C++ -*-
2 // $Id$
3 // ************************************************************************
4 // This file is property of and copyright by the ALICE HLT Project        *
5 // ALICE Experiment at CERN, All rights reserved.                         *
6 // See cxx source for full Copyright notice                               *
7 //                                                                        *
8 //*************************************************************************
9
10
11 #ifndef ALIHLTTPCCATRACKPARAM_H
12 #define ALIHLTTPCCATRACKPARAM_H
13
14 #include "AliHLTTPCCADef.h"
15 #include "AliHLTTPCCAMath.h"
16 #include "AliHLTTPCCABaseTrackParam.h"
17
18 class AliHLTTPCCATrackLinearisation;
19
20 /**
21  * @class AliHLTTPCCATrackParam
22  *
23  * AliHLTTPCCATrackParam class describes the track parametrisation
24  * which is used by the AliHLTTPCCATracker slice tracker.
25  *
26  */
27 class AliHLTTPCCATrackParam
28 {
29   public:
30
31     struct AliHLTTPCCATrackFitParam {
32       float fBethe, fE, fTheta2, fEP2, fSigmadE2, fK22, fK33, fK43, fK44;// parameters
33     };
34
35         GPUd() const AliHLTTPCCABaseTrackParam& GetParam() const { return fParam; }
36         GPUd() void SetParam(const AliHLTTPCCABaseTrackParam& v) { fParam = v; }
37         GPUd() void InitParam();
38
39     GPUd() float X()      const { return fParam.X();    }
40     GPUd() float Y()      const { return fParam.Y(); }
41     GPUd() float Z()      const { return fParam.Z(); }
42     GPUd() float SinPhi() const { return fParam.SinPhi(); }
43     GPUd() float DzDs()   const { return fParam.DzDs(); }
44     GPUd() float QPt()    const { return fParam.QPt(); }
45     GPUd() float SignCosPhi() const { return fSignCosPhi; }
46     GPUd() float Chi2()  const { return fChi2; }
47     GPUd() int   NDF()   const { return fNDF; }
48
49     GPUd() float Err2Y()      const { return fC[0]; }
50     GPUd() float Err2Z()      const { return fC[2]; }
51     GPUd() float Err2SinPhi() const { return fC[5]; }
52     GPUd() float Err2DzDs()   const { return fC[9]; }
53     GPUd() float Err2QPt()    const { return fC[14]; }
54
55     GPUd() float GetX()      const { return fParam.GetX(); }
56     GPUd() float GetY()      const { return fParam.GetY(); }
57     GPUd() float GetZ()      const { return fParam.GetZ(); }
58     GPUd() float GetSinPhi() const { return fParam.GetSinPhi(); }
59     GPUd() float GetDzDs()   const { return fParam.GetDzDs(); }
60     GPUd() float GetQPt()    const { return fParam.GetQPt(); }
61     GPUd() float GetSignCosPhi() const { return fSignCosPhi; }
62     GPUd() float GetChi2()   const { return fChi2; }
63     GPUd() int   GetNDF()    const { return fNDF; }
64
65     GPUd() float GetKappa( float Bz ) const { return fParam.GetKappa(Bz); }
66     GPUd() float GetCosPhi() const { return fSignCosPhi*CAMath::Sqrt( 1 - SinPhi()*SinPhi() ); }
67
68     GPUd() float GetErr2Y()      const { return fC[0]; }
69     GPUd() float GetErr2Z()      const { return fC[2]; }
70     GPUd() float GetErr2SinPhi() const { return fC[5]; }
71     GPUd() float GetErr2DzDs()   const { return fC[9]; }
72     GPUd() float GetErr2QPt()    const { return fC[14]; }
73
74     GPUhd() const float *Par() const { return fParam.Par(); }
75     GPUhd() const float *Cov() const { return fC; }
76
77     GPUd() const float *GetPar() const { return fParam.GetPar(); }
78         GPUd() float GetPar(int i) const { return(fParam.GetPar(i)); }
79     GPUd() const float *GetCov() const { return fC; }
80         GPUd() float GetCov(int i) const {return fC[i]; }
81
82     GPUhd() void SetPar( int i, float v ) { fParam.SetPar(i, v); }
83     GPUhd() void SetCov( int i, float v ) { fC[i] = v; }
84
85     GPUd() void SetX( float v )     {  fParam.SetX(v);    }
86     GPUd() void SetY( float v )     {  fParam.SetY(v); }
87     GPUd() void SetZ( float v )     {  fParam.SetZ(v); }
88     GPUd() void SetSinPhi( float v ) {  fParam.SetSinPhi(v); }
89     GPUd() void SetDzDs( float v )  {  fParam.SetDzDs(v); }
90     GPUd() void SetQPt( float v )   {  fParam.SetQPt(v); }
91     GPUd() void SetSignCosPhi( float v ) {  fSignCosPhi = v >= 0 ? 1 : -1; }
92     GPUd() void SetChi2( float v )  {  fChi2 = v; }
93     GPUd() void SetNDF( int v )   { fNDF = v; }
94
95     GPUd() float GetDist2( const AliHLTTPCCATrackParam &t ) const;
96     GPUd() float GetDistXZ2( const AliHLTTPCCATrackParam &t ) const;
97
98     GPUd() float GetS( float x, float y, float Bz  ) const;
99
100     GPUd() void GetDCAPoint( float x, float y, float z,
101                              float &px, float &py, float &pz, float Bz  ) const;
102
103     GPUd() bool TransportToX( float x, float Bz, float maxSinPhi = .999 );
104     GPUd() bool TransportToXWithMaterial( float x, float Bz, float maxSinPhi = .999 );
105
106     GPUd() bool  TransportToX( float x, AliHLTTPCCATrackLinearisation &t0,
107                                float Bz,  float maxSinPhi = .999, float *DL = 0 );
108
109     GPUd() bool  TransportToX( float x, float sinPhi0, float cosPhi0,  float Bz, float maxSinPhi = .999 );
110
111
112     GPUd() bool  TransportToXWithMaterial( float x,  AliHLTTPCCATrackLinearisation &t0,
113                                            AliHLTTPCCATrackFitParam &par, float Bz, float maxSinPhi = .999 );
114
115     GPUd() bool  TransportToXWithMaterial( float x,
116                                            AliHLTTPCCATrackFitParam &par, float Bz, float maxSinPhi = .999 );
117
118     GPUd() static float ApproximateBetheBloch( float beta2 );
119     GPUd() static float BetheBlochGeant( float bg,
120                                          float kp0 = 2.33,
121                                          float kp1 = 0.20,
122                                          float kp2 = 3.00,
123                                          float kp3 = 173e-9,
124                                          float kp4 = 0.49848
125                                        );
126     GPUd() static float BetheBlochSolid( float bg );
127     GPUd() static float BetheBlochGas( float bg );
128
129     GPUd() void CalculateFitParameters( AliHLTTPCCATrackFitParam &par, float mass = 0.13957 );
130     GPUd() bool CorrectForMeanMaterial( float xOverX0,  float xTimesRho, const AliHLTTPCCATrackFitParam &par );
131
132     GPUd() bool Rotate( float alpha, float maxSinPhi = .999 );
133     GPUd() bool Rotate( float alpha, AliHLTTPCCATrackLinearisation &t0, float maxSinPhi = .999 );
134     GPUd() bool Filter( float y, float z, float err2Y, float err2Z, float maxSinPhi = .999 );
135
136     GPUd() bool CheckNumericalQuality() const;
137
138     GPUd() void Print() const;
139
140 #ifndef HLTCA_GPUCODE
141   private:
142 #endif //!HLTCA_GPUCODE
143         AliHLTTPCCABaseTrackParam fParam; // Track Parameters
144
145   private:
146         //WARNING, Track Param Data is copied in the GPU Tracklet Constructor element by element instead of using copy constructor!!!
147         //This is neccessary for performance reasons!!!
148         //Changes to Elements of this class therefore must also be applied to TrackletConstructor!!!
149     float fC[15];  // the covariance matrix for Y,Z,SinPhi,..
150     float fSignCosPhi; // sign of cosPhi
151     float fChi2;   // the chi^2 value
152     int   fNDF;    // the Number of Degrees of Freedom
153 };
154
155 GPUd() inline void AliHLTTPCCATrackParam::InitParam()
156 {
157   //Initialize Tracklet Parameters using default values
158   SetSinPhi( 0 );
159   SetDzDs( 0 );
160   SetQPt( 0 );
161   SetSignCosPhi( 1 );
162   SetChi2( 0 );
163   SetNDF( -3 );
164   SetCov( 0, 1 );
165   SetCov( 1, 0 );
166   SetCov( 2, 1 );
167   SetCov( 3, 0 );
168   SetCov( 4, 0 );
169   SetCov( 5, 1 );
170   SetCov( 6, 0 );
171   SetCov( 7, 0 );
172   SetCov( 8, 0 );
173   SetCov( 9, 1 );
174   SetCov( 10, 0 );
175   SetCov( 11, 0 );
176   SetCov( 12, 0 );
177   SetCov( 13, 0 );
178   SetCov( 14, 10. );
179 }
180
181 #endif //ALIHLTTPCCATRACKPARAM_H