1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 #include "AliESDtrack.h"
17 #include "AliTracker.h"
18 #include "AliHMPIDtrack.h"
20 ClassImp(AliHMPIDtrack)
22 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 AliHMPIDtrack::AliHMPIDtrack():AliKalmanTrack()
29 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
30 AliHMPIDtrack::AliHMPIDtrack(const AliHMPIDtrack& t):AliKalmanTrack(t)
36 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
37 AliHMPIDtrack::AliHMPIDtrack(const AliESDtrack& t):AliKalmanTrack()
40 // Constructor from AliESDtrack
42 SetLabel(t.GetLabel());
46 Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance());
48 if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return;
50 Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times);
51 SetIntegratedLength(t.GetIntegratedLength());
53 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
54 AliHMPIDtrack& AliHMPIDtrack::operator=(const AliHMPIDtrack &/*source*/)
60 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
61 Bool_t AliHMPIDtrack::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho)
64 // Propagates this track to a reference plane defined by "xk" [cm]
65 // correcting for the mean crossed material.
67 // "xx0" - thickness/rad.length [units of the radiation length]
68 // "xrho" - thickness*density [g/cm^2]
69 // Returns: kTRUE if the track propagates to plane, else kFALSE
74 Double_t bz = GetBz();
75 if (!AliExternalTrackParam::PropagateTo(xk,bz)) {
78 if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0,xrho,GetMass())) {
83 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
84 Bool_t AliHMPIDtrack::Rotate(Double_t alpha, Bool_t absolute)
87 // Rotates track parameters in R*phi plane
88 // if absolute rotation alpha is in global system
89 // otherwise alpha rotation is relative to the current rotation angle
97 return AliExternalTrackParam::Rotate(GetAlpha()+alpha);
100 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
101 Int_t AliHMPIDtrack::GetProlongation(Double_t xk, Double_t &y, Double_t &z)
104 // Find a prolongation at given x
105 // Return 0 if it does not exist
108 Double_t bz = GetBz();
110 if (!AliExternalTrackParam::GetYAt(xk,bz,y)) {
113 if (!AliExternalTrackParam::GetZAt(xk,bz,z)) {
121 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
122 Int_t AliHMPIDtrack::PropagateToR(Double_t r,Double_t step)
125 // Propagate track to the radial position
126 // Rotation always connected to the last track position
134 Double_t radius = TMath::Sqrt(GetX()*GetX() + GetY()*GetY());
136 Double_t dir = (radius > r) ? -1.0 : 1.0;
138 for (Double_t x = radius+dir*step; dir*x < dir*r; x += dir*step) {
141 Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
144 GetProlongation(x,y,z);
145 xyz1[0] = x * TMath::Cos(alpha) + y * TMath::Sin(alpha);
146 xyz1[1] = x * TMath::Sin(alpha) - y * TMath::Cos(alpha);
149 AliTracker::MeanMaterialBudget(xyz0,xyz1,param);
151 param[1] = 100000000;
153 PropagateTo(x,param[1],param[0]*param[4]);
158 Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
161 GetProlongation(r,y,z);
162 xyz1[0] = r * TMath::Cos(alpha) + y * TMath::Sin(alpha);
163 xyz1[1] = r * TMath::Sin(alpha) - y * TMath::Cos(alpha);
166 AliTracker::MeanMaterialBudget(xyz0,xyz1,param);
169 param[1] = 100000000;
171 PropagateTo(r,param[1],param[0]*param[4]);
176 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
177 Double_t AliHMPIDtrack::GetPredictedChi2(const AliCluster3D *c) const {
179 // Arguments: AliCluster3D
180 // Returns: Chi2 of track for the cluster
181 Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()};
182 Double_t covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()};
183 Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()};
184 return AliExternalTrackParam::GetPredictedChi2(p, covyz, covxyz);
185 }//GetPredictedChi2()
186 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
187 Bool_t AliHMPIDtrack::PropagateTo(const AliCluster3D *c) {
189 // Arguments: AliCluster3D
190 // Returns: kTRUE if the track propagates to the plane of the cluster
191 Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ();
192 Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()};
193 Double_t covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()};
194 Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()};
197 if(!AliExternalTrackParam::PropagateTo(p, covyz, covxyz, bz)) return kFALSE;
198 if(IsStartedTimeIntegral())
200 Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + (GetY()-oldY)*(GetY()-oldY) + (GetZ()-oldZ)*(GetZ()-oldZ));
201 if (GetX()<oldX) d=-d;
206 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
207 Double_t AliHMPIDtrack::GetBz() const {
210 // Returns: Bz component of the magnetic field (kG)
212 if (AliTracker::UniformField()) return AliTracker::GetBz();
213 Double_t r[3]; GetXYZ(r);
214 return AliTracker::GetBz(r);
216 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
217 Bool_t AliHMPIDtrack::Intersect(Double_t pnt[3], Double_t norm[3], Double_t bz) const {
218 //+++++++++++++++++++++++++++++++++++++++++
219 // Origin: K. Shileev (Kirill.Shileev@cern.ch)
220 // Finds point of intersection (if exists) of the helix with the plane.
221 // Stores result in fX and fP.
222 // Arguments: planePoint,planeNorm - the plane defined by any plane's point
223 // and vector, normal to the plane
224 // Returns: kTrue if helix intersects the plane, kFALSE otherwise.
225 //+++++++++++++++++++++++++++++++++++++++++
226 Double_t x0[3]; GetXYZ(x0); //get track position in MARS
227 //Printf("xxx Intersect OLD: bz: %lf xxx",bz);
229 //estimates initial helix length up to plane
230 Double_t s=(pnt[0]-x0[0])*norm[0] + (pnt[1]-x0[1])*norm[1] + (pnt[2]-x0[2])*norm[2];
231 Double_t dist=99999,distPrev=dist;
233 while(TMath::Abs(dist)>0.00001){
234 //calculates helix at the distance s from x0 ALONG the helix
236 //distance between current helix position and plane
237 dist=(x[0]-pnt[0])*norm[0]+(x[1]-pnt[1])*norm[1]+(x[2]-pnt[2])*norm[2];
238 if(TMath::Abs(dist) >= TMath::Abs(distPrev)) {return kFALSE;}
242 //on exit pnt is intersection point,norm is track vector at that point,
244 for (Int_t i=0; i<3; i++) {pnt[i]=x[i]; norm[i]=p[i];}
247 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
248 Bool_t AliHMPIDtrack::Intersect(AliHMPIDtrack *pTrk,Double_t pnt[3], Double_t norm[3]) {
249 // Finds point of intersection (if exists) of the helix with the plane.
250 // Stores result in fX and fP.
251 // Arguments: planePoint,planeNorm - the plane defined by any plane's point
252 // and vector, normal to the plane
253 // Returns: kTrue if helix intersects the plane, kFALSE otherwise.
255 //Printf(":::::: 111 :::::: pnt0: %lf pnt1: %lf pnt2: %lf norm0: %lf norm1: %lf norm2: %lf",pnt[0],pnt[1],pnt[2],norm[0],norm[1],norm[2]);
257 Double_t bz=-1.0*GetBz();
258 Double_t x0[3]; pTrk->GetXYZ(x0); //get track position in MARS
259 //Printf(":::::: 222 :::::: x0: %lf x1: %lf x2: %lf",x0[0],x0[1],x0[2]);
262 //estimates initial helix length up to plane
263 Double_t s=(pnt[0]-x0[0])*norm[0] + (pnt[1]-x0[1])*norm[1] + (pnt[2]-x0[2])*norm[2];
264 Double_t dist=99999,distPrev=dist;
266 while(TMath::Abs(dist)>0.00001){
267 //calculates helix at the distance s from x0 ALONG the helix
270 //distance between current helix position and plane
271 dist=(x[0]-pnt[0])*norm[0]+(x[1]-pnt[1])*norm[1]+(x[2]-pnt[2])*norm[2];
272 if(TMath::Abs(dist) >= TMath::Abs(distPrev)) {return kFALSE;}
276 // Printf(":::::: 333 :::::: pnt0: %lf pnt1: %lf pnt2: %lf norm0: %lf norm1: %lf norm2: %lf",pnt[0],pnt[1],pnt[2],norm[0],norm[1],norm[2]);
277 //on exit pnt is intersection point,norm is track vector at that point,
279 rad=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]);
280 PropagateTo(rad); //propagate with the average dens. rad. lenght
282 GetPxPyPz(p); //propagate to the radial distance of the PC or the Radiator
283 for (Int_t i=0; i<3; i++) {pnt[i]=x[i]; norm[i]=p[i];}
284 // Printf(":::::: 444 :::::: pnt0: %lf pnt1: %lf pnt2: %lf norm0: %lf norm1: %lf norm2: %lf",pnt[0],pnt[1],pnt[2],norm[0],norm[1],norm[2]);
286 pEsdTrk->SetHMPIDpx(p[0]);
287 pEsdTrk->SetHMPIDpy(p[1]);
288 pEsdTrk->SetHMPIDpz(p[2]);
293 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
294 void AliHMPIDtrack::Propagate(Double_t len, Double_t x[3],Double_t p[3], Double_t bz) const {
295 //+++++++++++++++++++++++++++++++++++++++++
296 // Origin: K. Shileev (Kirill.Shileev@cern.ch)
297 // Extrapolate track along simple helix in magnetic field
298 // Arguments: len -distance alogn helix, [cm]
299 // bz - mag field, [kGaus]
300 // Returns: x and p contain extrapolated positon and momentum
301 // The momentum returned for straight-line tracks is meaningless !
302 //+++++++++++++++++++++++++++++++++++++++++
304 if (OneOverPt() < kAlmost0 || TMath::Abs(bz) < kAlmost0Field ){ //straight-line tracks
305 Double_t unit[3]; GetDirection(unit);
310 p[0]=unit[0]/kAlmost0;
311 p[1]=unit[1]/kAlmost0;
312 p[2]=unit[2]/kAlmost0;
316 Double_t a = -kB2C*bz*GetSign(); ////////// what is kB2C
318 x[0] += p[0]*TMath::Sin(rho*len)/a - p[1]*(1-TMath::Cos(rho*len))/a;
319 x[1] += p[1]*TMath::Sin(rho*len)/a + p[0]*(1-TMath::Cos(rho*len))/a;
322 p[0] = p0 *TMath::Cos(rho*len) - p[1]*TMath::Sin(rho*len);
323 p[1] = p[1]*TMath::Cos(rho*len) + p0 *TMath::Sin(rho*len);
326 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++