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 /* $Id: AliTrackerBase.cxx 38069 2009-12-24 16:56:18Z belikov $ */
18 //-------------------------------------------------------------------------
19 // Implementation of the AliTrackerBase class
20 // that is the base for the AliTracker class
21 // Origin: Marian.Ivanov@cern.ch
22 //-------------------------------------------------------------------------
25 #include <TGeoManager.h>
28 #include "AliTrackerBase.h"
29 #include "AliExternalTrackParam.h"
30 #include "AliTrackPointArray.h"
33 extern TGeoManager *gGeoManager;
35 ClassImp(AliTrackerBase)
37 AliTrackerBase::AliTrackerBase():
46 //--------------------------------------------------------------------
47 // The default constructor.
48 //--------------------------------------------------------------------
49 if (!TGeoGlobalMagField::Instance()->GetField())
50 AliWarning("Field map is not set.");
53 //__________________________________________________________________________
54 AliTrackerBase::AliTrackerBase(const AliTrackerBase &atr):
63 //--------------------------------------------------------------------
64 // The default constructor.
65 //--------------------------------------------------------------------
66 if (!TGeoGlobalMagField::Instance()->GetField())
67 AliWarning("Field map is not set.");
70 //__________________________________________________________________________
71 Double_t AliTrackerBase::GetBz()
73 AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
75 AliFatalClass("Field is not loaded");
77 return 0.5*kAlmost0Field;
79 Double_t bz = fld->SolenoidField();
80 return TMath::Sign(0.5*kAlmost0Field,bz) + bz;
83 //__________________________________________________________________________
84 Double_t AliTrackerBase::GetBz(const Double_t *r) {
85 //------------------------------------------------------------------
86 // Returns Bz (kG) at the point "r" .
87 //------------------------------------------------------------------
88 AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
90 AliFatalClass("Field is not loaded");
92 return 0.5*kAlmost0Field;
94 Double_t bz = fld->GetBz(r);
95 return TMath::Sign(0.5*kAlmost0Field,bz) + bz;
98 //__________________________________________________________________________
99 void AliTrackerBase::GetBxByBz(const Double_t r[3], Double_t b[3]) {
100 //------------------------------------------------------------------
101 // Returns Bx, By and Bz (kG) at the point "r" .
102 //------------------------------------------------------------------
103 AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
105 AliFatalClass("Field is not loaded");
107 // b[2] = 0.5*kAlmost0Field;
111 if (fld->IsUniform()) {
113 b[2] = fld->SolenoidField();
117 b[2] = (TMath::Sign(0.5*kAlmost0Field,b[2]) + b[2]);
121 Double_t AliTrackerBase::MeanMaterialBudget(const Double_t *start, const Double_t *end, Double_t *mparam)
124 // Calculate mean material budget and material properties between
125 // the points "start" and "end".
127 // "mparam" - parameters used for the energy and multiple scattering
130 // mparam[0] - mean density: sum(x_i*rho_i)/sum(x_i) [g/cm3]
131 // mparam[1] - equivalent rad length fraction: sum(x_i/X0_i) [adimensional]
132 // mparam[2] - mean A: sum(x_i*A_i)/sum(x_i) [adimensional]
133 // mparam[3] - mean Z: sum(x_i*Z_i)/sum(x_i) [adimensional]
134 // mparam[4] - length: sum(x_i) [cm]
135 // mparam[5] - Z/A mean: sum(x_i*Z_i/A_i)/sum(x_i) [adimensional]
136 // mparam[6] - number of boundary crosses
138 // Origin: Marian Ivanov, Marian.Ivanov@cern.ch
140 // Corrections and improvements by
141 // Andrea Dainese, Andrea.Dainese@lnl.infn.it,
142 // Andrei Gheata, Andrei.Gheata@cern.ch
145 mparam[0]=0; mparam[1]=1; mparam[2] =0; mparam[3] =0;
146 mparam[4]=0; mparam[5]=0; mparam[6]=0;
148 Double_t bparam[6]; // total parameters
149 Double_t lparam[6]; // local parameters
151 for (Int_t i=0;i<6;i++) bparam[i]=0;
154 AliFatalClass("No TGeo\n");
160 length = TMath::Sqrt((end[0]-start[0])*(end[0]-start[0])+
161 (end[1]-start[1])*(end[1]-start[1])+
162 (end[2]-start[2])*(end[2]-start[2]));
164 if (length<TGeoShape::Tolerance()) return 0.0;
165 Double_t invlen = 1./length;
166 dir[0] = (end[0]-start[0])*invlen;
167 dir[1] = (end[1]-start[1])*invlen;
168 dir[2] = (end[2]-start[2])*invlen;
170 // Initialize start point and direction
171 TGeoNode *currentnode = 0;
172 TGeoNode *startnode = gGeoManager->InitTrack(start, dir);
174 AliErrorClass(Form("start point out of geometry: x %f, y %f, z %f",
175 start[0],start[1],start[2]));
178 TGeoMaterial *material = startnode->GetVolume()->GetMedium()->GetMaterial();
179 lparam[0] = material->GetDensity();
180 lparam[1] = material->GetRadLen();
181 lparam[2] = material->GetA();
182 lparam[3] = material->GetZ();
184 lparam[5] = lparam[3]/lparam[2];
185 if (material->IsMixture()) {
186 TGeoMixture * mixture = (TGeoMixture*)material;
189 for (Int_t iel=0;iel<mixture->GetNelements();iel++){
190 sum += mixture->GetWmixt()[iel];
191 lparam[5]+= mixture->GetZmixt()[iel]*mixture->GetWmixt()[iel]/mixture->GetAmixt()[iel];
196 // Locate next boundary within length without computing safety.
197 // Propagate either with length (if no boundary found) or just cross boundary
198 gGeoManager->FindNextBoundaryAndStep(length, kFALSE);
199 Double_t step = 0.0; // Step made
200 Double_t snext = gGeoManager->GetStep();
201 // If no boundary within proposed length, return current density
202 if (!gGeoManager->IsOnBoundary()) {
203 mparam[0] = lparam[0];
204 mparam[1] = lparam[4]/lparam[1];
205 mparam[2] = lparam[2];
206 mparam[3] = lparam[3];
207 mparam[4] = lparam[4];
210 // Try to cross the boundary and see what is next
212 while (length>TGeoShape::Tolerance()) {
213 currentnode = gGeoManager->GetCurrentNode();
214 if (snext<2.*TGeoShape::Tolerance()) nzero++;
217 // This means navigation has problems on one boundary
218 // Try to cross by making a small step
219 AliErrorClass("Cannot cross boundary\n");
220 mparam[0] = bparam[0]/step;
221 mparam[1] = bparam[1];
222 mparam[2] = bparam[2]/step;
223 mparam[3] = bparam[3]/step;
224 mparam[5] = bparam[5]/step;
226 mparam[0] = 0.; // if crash of navigation take mean density 0
227 mparam[1] = 1000000; // and infinite rad length
228 return bparam[0]/step;
232 bparam[1] += snext/lparam[1];
233 bparam[2] += snext*lparam[2];
234 bparam[3] += snext*lparam[3];
235 bparam[5] += snext*lparam[5];
236 bparam[0] += snext*lparam[0];
238 if (snext>=length) break;
239 if (!currentnode) break;
241 material = currentnode->GetVolume()->GetMedium()->GetMaterial();
242 lparam[0] = material->GetDensity();
243 lparam[1] = material->GetRadLen();
244 lparam[2] = material->GetA();
245 lparam[3] = material->GetZ();
246 lparam[5] = lparam[3]/lparam[2];
247 if (material->IsMixture()) {
248 TGeoMixture * mixture = (TGeoMixture*)material;
251 for (Int_t iel=0;iel<mixture->GetNelements();iel++){
252 sum+= mixture->GetWmixt()[iel];
253 lparam[5]+= mixture->GetZmixt()[iel]*mixture->GetWmixt()[iel]/mixture->GetAmixt()[iel];
257 gGeoManager->FindNextBoundaryAndStep(length, kFALSE);
258 snext = gGeoManager->GetStep();
260 mparam[0] = bparam[0]/step;
261 mparam[1] = bparam[1];
262 mparam[2] = bparam[2]/step;
263 mparam[3] = bparam[3]/step;
264 mparam[5] = bparam[5]/step;
265 return bparam[0]/step;
270 AliTrackerBase::PropagateTrackTo(AliExternalTrackParam *track, Double_t xToGo,
271 Double_t mass, Double_t maxStep, Bool_t rotateTo, Double_t maxSnp, Int_t sign, Bool_t addTimeStep){
272 //----------------------------------------------------------------
274 // Propagates the track to the plane X=xk (cm) using the magnetic field map
275 // and correcting for the crossed material.
277 // mass - mass used in propagation - used for energy loss correction
278 // maxStep - maximal step for propagation
280 // Origin: Marian Ivanov, Marian.Ivanov@cern.ch
282 //----------------------------------------------------------------
283 const Double_t kEpsilon = 0.00001;
284 Double_t xpos = track->GetX();
285 Int_t dir = (xpos<xToGo) ? 1:-1;
287 while ( (xToGo-xpos)*dir > kEpsilon){
288 Double_t step = dir*TMath::Min(TMath::Abs(xToGo-xpos), maxStep);
289 Double_t x = xpos+step;
290 Double_t xyz0[3],xyz1[3],param[7];
291 track->GetXYZ(xyz0); //starting global position
293 Double_t bz=GetBz(xyz0); // getting the local Bz
295 if (!track->GetXYZAt(x,bz,xyz1)) return kFALSE; // no prolongation
296 xyz1[2]+=kEpsilon; // waiting for bug correction in geo
298 if (maxSnp>0 && TMath::Abs(track->GetSnpAt(x,bz)) >= maxSnp) return kFALSE;
299 if (!track->PropagateTo(x,bz)) return kFALSE;
301 MeanMaterialBudget(xyz0,xyz1,param);
302 Double_t xrho=param[0]*param[4], xx0=param[1];
303 if (sign) {if (sign<0) xrho = -xrho;} // sign is imposed
304 else { // determine automatically the sign from direction
305 if (dir>0) xrho = -xrho; // outward should be negative
308 if (!track->CorrectForMeanMaterial(xx0,xrho,mass)) return kFALSE;
310 track->GetXYZ(xyz1); // global position
311 Double_t alphan = TMath::ATan2(xyz1[1], xyz1[0]);
313 if (TMath::Abs(track->GetSnp()) >= maxSnp) return kFALSE;
315 Double_t ca=TMath::Cos(alphan-track->GetAlpha()), sa=TMath::Sin(alphan-track->GetAlpha());
316 Double_t sf=track->GetSnp(), cf=TMath::Sqrt((1.-sf)*(1.+sf));
317 Double_t sinNew = sf*ca - cf*sa;
318 if (TMath::Abs(sinNew) >= maxSnp) return kFALSE;
320 if (!track->AliExternalTrackParam::Rotate(alphan)) return kFALSE;
322 xpos = track->GetX();
323 if (addTimeStep && track->IsStartedTimeIntegral()) {
324 if (!rotateTo) track->GetXYZ(xyz1); // if rotateTo==kTRUE, then xyz1 is already extracted
325 Double_t dX=xyz0[0]-xyz1[0],dY=xyz0[1]-xyz1[1],dZ=xyz0[2]-xyz1[2];
326 Double_t d=TMath::Sqrt(dX*dX + dY*dY + dZ*dZ);
327 if (sign) {if (sign>0) d = -d;} // step sign is imposed, positive means inward direction
328 else { // determine automatically the sign from direction
331 track->AddTimeStep(d);
338 AliTrackerBase::PropagateTrackToBxByBz(AliExternalTrackParam *track,
339 Double_t xToGo,Double_t mass, Double_t maxStep, Bool_t rotateTo, Double_t maxSnp,Int_t sign, Bool_t addTimeStep){
340 //----------------------------------------------------------------
342 // Propagates the track to the plane X=xk (cm)
343 // taking into account all the three components of the magnetic field
344 // and correcting for the crossed material.
346 // mass - mass used in propagation - used for energy loss correction
347 // maxStep - maximal step for propagation
349 // Origin: Marian Ivanov, Marian.Ivanov@cern.ch
351 //----------------------------------------------------------------
352 const Double_t kEpsilon = 0.00001;
353 Double_t xpos = track->GetX();
354 Int_t dir = (xpos<xToGo) ? 1:-1;
356 while ( (xToGo-xpos)*dir > kEpsilon){
357 Double_t step = dir*TMath::Min(TMath::Abs(xToGo-xpos), maxStep);
358 Double_t x = xpos+step;
359 Double_t xyz0[3],xyz1[3],param[7];
360 track->GetXYZ(xyz0); //starting global position
362 Double_t b[3]; GetBxByBz(xyz0,b); // getting the local Bx, By and Bz
364 if (!track->GetXYZAt(x,b[2],xyz1)) return kFALSE; // no prolongation
365 xyz1[2]+=kEpsilon; // waiting for bug correction in geo
367 if (maxSnp>0 && TMath::Abs(track->GetSnpAt(x,b[2])) >= maxSnp) return kFALSE;
368 if (!track->PropagateToBxByBz(x,b)) return kFALSE;
370 MeanMaterialBudget(xyz0,xyz1,param);
371 Double_t xrho=param[0]*param[4], xx0=param[1];
372 if (sign) {if (sign<0) xrho = -xrho;} // sign is imposed
373 else { // determine automatically the sign from direction
374 if (dir>0) xrho = -xrho; // outward should be negative
377 if (!track->CorrectForMeanMaterial(xx0,xrho,mass)) return kFALSE;
379 track->GetXYZ(xyz1); // global position
380 Double_t alphan = TMath::ATan2(xyz1[1], xyz1[0]);
382 if (TMath::Abs(track->GetSnp()) >= maxSnp) return kFALSE;
383 Double_t ca=TMath::Cos(alphan-track->GetAlpha()), sa=TMath::Sin(alphan-track->GetAlpha());
384 Double_t sf=track->GetSnp(), cf=TMath::Sqrt((1.-sf)*(1.+sf));
385 Double_t sinNew = sf*ca - cf*sa;
386 if (TMath::Abs(sinNew) >= maxSnp) return kFALSE;
388 if (!track->AliExternalTrackParam::Rotate(alphan)) return kFALSE;
390 xpos = track->GetX();
391 if (addTimeStep && track->IsStartedTimeIntegral()) {
392 if (!rotateTo) track->GetXYZ(xyz1); // if rotateTo==kTRUE, then xyz1 is already extracted
393 Double_t dX=xyz0[0]-xyz1[0],dY=xyz0[1]-xyz1[1],dZ=xyz0[2]-xyz1[2];
394 Double_t d=TMath::Sqrt(dX*dX + dY*dY + dZ*dZ);
395 if (sign) {if (sign>0) d = -d;} // step sign is imposed, positive means inward direction
396 else { // determine automatically the sign from direction
399 track->AddTimeStep(d);
405 Double_t AliTrackerBase::GetTrackPredictedChi2(AliExternalTrackParam *track,
406 Double_t mass, Double_t step,
407 const AliExternalTrackParam *backup) {
409 // This function brings the "track" with particle "mass" [GeV]
410 // to the same local coord. system and the same reference plane as
411 // of the "backup", doing it in "steps" [cm].
412 // Then, it calculates the 5D predicted Chi2 for these two tracks
414 Double_t chi2=kVeryBig;
415 Double_t alpha=backup->GetAlpha();
416 if (!track->Rotate(alpha)) return chi2;
418 Double_t xb=backup->GetX();
419 Double_t sign=(xb < track->GetX()) ? 1. : -1.;
420 if (!PropagateTrackTo(track,xb,mass,step,kFALSE,kAlmost1,sign)) return chi2;
422 chi2=track->GetPredictedChi2(backup);
430 Double_t AliTrackerBase::MakeC(Double_t x1,Double_t y1,
431 Double_t x2,Double_t y2,
432 Double_t x3,Double_t y3)
434 //-----------------------------------------------------------------
435 // Initial approximation of the track curvature
436 //-----------------------------------------------------------------
442 Double_t det = x3*y2-x2*y3;
443 if (TMath::Abs(det)<1e-10) {
447 Double_t u = 0.5* (x2*(x2-x3)+y2*(y2-y3))/det;
448 Double_t x0 = x3*0.5-y3*u;
449 Double_t y0 = y3*0.5+x3*u;
450 Double_t c2 = 1/TMath::Sqrt(x0*x0+y0*y0);
455 Double_t AliTrackerBase::MakeSnp(Double_t x1,Double_t y1,
456 Double_t x2,Double_t y2,
457 Double_t x3,Double_t y3)
459 //-----------------------------------------------------------------
460 // Initial approximation of the track snp
461 //-----------------------------------------------------------------
467 Double_t det = x3*y2-x2*y3;
468 if (TMath::Abs(det)<1e-10) {
472 Double_t u = 0.5* (x2*(x2-x3)+y2*(y2-y3))/det;
473 Double_t x0 = x3*0.5-y3*u;
474 Double_t y0 = y3*0.5+x3*u;
475 Double_t c2 = 1./TMath::Sqrt(x0*x0+y0*y0);
478 if (y2*x2<0.) x0*=-1;
482 Double_t AliTrackerBase::MakeTgl(Double_t x1,Double_t y1,
483 Double_t x2,Double_t y2,
484 Double_t z1,Double_t z2, Double_t c)
486 //-----------------------------------------------------------------
487 // Initial approximation of the tangent of the track dip angle
488 //-----------------------------------------------------------------
493 Double_t d = TMath::Sqrt(x2*x2+y2*y2); // distance straight line
494 if (TMath::Abs(d*c*0.5)>1) return 0;
495 Double_t angle2 = TMath::ASin(d*c*0.5);
496 angle2 = z2*TMath::Abs(c/(angle2*2.));
501 Double_t AliTrackerBase::MakeTgl(Double_t x1,Double_t y1,
502 Double_t x2,Double_t y2,
503 Double_t z1,Double_t z2)
505 //-----------------------------------------------------------------
506 // Initial approximation of the tangent of the track dip angle
507 //-----------------------------------------------------------------
508 return (z1 - z2)/sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
512 AliExternalTrackParam * AliTrackerBase::MakeSeed( AliTrackPoint &point0, AliTrackPoint &point1, AliTrackPoint &point2){
514 // Make Seed - AliExternalTrackParam from input 3 points
515 // returning seed in local frame of point0
517 Double_t xyz0[3]={0,0,0};
518 Double_t xyz1[3]={0,0,0};
519 Double_t xyz2[3]={0,0,0};
520 Double_t alpha=point0.GetAngle();
521 Double_t xyz[3]={point0.GetX(),point0.GetY(),point0.GetZ()};
522 Double_t bxyz[3]; GetBxByBz(xyz,bxyz);
523 Double_t bz = bxyz[2];
525 // get points in frame of point 0
527 AliTrackPoint p0r = point0.Rotate(alpha);
528 AliTrackPoint p1r = point1.Rotate(alpha);
529 AliTrackPoint p2r = point2.Rotate(alpha);
540 // make covariance estimate
543 Double_t param[5]={0,0,0,0,0};
544 for (Int_t m=0; m<15; m++) covar[m]=0;
546 // calculate intitial param
549 param[2]=MakeSnp(xyz0[0],xyz0[1],xyz1[0],xyz1[1],xyz2[0],xyz2[1]);
550 param[4]=MakeC(xyz0[0],xyz0[1],xyz1[0],xyz1[1],xyz2[0],xyz2[1]);
551 param[3]=MakeTgl(xyz0[0],xyz0[1],xyz1[0],xyz1[1],xyz0[2],xyz1[2],param[4]);
553 //covariance matrix - only diagonal elements
554 //Double_t dist=p0r.GetX()-p2r.GetX();
556 covar[0]= p0r.GetCov()[3];
557 covar[2]= p0r.GetCov()[5];
559 deltaP= (MakeSnp(xyz0[0],xyz0[1]+TMath::Sqrt(p0r.GetCov()[3]),xyz1[0],xyz1[1],xyz2[0],xyz2[1])-param[2]);
560 covar[5]+= deltaP*deltaP;
561 deltaP= (MakeSnp(xyz0[0],xyz0[1],xyz1[0],xyz1[1]+TMath::Sqrt(p1r.GetCov()[3]),xyz2[0],xyz2[1])-param[2]);
562 covar[5]+= deltaP*deltaP;
563 deltaP= (MakeSnp(xyz0[0],xyz0[1],xyz1[0],xyz1[1],xyz2[0],xyz2[1]+TMath::Sqrt(p1r.GetCov()[3]))-param[2]);
564 covar[5]+= deltaP*deltaP;
567 deltaP=MakeTgl(xyz0[0],xyz0[1],xyz1[0],xyz1[1],xyz0[2]+TMath::Sqrt(p1r.GetCov()[5]),xyz1[2],param[4])-param[3];
568 covar[9]+= deltaP*deltaP;
569 deltaP=MakeTgl(xyz0[0],xyz0[1],xyz1[0],xyz1[1],xyz0[2],xyz1[2]+TMath::Sqrt(p1r.GetCov()[5]),param[4])-param[3];
570 covar[9]+= deltaP*deltaP;
573 deltaP=MakeC(xyz0[0],xyz0[1]+TMath::Sqrt(p0r.GetCov()[3]),xyz1[0],xyz1[1],xyz2[0],xyz2[1])-param[4];
574 covar[14]+= deltaP*deltaP;
575 deltaP=MakeC(xyz0[0],xyz0[1],xyz1[0],xyz1[1]+TMath::Sqrt(p1r.GetCov()[3]),xyz2[0],xyz2[1])-param[4];
576 covar[14]+= deltaP*deltaP;
577 deltaP=MakeC(xyz0[0],xyz0[1],xyz1[0],xyz1[1],xyz2[0],xyz2[1]+TMath::Sqrt(p2r.GetCov()[3]))-param[4];
578 covar[14]+= deltaP*deltaP;
580 covar[14]/=(bz*kB2C)*(bz*kB2C);
581 param[4]/=(bz*kB2C); // transform to 1/pt
582 AliExternalTrackParam * trackParam = new AliExternalTrackParam(xyz0[0],alpha,param, covar);
584 // consistency check -to put warnings here
585 // small disagrement once Track extrapolation used
586 // nice agreement in seeds with MC track parameters - problem in extrapoloation - to be fixed
588 Double_t y1,y2,z1,z2;
589 trackParam->GetYAt(xyz1[0],bz,y1);
590 trackParam->GetZAt(xyz1[0],bz,z1);
591 trackParam->GetYAt(xyz2[0],bz,y2);
592 trackParam->GetZAt(xyz2[0],bz,z2);
593 if (TMath::Abs(y1-xyz1[1])> TMath::Sqrt(p1r.GetCov()[3]*5)){
594 AliWarningClass("Seeding problem y1\n");
596 if (TMath::Abs(y2-xyz2[1])> TMath::Sqrt(p2r.GetCov()[3]*5)){
597 AliWarningClass("Seeding problem y2\n");
599 if (TMath::Abs(z1-xyz1[2])> TMath::Sqrt(p1r.GetCov()[5]*5)){
600 AliWarningClass("Seeding problem z1\n");
606 Double_t AliTrackerBase::FitTrack(AliExternalTrackParam * trackParam, AliTrackPointArray *pointArray, Double_t mass, Double_t maxStep){
608 // refit the track - trackParam using the points in point array
610 const Double_t kMaxSnp=0.99;
611 if (!trackParam) return 0;
612 Int_t npoints=pointArray->GetNPoints();
613 AliTrackPoint point,point2;
614 Double_t pointPos[2]={0,0};
615 Double_t pointCov[3]={0,0,0};
616 // choose coordinate frame
617 // in standard way the coordinate frame should be changed point by point
618 // Some problems with rotation observed
619 // rotate method of AliExternalTrackParam should be revisited
620 pointArray->GetPoint(point,0);
621 pointArray->GetPoint(point2,npoints-1);
622 Double_t alpha=TMath::ATan2(point.GetY()-point2.GetY(), point.GetX()-point2.GetX());
624 for (Int_t ipoint=npoints-1; ipoint>0; ipoint-=1){
625 pointArray->GetPoint(point,ipoint);
626 AliTrackPoint pr = point.Rotate(alpha);
627 trackParam->Rotate(alpha);
628 Bool_t status = PropagateTrackTo(trackParam,pr.GetX(),mass,maxStep,kFALSE,kMaxSnp);
630 AliWarningClass("Problem to propagate\n");
633 if (TMath::Abs(trackParam->GetSnp())>kMaxSnp){
634 AliWarningClass("sin(phi) > kMaxSnp \n");
637 pointPos[0]=pr.GetY();//local y
638 pointPos[1]=pr.GetZ();//local z
639 pointCov[0]=pr.GetCov()[3];//simay^2
640 pointCov[1]=pr.GetCov()[4];//sigmayz
641 pointCov[2]=pr.GetCov()[5];//sigmaz^2
642 trackParam->Update(pointPos,pointCov);
649 void AliTrackerBase::UpdateTrack(AliExternalTrackParam &track1, const AliExternalTrackParam &track2){
651 // Update track 1 with track 2
655 TMatrixD vecXk(5,1); // X vector
656 TMatrixD covXk(5,5); // X covariance
657 TMatrixD matHk(5,5); // vector to mesurement
658 TMatrixD measR(5,5); // measurement error
659 TMatrixD vecZk(5,1); // measurement
661 TMatrixD vecYk(5,1); // Innovation or measurement residual
662 TMatrixD matHkT(5,5);
663 TMatrixD matSk(5,5); // Innovation (or residual) covariance
664 TMatrixD matKk(5,5); // Optimal Kalman gain
665 TMatrixD mat1(5,5); // update covariance matrix
666 TMatrixD covXk2(5,5); //
667 TMatrixD covOut(5,5);
669 Double_t *param1=(Double_t*) track1.GetParameter();
670 Double_t *covar1=(Double_t*) track1.GetCovariance();
671 Double_t *param2=(Double_t*) track2.GetParameter();
672 Double_t *covar2=(Double_t*) track2.GetCovariance();
674 // copy data to the matrix
675 for (Int_t ipar=0; ipar<5; ipar++){
676 for (Int_t jpar=0; jpar<5; jpar++){
677 covXk(ipar,jpar) = covar1[track1.GetIndex(ipar, jpar)];
678 measR(ipar,jpar) = covar2[track2.GetIndex(ipar, jpar)];
682 vecXk(ipar,0) = param1[ipar];
683 vecZk(ipar,0) = param2[ipar];
692 vecYk = vecZk-matHk*vecXk; // Innovation or measurement residual
693 matHkT=matHk.T(); matHk.T();
694 matSk = (matHk*(covXk*matHkT))+measR; // Innovation (or residual) covariance
696 matKk = (covXk*matHkT)*matSk; // Optimal Kalman gain
697 vecXk += matKk*vecYk; // updated vector
698 covXk2 = (mat1-(matKk*matHk));
699 covOut = covXk2*covXk;
703 // copy from matrix to parameters
716 for (Int_t ipar=0; ipar<5; ipar++){
717 param1[ipar]= vecXk(ipar,0) ;
718 for (Int_t jpar=0; jpar<5; jpar++){
719 covar1[track1.GetIndex(ipar, jpar)]=covOut(ipar,jpar);