]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliExternalTrackParam.h
Check the status of the command pipe, it might be 0x0 if the process cannot allocate...
[u/mrichter/AliRoot.git] / STEER / AliExternalTrackParam.h
1 #ifndef ALIEXTERNALTRACKPARAM_H
2 #define ALIEXTERNALTRACKPARAM_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 /*****************************************************************************
9  *              "External" track parametrisation class                       *
10  *                                                                           *
11  *      external param0:   local Y-coordinate of a track (cm)                *
12  *      external param1:   local Z-coordinate of a track (cm)                *
13  *      external param2:   local sine of the track momentum azimuthal angle  *
14  *      external param3:   tangent of the track momentum dip angle           *
15  *      external param4:   1/pt (1/(GeV/c))                                  *
16  *                                                                           *
17  * The parameters are estimated at an exact position x in a local coord.     *
18  * system rotated by angle alpha with respect to the global coord.system.    *
19  *        Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch                     *
20  *****************************************************************************/
21 #include "TMath.h"
22
23 #include "AliVTrack.h"
24
25 const Double_t kVeryBig=1./kAlmost0;
26 const Double_t kMostProbablePt=0.35;
27
28 Double_t ApproximateBetheBloch(Double_t);
29
30 class AliVVertex;
31 class TPolyMarker3D; 
32
33 class AliExternalTrackParam: public AliVTrack {
34  public:
35   AliExternalTrackParam();
36   AliExternalTrackParam(const AliExternalTrackParam &);
37   AliExternalTrackParam& operator=(const AliExternalTrackParam & trkPar);
38   AliExternalTrackParam(Double_t x, Double_t alpha, 
39                         const Double_t param[5], const Double_t covar[15]);
40   AliExternalTrackParam(const AliVTrack *vTrack);
41   AliExternalTrackParam(Double_t xyz[3],Double_t pxpypz[3],
42                         Double_t cv[21],Short_t sign);
43   virtual ~AliExternalTrackParam(){}
44
45   void Set(Double_t x,Double_t alpha,
46                         const Double_t param[5], const Double_t covar[15]);
47   void Set(Double_t xyz[3],Double_t pxpypz[3],Double_t cv[21],Short_t sign);
48
49   static void SetMostProbablePt(Double_t pt) { fgMostProbablePt=pt; }
50   static Double_t GetMostProbablePt() { return fgMostProbablePt; }
51
52   void Reset();
53   void ResetCovariance(Double_t s2);
54   void AddCovariance(const Double_t cov[15]);
55
56   const Double_t *GetParameter() const {return fP;}
57   const Double_t *GetCovariance() const {return fC;}
58
59   Double_t GetAlpha() const {return fAlpha;}
60   Double_t GetX() const {return fX;}
61   Double_t GetY()    const {return fP[0];}
62   Double_t GetZ()    const {return fP[1];}
63   Double_t GetSnp()  const {return fP[2];}
64   Double_t GetTgl()  const {return fP[3];}
65   Double_t GetSigned1Pt()  const {return fP[4];}
66
67   Double_t GetSigmaY2() const {return fC[0];}
68   Double_t GetSigmaZY() const {return fC[1];}
69   Double_t GetSigmaZ2() const {return fC[2];}
70   Double_t GetSigmaSnpY() const {return fC[3];}
71   Double_t GetSigmaSnpZ() const {return fC[4];}
72   Double_t GetSigmaSnp2() const {return fC[5];}
73   Double_t GetSigmaTglY() const {return fC[6];}
74   Double_t GetSigmaTglZ() const {return fC[7];}
75   Double_t GetSigmaTglSnp() const {return fC[8];}
76   Double_t GetSigmaTgl2() const {return fC[9];}
77   Double_t GetSigma1PtY() const {return fC[10];}
78   Double_t GetSigma1PtZ() const {return fC[11];}
79   Double_t GetSigma1PtSnp() const {return fC[12];}
80   Double_t GetSigma1PtTgl() const {return fC[13];}
81   Double_t GetSigma1Pt2() const {return fC[14];}
82
83   // additional functions for AliVParticle
84   Double_t Px() const;
85   Double_t Py() const;
86   Double_t Pz() const;
87   Double_t Pt() const { return TMath::Abs(GetSignedPt()); }
88   Double_t P() const { return GetP(); }
89   Bool_t   PxPyPz(Double_t p[3]) const { return GetPxPyPz(p); }
90   
91   Double_t Xv() const;
92   Double_t Yv() const;
93   Double_t Zv() const;
94   Bool_t   XvYvZv(Double_t x[3]) const { return GetXYZ(x); }
95
96   Double_t OneOverPt() const { return 1./Pt(); }
97   Double_t Phi() const;
98   Double_t Theta() const;
99   virtual Double_t E() const;
100   virtual Double_t M() const;
101   Double_t Eta() const;
102   virtual Double_t Y() const;
103   Short_t  Charge() const { return (Short_t)GetSign(); }
104   virtual const Double_t *PID() const { return 0x0; }
105
106   // additional functions from AliVTrack
107   virtual Int_t    GetID() const { return -999; }
108   virtual UChar_t  GetITSClusterMap() const {return 0; }
109   virtual ULong_t  GetStatus() const { return 0; }
110
111   Double_t GetSign() const {return (fP[4]>0) ? 1 : -1;}
112   Double_t GetP() const;
113   Double_t GetSignedPt() const {
114     return (TMath::Abs(fP[4])>kAlmost0) ? 1./fP[4]:TMath::Sign(kVeryBig,fP[4]);
115   }
116   Double_t Get1P() const;
117   Double_t GetC(Double_t b) const {return fP[4]*b*kB2C;}
118   void GetDZ(Double_t x,Double_t y,Double_t z,Double_t b,Float_t dz[2]) const; 
119   Double_t GetD(Double_t xv, Double_t yv, Double_t b) const; 
120   Double_t GetLinearD(Double_t xv, Double_t yv) const; 
121   Bool_t CorrectForMeanMaterial(Double_t xOverX0, Double_t xTimesRho, 
122         Double_t mass,  Bool_t anglecorr=kFALSE,
123         Double_t (*f)(Double_t)=ApproximateBetheBloch);
124   Double_t GetPredictedChi2(Double_t p[2],Double_t cov[3]) const;
125
126   Double_t 
127     GetPredictedChi2(Double_t p[3],Double_t covyz[3],Double_t covxyz[3]) const;
128   Bool_t 
129     PropagateTo(Double_t p[3],Double_t covyz[3],Double_t covxyz[3],Double_t b);
130
131   Double_t *GetResiduals(Double_t *p,Double_t *cov,Bool_t updated=kTRUE) const;
132   Bool_t Update(Double_t p[2],Double_t cov[3]);
133   Bool_t Rotate(Double_t alpha);
134   Bool_t PropagateTo(Double_t x, Double_t b);
135   Bool_t Propagate(Double_t alpha, Double_t x, Double_t b) {
136     if (Rotate(alpha))
137       if (PropagateTo(x,b)) return kTRUE;
138     return kFALSE;
139   }
140   void   Propagate(Double_t len,Double_t x[3],Double_t p[3],Double_t bz) const;
141   Bool_t Intersect(Double_t pnt[3], Double_t norm[3], Double_t bz) const;
142
143   void GetHelixParameters(Double_t h[6], Double_t b) const;
144   Double_t GetDCA(const AliExternalTrackParam *p, Double_t b,
145     Double_t &xthis,Double_t &xp) const;
146   Double_t PropagateToDCA(AliExternalTrackParam *p, Double_t b);
147   Bool_t PropagateToDCA(const AliVVertex *vtx, Double_t b, Double_t maxd,
148                         Double_t dz[2]=0, Double_t cov[3]=0);
149   
150   void GetDirection(Double_t d[3]) const;
151   Bool_t GetPxPyPz(Double_t *p) const;
152   Bool_t GetXYZ(Double_t *p) const;
153   Bool_t GetCovarianceXYZPxPyPz(Double_t cv[21]) const;
154   Bool_t GetPxPyPzAt(Double_t x, Double_t b, Double_t p[3]) const;
155   Bool_t GetXYZAt(Double_t x, Double_t b, Double_t r[3]) const;
156   Bool_t GetYAt(Double_t x,  Double_t b,  Double_t &y) const;
157   Bool_t GetZAt(Double_t x,  Double_t b,  Double_t &z) const;
158   void Print(Option_t* option = "") const;
159   Double_t GetSnpAt(Double_t x,Double_t b) const;
160
161   //Deprecated
162   Bool_t CorrectForMaterial(Double_t d, Double_t x0, Double_t mass,
163                             Double_t (*f)(Double_t)=ApproximateBetheBloch);
164
165   Bool_t GetDistance(AliExternalTrackParam *param2, Double_t x, Double_t dist[3], Double_t b);
166   Int_t GetIndex(Int_t i, Int_t j) const {return i+(j+1)*j/2;}
167   Int_t GetLabel() const {return -1;} 
168   //
169   // visualization (M. Ivanov)
170   //
171   virtual void FillPolymarker(TPolyMarker3D *pol, Float_t magf, Float_t minR, Float_t maxR, Float_t stepR);
172   virtual void DrawTrack(Float_t magF, Float_t minR, Float_t maxR, Float_t stepR);
173  protected:
174   Double_t &Par(Int_t i) {return fP[i];}
175   Double_t &Cov(Int_t i) {return fC[i];}
176   
177  private:
178   Double32_t           fX;     // X coordinate for the point of parametrisation
179   Double32_t           fAlpha; // Local <-->global coor.system rotation angle
180   Double32_t           fP[5];  // The track parameters
181   Double32_t           fC[15]; // The track parameter covariance matrix
182
183   static Double32_t    fgMostProbablePt; // "Most probable" pt
184                                          // (to be used if Bz=0)
185   ClassDef(AliExternalTrackParam, 8)
186 };
187
188 inline void AliExternalTrackParam::ResetCovariance(Double_t s2) {
189   //
190   // Reset the covarince matrix to "something big"
191   //
192     fC[0]*= s2;
193     fC[1] = 0.;  fC[2]*= s2;
194     fC[3] = 0.;  fC[4] = 0.;  fC[5]*= s2;
195     fC[6] = 0.;  fC[7] = 0.;  fC[8] = 0.;  fC[9]*= s2;
196     fC[10]= 0.;  fC[11]= 0.;  fC[12]= 0.;  fC[13]= 0.;  fC[14]*=s2;
197 }
198
199
200
201
202 #endif