]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/STEERBase/AliExternalTrackParam.h
Added methods for seting and rotation of parameters only in AliExternalTrackParam
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliExternalTrackParam.h
CommitLineData
51ad6848 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
49d13e89 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 *****************************************************************************/
6c94f330 21#include "TMath.h"
a5e407e9 22
4f6e22bd 23#include "AliVTrack.h"
def9660e 24
49d13e89 25const Double_t kVeryBig=1./kAlmost0;
7b5ef2e6 26const Double_t kMostProbablePt=0.35;
5773defd 27
58e536c5 28class AliVVertex;
0c19adf7 29class TPolyMarker3D;
c683ddc2 30
86be8934 31const Double_t kC0max=100*100, // SigmaY<=100cm
32 kC2max=100*100, // SigmaZ<=100cm
33 kC5max=1*1, // SigmaSin<=1
34 kC9max=1*1, // SigmaTan<=1
35 kC14max=100*100; // Sigma1/Pt<=100 1/GeV
36
4f6e22bd 37class AliExternalTrackParam: public AliVTrack {
51ad6848 38 public:
39 AliExternalTrackParam();
6c94f330 40 AliExternalTrackParam(const AliExternalTrackParam &);
def9660e 41 AliExternalTrackParam& operator=(const AliExternalTrackParam & trkPar);
51ad6848 42 AliExternalTrackParam(Double_t x, Double_t alpha,
43 const Double_t param[5], const Double_t covar[15]);
da4e3deb 44 AliExternalTrackParam(Double_t xyz[3],Double_t pxpypz[3],
45 Double_t cv[21],Short_t sign);
1530f89c 46 virtual ~AliExternalTrackParam(){}
4ec1ca0f 47 void CopyFromVTrack(const AliVTrack *vTrack);
13545423 48
1443179a 49 template <typename T>
50 void Set(T x, T alpha, const T param[5], const T covar[15]) {
51 // Sets the parameters
c4f6245f 52 if (alpha < -TMath::Pi()) alpha += 2*TMath::Pi();
53 else if (alpha >= TMath::Pi()) alpha -= 2*TMath::Pi();
1443179a 54 fX=x; fAlpha=alpha;
55 for (Int_t i = 0; i < 5; i++) fP[i] = param[i];
56 for (Int_t i = 0; i < 15; i++) fC[i] = covar[i];
86be8934 57
58 CheckCovariance();
59
1443179a 60 }
61
a251382e 62 void SetParamOnly(double x, double alpha, const double param[5]) {
63 // Sets the parameters, neglect cov matrix
64 if (alpha < -TMath::Pi()) alpha += 2*TMath::Pi();
65 else if (alpha >= TMath::Pi()) alpha -= 2*TMath::Pi();
66 fX=x; fAlpha=alpha;
67 for (Int_t i = 0; i < 5; i++) fP[i] = param[i];
68 }
69
4f6e22bd 70 void Set(Double_t xyz[3],Double_t pxpypz[3],Double_t cv[21],Short_t sign);
ed5f2849 71
72 static void SetMostProbablePt(Double_t pt) { fgMostProbablePt=pt; }
73 static Double_t GetMostProbablePt() { return fgMostProbablePt; }
74
c9ec41e8 75 void Reset();
ed5f2849 76 void ResetCovariance(Double_t s2);
3775b0ca 77 void AddCovariance(const Double_t cov[15]);
c9ec41e8 78
49d13e89 79 const Double_t *GetParameter() const {return fP;}
80 const Double_t *GetCovariance() const {return fC;}
13545423 81 virtual Bool_t IsStartedTimeIntegral() const {return kFALSE;}
82 virtual void AddTimeStep(Double_t ) {} // dummy method, real stuff is done in AliKalmanTrack
6c94f330 83 Double_t GetAlpha() const {return fAlpha;}
c7bafca9 84 Double_t GetX() const {return fX;}
2d57349e 85 Double_t GetY() const {return fP[0];}
86 Double_t GetZ() const {return fP[1];}
6c94f330 87 Double_t GetSnp() const {return fP[2];}
88 Double_t GetTgl() const {return fP[3];}
def9660e 89 Double_t GetSigned1Pt() const {return fP[4];}
6c94f330 90
91 Double_t GetSigmaY2() const {return fC[0];}
92 Double_t GetSigmaZY() const {return fC[1];}
93 Double_t GetSigmaZ2() const {return fC[2];}
94 Double_t GetSigmaSnpY() const {return fC[3];}
95 Double_t GetSigmaSnpZ() const {return fC[4];}
96 Double_t GetSigmaSnp2() const {return fC[5];}
97 Double_t GetSigmaTglY() const {return fC[6];}
98 Double_t GetSigmaTglZ() const {return fC[7];}
99 Double_t GetSigmaTglSnp() const {return fC[8];}
100 Double_t GetSigmaTgl2() const {return fC[9];}
101 Double_t GetSigma1PtY() const {return fC[10];}
102 Double_t GetSigma1PtZ() const {return fC[11];}
103 Double_t GetSigma1PtSnp() const {return fC[12];}
104 Double_t GetSigma1PtTgl() const {return fC[13];}
105 Double_t GetSigma1Pt2() const {return fC[14];}
106
def9660e 107 // additional functions for AliVParticle
108 Double_t Px() const;
109 Double_t Py() const;
b52b9586 110 Double_t Pz() const { return Pt()*GetTgl(); }
def9660e 111 Double_t Pt() const { return TMath::Abs(GetSignedPt()); }
112 Double_t P() const { return GetP(); }
c683ddc2 113 Bool_t PxPyPz(Double_t p[3]) const { return GetPxPyPz(p); }
114
115 Double_t Xv() const;
116 Double_t Yv() const;
be15fa9c 117 Double_t Zv() const {return GetZ();}
c683ddc2 118 Bool_t XvYvZv(Double_t x[3]) const { return GetXYZ(x); }
119
def9660e 120 Double_t OneOverPt() const { return 1./Pt(); }
121 Double_t Phi() const;
122 Double_t Theta() const;
123 virtual Double_t E() const;
124 virtual Double_t M() const;
125 Double_t Eta() const;
126 virtual Double_t Y() const;
2258e165 127 virtual Short_t Charge() const { return (Short_t)GetSign(); }
67be2d29 128 virtual const Double_t *PID() const { return 0x0; }
def9660e 129
4f6e22bd 130 // additional functions from AliVTrack
131 virtual Int_t GetID() const { return -999; }
132 virtual UChar_t GetITSClusterMap() const {return 0; }
133 virtual ULong_t GetStatus() const { return 0; }
134
c9ec41e8 135 Double_t GetSign() const {return (fP[4]>0) ? 1 : -1;}
136 Double_t GetP() const;
def9660e 137 Double_t GetSignedPt() const {
6c94f330 138 return (TMath::Abs(fP[4])>kAlmost0) ? 1./fP[4]:TMath::Sign(kVeryBig,fP[4]);
139 }
1d99986f 140 Double_t Get1P() const;
2258e165 141 virtual Double_t GetC(Double_t b) const {return fP[4]*b*kB2C;}
1530f89c 142 void GetDZ(Double_t x,Double_t y,Double_t z,Double_t b,Float_t dz[2]) const;
c7bafca9 143 Double_t GetD(Double_t xv, Double_t yv, Double_t b) const;
49d13e89 144 Double_t GetLinearD(Double_t xv, Double_t yv) const;
b8e07ed6 145
116b445b 146 Bool_t CorrectForMeanMaterial(Double_t xOverX0, Double_t xTimesRho,
7dded1d5 147 Double_t mass, Bool_t anglecorr=kFALSE,
d46683db 148 Double_t (*f)(Double_t)=AliExternalTrackParam::BetheBlochSolid);
149
b8e07ed6 150 Bool_t CorrectForMeanMaterialdEdx(Double_t xOverX0, Double_t xTimesRho,
151 Double_t mass, Double_t dEdx, Bool_t anglecorr=kFALSE);
152
153 Bool_t CorrectForMeanMaterialZA(Double_t xOverX0, Double_t xTimesRho,
154 Double_t mass,
155 Double_t zOverA=0.49848,
156 Double_t density=2.33,
157 Double_t exEnergy=173e-9,
158 Double_t jp1=0.20,
159 Double_t jp2=3.00,
160 Bool_t anglecorr=kFALSE
161 );
162
9c56b409 163 //
164 // Bethe-Bloch formula parameterizations
165 //
166 static Double_t BetheBlochAleph(Double_t bg,
167 Double_t kp1=0.76176e-1,
168 Double_t kp2=10.632,
169 Double_t kp3=0.13279e-4,
170 Double_t kp4=1.8631,
171 Double_t kp5=1.9479
172 );
173 static Double_t BetheBlochGeant(Double_t bg,
174 Double_t kp0=2.33,
175 Double_t kp1=0.20,
176 Double_t kp2=3.00,
177 Double_t kp3=173e-9,
178 Double_t kp4=0.49848
179 );
180
d46683db 181 static Double_t BetheBlochSolid(Double_t bg);
182 static Double_t BetheBlochGas(Double_t bg);
183
49d13e89 184 Double_t GetPredictedChi2(Double_t p[2],Double_t cov[3]) const;
1e023a36 185
4b189f98 186 Double_t
187 GetPredictedChi2(Double_t p[3],Double_t covyz[3],Double_t covxyz[3]) const;
acdfbc78 188
189 Double_t GetPredictedChi2(const AliExternalTrackParam *t) const;
190
1e023a36 191 Bool_t
192 PropagateTo(Double_t p[3],Double_t covyz[3],Double_t covxyz[3],Double_t b);
193
e23a38cb 194 Double_t *GetResiduals(Double_t *p,Double_t *cov,Bool_t updated=kTRUE) const;
49d13e89 195 Bool_t Update(Double_t p[2],Double_t cov[3]);
196 Bool_t Rotate(Double_t alpha);
a251382e 197 Bool_t RotateParamOnly(Double_t alpha);
2d2fd909 198 Bool_t Invert();
49d13e89 199 Bool_t PropagateTo(Double_t x, Double_t b);
599b440e 200 Bool_t PropagateParamOnlyTo(Double_t xk, Double_t b);
9f2bec63 201 Bool_t Propagate(Double_t alpha, Double_t x, Double_t b);
266a0f9b 202 Bool_t PropagateBxByBz(Double_t alpha, Double_t x, Double_t b[3]);
e0302afb 203 Bool_t PropagateParamOnlyBxByBzTo(Double_t xk, const Double_t b[3]);
052daaff 204 void Propagate(Double_t len,Double_t x[3],Double_t p[3],Double_t bz) const;
205 Bool_t Intersect(Double_t pnt[3], Double_t norm[3], Double_t bz) const;
49d13e89 206
8b6e3369 207 static void g3helx3(Double_t qfield, Double_t step, Double_t vect[7]);
208 Bool_t PropagateToBxByBz(Double_t x, const Double_t b[3]);
209
c7bafca9 210 void GetHelixParameters(Double_t h[6], Double_t b) const;
211 Double_t GetDCA(const AliExternalTrackParam *p, Double_t b,
212 Double_t &xthis,Double_t &xp) const;
213 Double_t PropagateToDCA(AliExternalTrackParam *p, Double_t b);
58e536c5 214 Bool_t PropagateToDCA(const AliVVertex *vtx, Double_t b, Double_t maxd,
e99a34df 215 Double_t dz[2]=0, Double_t cov[3]=0);
266a0f9b 216 Bool_t PropagateToDCABxByBz(const AliVVertex *vtx, Double_t b[3],
217 Double_t maxd, Double_t dz[2]=0, Double_t cov[3]=0);
4c3dc2a0 218 Bool_t ConstrainToVertex(const AliVVertex* vtx, Double_t b[3]);
e99a34df 219
b1149664 220 void GetDirection(Double_t d[3]) const;
c9ec41e8 221 Bool_t GetPxPyPz(Double_t *p) const;
222 Bool_t GetXYZ(Double_t *p) const;
223 Bool_t GetCovarianceXYZPxPyPz(Double_t cv[21]) const;
224 Bool_t GetPxPyPzAt(Double_t x, Double_t b, Double_t p[3]) const;
225 Bool_t GetXYZAt(Double_t x, Double_t b, Double_t r[3]) const;
7cf7bb6c 226 Bool_t GetYAt(Double_t x, Double_t b, Double_t &y) const;
6c94f330 227 Bool_t GetZAt(Double_t x, Double_t b, Double_t &z) const;
c9ec41e8 228 void Print(Option_t* option = "") const;
c194ba83 229 Double_t GetSnpAt(Double_t x,Double_t b) const;
70580f26 230 Bool_t GetXatLabR(Double_t r,Double_t &x, Double_t bz, Int_t dir=0) const;
7d2e151a 231 Bool_t GetXYZatR(Double_t xr,Double_t bz, Double_t *xyz=0, Double_t* alpSect=0) const;
6c94f330 232
116b445b 233 //Deprecated
234 Bool_t CorrectForMaterial(Double_t d, Double_t x0, Double_t mass,
d46683db 235 Double_t (*f)(Double_t)=AliExternalTrackParam::BetheBlochSolid);
116b445b 236
bf00ebb8 237 Bool_t GetDistance(AliExternalTrackParam *param2, Double_t x, Double_t dist[3], Double_t b);
0e8460af 238 Int_t GetIndex(Int_t i, Int_t j) const;
3c43fb2b 239 Int_t GetLabel() const {return -1;}
6a8e543a 240 Int_t PdgCode() const {return 0;}
241
0c19adf7 242 //
243 // visualization (M. Ivanov)
244 //
245 virtual void FillPolymarker(TPolyMarker3D *pol, Float_t magf, Float_t minR, Float_t maxR, Float_t stepR);
246 virtual void DrawTrack(Float_t magF, Float_t minR, Float_t maxR, Float_t stepR);
cfdb62d4 247
248 virtual Bool_t Translate(Double_t *vTrasl,Double_t *covV);
249
86be8934 250 void CheckCovariance();
251
f2cef1b5 252 static Bool_t GetUseLogTermMS() {return fgUseLogTermMS;}
253 static void SetUseLogTermMS(Bool_t v=kTRUE) {fgUseLogTermMS = v;}
254
4ec1ca0f 255 protected:
256 AliExternalTrackParam(const AliVTrack *vTrack);
257
86be8934 258/* protected: */
259 private:
6c94f330 260 Double_t &Par(Int_t i) {return fP[i];}
261 Double_t &Cov(Int_t i) {return fC[i];}
e804766b 262 protected:
bad5ac2c 263 Double32_t fX; // X coordinate for the point of parametrisation
264 Double32_t fAlpha; // Local <-->global coor.system rotation angle
265 Double32_t fP[5]; // The track parameters
266 Double32_t fC[15]; // The track parameter covariance matrix
ddfbc51a 267
ed5f2849 268 static Double32_t fgMostProbablePt; // "Most probable" pt
269 // (to be used if Bz=0)
f2cef1b5 270 static Bool_t fgUseLogTermMS; // use log term in Mult.Stattering evaluation
4f6e22bd 271 ClassDef(AliExternalTrackParam, 8)
51ad6848 272};
273
ed5f2849 274inline void AliExternalTrackParam::ResetCovariance(Double_t s2) {
275 //
276 // Reset the covarince matrix to "something big"
277 //
86be8934 278
279 s2 = TMath::Abs(s2);
280 Double_t fC0=fC[0]*s2,
281 fC2=fC[2]*s2,
282 fC5=fC[5]*s2,
283 fC9=fC[9]*s2,
284 fC14=fC[14]*s2;
285
286 if (fC0>kC0max) fC0 = kC0max;
287 if (fC2>kC2max) fC2 = kC2max;
288 if (fC5>kC5max) fC5 = kC5max;
289 if (fC9>kC9max) fC9 = kC9max;
290 if (fC14>kC14max) fC14 = kC14max;
291
292
293 fC[0] = fC0;
294 fC[1] = 0.; fC[2] = fC2;
295 fC[3] = 0.; fC[4] = 0.; fC[5] = fC5;
296 fC[6] = 0.; fC[7] = 0.; fC[8] = 0.; fC[9] = fC9;
297 fC[10]= 0.; fC[11]= 0.; fC[12]= 0.; fC[13]= 0.; fC[14] = fC14;
ed5f2849 298}
299
bf00ebb8 300
301
302
51ad6848 303#endif