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 Bool_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 if (!GetProlongation(x,y,z)) return kFALSE;
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 if (!GetProlongation(r,y,z)) return kFALSE;
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;
172 return PropagateTo(r,param[1],param[0]*param[4]);
174 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
175 Double_t AliHMPIDtrack::GetPredictedChi2(const AliCluster3D *c) const {
177 // Arguments: AliCluster3D
178 // Returns: Chi2 of track for the cluster
179 Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()};
180 Double_t covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()};
181 Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()};
182 return AliExternalTrackParam::GetPredictedChi2(p, covyz, covxyz);
183 }//GetPredictedChi2()
184 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
185 Bool_t AliHMPIDtrack::PropagateTo(const AliCluster3D *c) {
187 // Arguments: AliCluster3D
188 // Returns: kTRUE if the track propagates to the plane of the cluster
189 Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ();
190 Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()};
191 Double_t covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()};
192 Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()};
195 if(!AliExternalTrackParam::PropagateTo(p, covyz, covxyz, bz)) return kFALSE;
196 if(IsStartedTimeIntegral())
198 Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + (GetY()-oldY)*(GetY()-oldY) + (GetZ()-oldZ)*(GetZ()-oldZ));
199 if (GetX()<oldX) d=-d;
205 Bool_t AliHMPIDtrack::Intersect(Double_t pnt[3], Double_t norm[3], Double_t bz) const {
206 //+++++++++++++++++++++++++++++++++++++++++
207 // Origin: K. Shileev (Kirill.Shileev@cern.ch)
208 // Finds point of intersection (if exists) of the helix with the plane.
209 // Stores result in fX and fP.
210 // Arguments: planePoint,planeNorm - the plane defined by any plane's point
211 // and vector, normal to the plane
212 // Returns: kTrue if helix intersects the plane, kFALSE otherwise.
213 //+++++++++++++++++++++++++++++++++++++++++
214 Double_t x0[3]; GetXYZ(x0); //get track position in MARS
216 //estimates initial helix length up to plane
217 Double_t s=(pnt[0]-x0[0])*norm[0] + (pnt[1]-x0[1])*norm[1] + (pnt[2]-x0[2])*norm[2];
218 Double_t dist=99999,distPrev=dist;
220 while(TMath::Abs(dist)>0.00001){
221 //calculates helix at the distance s from x0 ALONG the helix
223 //distance between current helix position and plane
224 dist=(x[0]-pnt[0])*norm[0]+(x[1]-pnt[1])*norm[1]+(x[2]-pnt[2])*norm[2];
225 if(TMath::Abs(dist) >= TMath::Abs(distPrev)) {return kFALSE;}
229 //on exit pnt is intersection point,norm is track vector at that point,
231 for (Int_t i=0; i<3; i++) {pnt[i]=x[i]; norm[i]=p[i];}
234 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
235 Bool_t AliHMPIDtrack::Intersect(AliHMPIDtrack *pTrk,Double_t pnt[3], Double_t norm[3]) {
236 // Finds point of intersection (if exists) of the helix with the plane.
237 // Stores result in fX and fP.
238 // Arguments: planePoint,planeNorm - the plane defined by any plane's point
239 // and vector, normal to the plane
240 // Returns: kTrue if helix intersects the plane, kFALSE otherwise.
242 Double_t x0[3]; pTrk->GetXYZ(x0); //get track position in MARS
243 Double_t dist=99999,distPrev=dist;
245 pntrad= TMath::Sqrt(pnt[0]*pnt[0]+pnt[1]*pnt[1]);
246 while(TMath::Abs(dist)> 0.000001){//0.00001){
247 //calculates helix at the distance s from x0 ALONG the helix
248 pTrk->PropagateTo(pntrad);pTrk->GetXYZ(x);pTrk->GetPxPyPz(p);
249 //distance between current helix position and plane
250 dist=(x[0]-pnt[0])*norm[0]+(x[1]-pnt[1])*norm[1]+(x[2]-pnt[2])*norm[2];
251 pntrad=pntrad-dist*0.7;
252 //Printf("--- 111 --- dist %lf",dist);
253 if(TMath::Abs(2.0*dist) >= TMath::Abs(distPrev)) {return kFALSE;}
256 //on exit pnt is intersection point,norm is track vector at that point,
257 //Printf("--- 222 --- dist %lf",dist);
259 for (Int_t i=0; i<3; i++) {pnt[i]=x[i]; norm[i]=p[i];}
262 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
263 void AliHMPIDtrack::Propagate(Double_t len, Double_t x[3],Double_t p[3], Double_t bz) const {
264 //+++++++++++++++++++++++++++++++++++++++++
265 // Origin: K. Shileev (Kirill.Shileev@cern.ch)
266 // Extrapolate track along simple helix in magnetic field
267 // Arguments: len -distance alogn helix, [cm]
268 // bz - mag field, [kGaus]
269 // Returns: x and p contain extrapolated positon and momentum
270 // The momentum returned for straight-line tracks is meaningless !
271 //+++++++++++++++++++++++++++++++++++++++++
273 if (OneOverPt() < kAlmost0 || TMath::Abs(bz) < kAlmost0Field ){ //straight-line tracks
274 Double_t unit[3]; GetDirection(unit);
279 p[0]=unit[0]/kAlmost0;
280 p[1]=unit[1]/kAlmost0;
281 p[2]=unit[2]/kAlmost0;
285 Double_t a = -kB2C*bz*GetSign(); ////////// what is kB2C
287 x[0] += p[0]*TMath::Sin(rho*len)/a - p[1]*(1-TMath::Cos(rho*len))/a;
288 x[1] += p[1]*TMath::Sin(rho*len)/a + p[0]*(1-TMath::Cos(rho*len))/a;
291 p[0] = p0 *TMath::Cos(rho*len) - p[1]*TMath::Sin(rho*len);
292 p[1] = p[1]*TMath::Cos(rho*len) + p0 *TMath::Sin(rho*len);
295 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
296 Bool_t AliHMPIDtrack::Update(const AliHMPIDCluster *pClu, Double_t /*chisq*/, Int_t /*index*/)
299 // Arguments: AliCluster3D, chi sq, and clu index
300 // Returns: kTRUE if the track parameters are successfully updated
301 Double_t p[2]={pClu->GetY(), pClu->GetZ()};
302 Double_t cov[3]={pClu->GetSigmaY2(), 0., pClu->GetSigmaZ2()};
303 if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
306 AliTracker::FillResiduals(this,p,cov,pClu->GetVolumeId());
308 Int_t n=GetNumberOfClusters();
310 SetNumberOfClusters(n+1);
311 SetChi2(GetChi2()+chisq);
316 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++