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 */
8 /*****************************************************************************
9 * "External" track parametrisation class *
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)) *
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 *****************************************************************************/
23 #include "AliVTrack.h"
25 const Double_t kVeryBig=1./kAlmost0;
26 const Double_t kMostProbablePt=0.35;
31 const 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
37 class AliExternalTrackParam: public AliVTrack {
39 AliExternalTrackParam();
40 AliExternalTrackParam(const AliExternalTrackParam &);
41 AliExternalTrackParam& operator=(const AliExternalTrackParam & trkPar);
42 AliExternalTrackParam(Double_t x, Double_t alpha,
43 const Double_t param[5], const Double_t covar[15]);
44 AliExternalTrackParam(Double_t xyz[3],Double_t pxpypz[3],
45 Double_t cv[21],Short_t sign);
46 virtual ~AliExternalTrackParam(){}
47 void CopyFromVTrack(const AliVTrack *vTrack);
50 void Set(T x, T alpha, const T param[5], const T covar[15]) {
51 // Sets the parameters
52 if (alpha < -TMath::Pi()) alpha += 2*TMath::Pi();
53 else if (alpha >= TMath::Pi()) alpha -= 2*TMath::Pi();
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];
62 void Set(Double_t xyz[3],Double_t pxpypz[3],Double_t cv[21],Short_t sign);
64 static void SetMostProbablePt(Double_t pt) { fgMostProbablePt=pt; }
65 static Double_t GetMostProbablePt() { return fgMostProbablePt; }
68 void ResetCovariance(Double_t s2);
69 void AddCovariance(const Double_t cov[15]);
71 const Double_t *GetParameter() const {return fP;}
72 const Double_t *GetCovariance() const {return fC;}
73 virtual Bool_t IsStartedTimeIntegral() const {return kFALSE;}
74 virtual void AddTimeStep(Double_t ) {} // dummy method, real stuff is done in AliKalmanTrack
75 Double_t GetAlpha() const {return fAlpha;}
76 Double_t GetX() const {return fX;}
77 Double_t GetY() const {return fP[0];}
78 Double_t GetZ() const {return fP[1];}
79 Double_t GetSnp() const {return fP[2];}
80 Double_t GetTgl() const {return fP[3];}
81 Double_t GetSigned1Pt() const {return fP[4];}
83 Double_t GetSigmaY2() const {return fC[0];}
84 Double_t GetSigmaZY() const {return fC[1];}
85 Double_t GetSigmaZ2() const {return fC[2];}
86 Double_t GetSigmaSnpY() const {return fC[3];}
87 Double_t GetSigmaSnpZ() const {return fC[4];}
88 Double_t GetSigmaSnp2() const {return fC[5];}
89 Double_t GetSigmaTglY() const {return fC[6];}
90 Double_t GetSigmaTglZ() const {return fC[7];}
91 Double_t GetSigmaTglSnp() const {return fC[8];}
92 Double_t GetSigmaTgl2() const {return fC[9];}
93 Double_t GetSigma1PtY() const {return fC[10];}
94 Double_t GetSigma1PtZ() const {return fC[11];}
95 Double_t GetSigma1PtSnp() const {return fC[12];}
96 Double_t GetSigma1PtTgl() const {return fC[13];}
97 Double_t GetSigma1Pt2() const {return fC[14];}
99 // additional functions for AliVParticle
102 Double_t Pz() const { return Pt()*GetTgl(); }
103 Double_t Pt() const { return TMath::Abs(GetSignedPt()); }
104 Double_t P() const { return GetP(); }
105 Bool_t PxPyPz(Double_t p[3]) const { return GetPxPyPz(p); }
109 Double_t Zv() const {return GetZ();}
110 Bool_t XvYvZv(Double_t x[3]) const { return GetXYZ(x); }
112 Double_t OneOverPt() const { return 1./Pt(); }
113 Double_t Phi() const;
114 Double_t Theta() const;
115 virtual Double_t E() const;
116 virtual Double_t M() const;
117 Double_t Eta() const;
118 virtual Double_t Y() const;
119 virtual Short_t Charge() const { return (Short_t)GetSign(); }
120 virtual const Double_t *PID() const { return 0x0; }
122 // additional functions from AliVTrack
123 virtual Int_t GetID() const { return -999; }
124 virtual UChar_t GetITSClusterMap() const {return 0; }
125 virtual ULong_t GetStatus() const { return 0; }
127 Double_t GetSign() const {return (fP[4]>0) ? 1 : -1;}
128 Double_t GetP() const;
129 Double_t GetSignedPt() const {
130 return (TMath::Abs(fP[4])>kAlmost0) ? 1./fP[4]:TMath::Sign(kVeryBig,fP[4]);
132 Double_t Get1P() const;
133 virtual Double_t GetC(Double_t b) const {return fP[4]*b*kB2C;}
134 void GetDZ(Double_t x,Double_t y,Double_t z,Double_t b,Float_t dz[2]) const;
135 Double_t GetD(Double_t xv, Double_t yv, Double_t b) const;
136 Double_t GetLinearD(Double_t xv, Double_t yv) const;
138 Bool_t CorrectForMeanMaterial(Double_t xOverX0, Double_t xTimesRho,
139 Double_t mass, Bool_t anglecorr=kFALSE,
140 Double_t (*f)(Double_t)=AliExternalTrackParam::BetheBlochSolid);
142 Bool_t CorrectForMeanMaterialdEdx(Double_t xOverX0, Double_t xTimesRho,
143 Double_t mass, Double_t dEdx, Bool_t anglecorr=kFALSE);
145 Bool_t CorrectForMeanMaterialZA(Double_t xOverX0, Double_t xTimesRho,
147 Double_t zOverA=0.49848,
148 Double_t density=2.33,
149 Double_t exEnergy=173e-9,
152 Bool_t anglecorr=kFALSE
156 // Bethe-Bloch formula parameterizations
158 static Double_t BetheBlochAleph(Double_t bg,
159 Double_t kp1=0.76176e-1,
161 Double_t kp3=0.13279e-4,
165 static Double_t BetheBlochGeant(Double_t bg,
173 static Double_t BetheBlochSolid(Double_t bg);
174 static Double_t BetheBlochGas(Double_t bg);
176 Double_t GetPredictedChi2(Double_t p[2],Double_t cov[3]) const;
179 GetPredictedChi2(Double_t p[3],Double_t covyz[3],Double_t covxyz[3]) const;
181 Double_t GetPredictedChi2(const AliExternalTrackParam *t) const;
184 PropagateTo(Double_t p[3],Double_t covyz[3],Double_t covxyz[3],Double_t b);
186 Double_t *GetResiduals(Double_t *p,Double_t *cov,Bool_t updated=kTRUE) const;
187 Bool_t Update(Double_t p[2],Double_t cov[3]);
188 Bool_t Rotate(Double_t alpha);
190 Bool_t PropagateTo(Double_t x, Double_t b);
191 Bool_t PropagateParamOnlyTo(Double_t xk, Double_t b);
192 Bool_t Propagate(Double_t alpha, Double_t x, Double_t b);
193 Bool_t PropagateBxByBz(Double_t alpha, Double_t x, Double_t b[3]);
194 void Propagate(Double_t len,Double_t x[3],Double_t p[3],Double_t bz) const;
195 Bool_t Intersect(Double_t pnt[3], Double_t norm[3], Double_t bz) const;
197 static void g3helx3(Double_t qfield, Double_t step, Double_t vect[7]);
198 Bool_t PropagateToBxByBz(Double_t x, const Double_t b[3]);
200 void GetHelixParameters(Double_t h[6], Double_t b) const;
201 Double_t GetDCA(const AliExternalTrackParam *p, Double_t b,
202 Double_t &xthis,Double_t &xp) const;
203 Double_t PropagateToDCA(AliExternalTrackParam *p, Double_t b);
204 Bool_t PropagateToDCA(const AliVVertex *vtx, Double_t b, Double_t maxd,
205 Double_t dz[2]=0, Double_t cov[3]=0);
206 Bool_t PropagateToDCABxByBz(const AliVVertex *vtx, Double_t b[3],
207 Double_t maxd, Double_t dz[2]=0, Double_t cov[3]=0);
208 Bool_t ConstrainToVertex(const AliVVertex* vtx, Double_t b[3]);
210 void GetDirection(Double_t d[3]) const;
211 Bool_t GetPxPyPz(Double_t *p) const;
212 Bool_t GetXYZ(Double_t *p) const;
213 Bool_t GetCovarianceXYZPxPyPz(Double_t cv[21]) const;
214 Bool_t GetPxPyPzAt(Double_t x, Double_t b, Double_t p[3]) const;
215 Bool_t GetXYZAt(Double_t x, Double_t b, Double_t r[3]) const;
216 Bool_t GetYAt(Double_t x, Double_t b, Double_t &y) const;
217 Bool_t GetZAt(Double_t x, Double_t b, Double_t &z) const;
218 void Print(Option_t* option = "") const;
219 Double_t GetSnpAt(Double_t x,Double_t b) const;
220 Bool_t GetXatLabR(Double_t r,Double_t &x, Double_t bz, Int_t dir=0) const;
223 Bool_t CorrectForMaterial(Double_t d, Double_t x0, Double_t mass,
224 Double_t (*f)(Double_t)=AliExternalTrackParam::BetheBlochSolid);
226 Bool_t GetDistance(AliExternalTrackParam *param2, Double_t x, Double_t dist[3], Double_t b);
227 Int_t GetIndex(Int_t i, Int_t j) const;
228 Int_t GetLabel() const {return -1;}
229 Int_t PdgCode() const {return 0;}
232 // visualization (M. Ivanov)
234 virtual void FillPolymarker(TPolyMarker3D *pol, Float_t magf, Float_t minR, Float_t maxR, Float_t stepR);
235 virtual void DrawTrack(Float_t magF, Float_t minR, Float_t maxR, Float_t stepR);
237 virtual Bool_t Translate(Double_t *vTrasl,Double_t *covV);
239 void CheckCovariance();
241 static Bool_t GetUseLogTermMS() {return fgUseLogTermMS;}
242 static void SetUseLogTermMS(Bool_t v=kTRUE) {fgUseLogTermMS = v;}
245 AliExternalTrackParam(const AliVTrack *vTrack);
249 Double_t &Par(Int_t i) {return fP[i];}
250 Double_t &Cov(Int_t i) {return fC[i];}
252 Double32_t fX; // X coordinate for the point of parametrisation
253 Double32_t fAlpha; // Local <-->global coor.system rotation angle
254 Double32_t fP[5]; // The track parameters
255 Double32_t fC[15]; // The track parameter covariance matrix
257 static Double32_t fgMostProbablePt; // "Most probable" pt
258 // (to be used if Bz=0)
259 static Bool_t fgUseLogTermMS; // use log term in Mult.Stattering evaluation
260 ClassDef(AliExternalTrackParam, 8)
263 inline void AliExternalTrackParam::ResetCovariance(Double_t s2) {
265 // Reset the covarince matrix to "something big"
269 Double_t fC0=fC[0]*s2,
275 if (fC0>kC0max) fC0 = kC0max;
276 if (fC2>kC2max) fC2 = kC2max;
277 if (fC5>kC5max) fC5 = kC5max;
278 if (fC9>kC9max) fC9 = kC9max;
279 if (fC14>kC14max) fC14 = kC14max;
283 fC[1] = 0.; fC[2] = fC2;
284 fC[3] = 0.; fC[4] = 0.; fC[5] = fC5;
285 fC[6] = 0.; fC[7] = 0.; fC[8] = 0.; fC[9] = fC9;
286 fC[10]= 0.; fC[11]= 0.; fC[12]= 0.; fC[13]= 0.; fC[14] = fC14;