+ // Define space-point refence plane
+ Double_t alphap = p.GetAngle();
+ Double_t sinp = TMath::Sin(alphap);
+ Double_t cosp = TMath::Cos(alphap);
+ Double_t x = p.GetX()*cosp + p.GetY()*sinp;
+ Double_t y = p.GetY()*cosp - p.GetX()*sinp;
+ Double_t x0p= x0*cosp + y0*sinp;
+ Double_t y0p= y0*cosp - x0*sinp;
+ if ((r*r - (x-x0p)*(x-x0p))<0) {
+ AliWarning(Form("Track extrapolation failed ! (Track radius = %f, track circle x = %f, space-point x = %f, reference plane angle = %f\n",r,x0p,x,alphap));
+ return kFALSE;
+ }
+ Double_t temp = TMath::Sqrt(r*r - (x-x0p)*(x-x0p));
+ Double_t y1 = y0p + temp;
+ Double_t y2 = y0p - temp;
+ Double_t yprime = y1;
+ if(TMath::Abs(y2-y) < TMath::Abs(y1-y)) yprime = y2;
+
+ // Back to the global coordinate system
+ Double_t xsecond = x*cosp - yprime*sinp;
+ Double_t ysecond = yprime*cosp + x*sinp;
+
+ // Now Z coordinate and track angles
+ Double_t x2 = xsecond*cos + ysecond*sin;
+ Double_t zsecond = GetZat(x2);
+ Double_t dydx = GetDYat(x2);
+ Double_t dzdx = GetDZat(x2);
+
+ // Fill the cov matrix of the track extrapolation point
+ Double_t cov[6] = {0,0,0,0,0,0};
+ Double_t sigmax = 100*100.;
+ cov[0] = sigmax; cov[1] = sigmax*dydx; cov[2] = sigmax*dzdx;
+ cov[3] = sigmax*dydx*dydx; cov[4] = sigmax*dydx*dzdx;
+ cov[5] = sigmax*dzdx*dzdx;
+
+ Double_t sigmay2 = GetErrY2at(x2);
+ Double_t sigmaz2 = GetErrZ2at(x2);
+ cov[3] += sigmay2;
+ cov[5] += sigmaz2;
+
+
+ Float_t newcov[6];
+ newcov[0] = cov[0]*cos*cos-
+ 2*cov[1]*sin*cos+
+ cov[3]*sin*sin;
+ newcov[1] = cov[1]*(cos*cos-sin*sin)-
+ (cov[3]-cov[0])*sin*cos;
+ newcov[2] = cov[2]*cos-
+ cov[4]*sin;
+ newcov[3] = cov[0]*sin*sin+
+ 2*cov[1]*sin*cos+
+ cov[3]*cos*cos;
+ newcov[4] = cov[4]*cos+
+ cov[2]*sin;
+ newcov[5] = cov[5];
+
+ p2.SetXYZ(xsecond,ysecond,zsecond,newcov);
+ Int_t debugLevel = AliLog::GetDebugLevel("","AliTrackFitterRieman");
+ Float_t debugRatio = 1./(1.+debugLevel);
+ if (AliLog::GetDebugLevel("","AliTrackFitterRieman")>0 && gRandom->Rndm()<debugRatio){
+ AliTrackPoint lp0(p);
+ AliTrackPoint lp2(p2);
+ AliTrackPoint localp0(p);
+ AliTrackPoint localp2(p2);
+ Float_t lAngle = lp0.GetAngle();
+ localp0 = localp0.Rotate(lAngle);
+ localp2 = localp2.Rotate(lAngle);
+
+ (*fDebugStream)<<"PCA"<<
+ "P0.="<<&lp0<< //global position
+ "P2.="<<&lp2<<
+ "LP0.="<<&localp0<< //local position
+ "LP2.="<<&localp2<<
+ "\n";
+ }
+ return kTRUE;
+}