+
+
+ if(!uUi3by3) {
+ // matrix to go from global (x,y,z) to local (y,z);
+ TMatrixD qQi(2,3);
+ qQi(0,0) = -sinRot;
+ qQi(0,1) = cosRot;
+ qQi(0,2) = 0.;
+ qQi(1,0) = 0.;
+ qQi(1,1) = 0.;
+ qQi(1,2) = 1.;
+
+ // covariance matrix of local (y,z) - inverted
+ TMatrixD uUi(2,2);
+ uUi(0,0) = t->GetSigmaY2();
+ uUi(0,1) = t->GetSigmaZY();
+ uUi(1,0) = t->GetSigmaZY();
+ uUi(1,1) = t->GetSigmaZ2();
+ //printf(" Ui :\n");
+ //printf(" %f %f\n",uUi(0,0),uUi(0,1));
+ //printf(" %f %f\n",uUi(1,0),uUi(1,1));
+
+ if(uUi.Determinant() <= 0.) return kFALSE;
+ TMatrixD uUiInv(TMatrixD::kInverted,uUi);
+
+ // weights matrix: wWi = qQiT * uUiInv * qQi
+ TMatrixD uUiInvQi(uUiInv,TMatrixD::kMult,qQi);
+ TMatrixD m(qQi,TMatrixD::kTransposeMult,uUiInvQi);
+ wWi = m;
+ } else {
+ if(fVert.GetNContributors()<1) AliFatal("Vertex from finder is empty");
+ // matrix to go from global (x,y,z) to local (x,y,z);
+ TMatrixD qQi(3,3);
+ qQi(0,0) = cosRot;
+ qQi(0,1) = sinRot;
+ qQi(0,2) = 0.;
+ qQi(1,0) = -sinRot;
+ qQi(1,1) = cosRot;
+ qQi(1,2) = 0.;
+ qQi(2,0) = 0.;
+ qQi(2,1) = 0.;
+ qQi(2,2) = 1.;
+
+ // covariance of fVert along the track
+ Double_t p[3],pt,ptot;
+ t->GetPxPyPz(p);
+ pt = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
+ ptot = TMath::Sqrt(pt*pt+p[2]*p[2]);
+ Double_t cphi = p[0]/pt; //cos(phi)=px/pt
+ Double_t sphi = p[1]/pt; //sin(phi)=py/pt
+ Double_t clambda = pt/ptot; //cos(lambda)=pt/ptot
+ Double_t slambda = p[2]/ptot; //sin(lambda)=pz/ptot
+ Double_t covfVert[6];
+ fVert.GetCovMatrix(covfVert);
+ Double_t covfVertalongt =
+ covfVert[0]*cphi*cphi*clambda*clambda
+ +covfVert[1]*2.*cphi*sphi*clambda*clambda
+ +covfVert[3]*2.*cphi*clambda*slambda
+ +covfVert[2]*sphi*sphi*clambda*clambda
+ +covfVert[4]*2.*sphi*clambda*slambda
+ +covfVert[5]*slambda*slambda;
+ // covariance matrix of local (x,y,z) - inverted
+ TMatrixD uUi(3,3);
+ uUi(0,0) = covfVertalongt * fnSigmaForUi00 * fnSigmaForUi00;
+ if(fDebug) printf("=====> sqrtUi00 cm %f\n",TMath::Sqrt(uUi(0,0)));
+ uUi(0,1) = 0.;
+ uUi(0,2) = 0.;
+ uUi(1,0) = 0.;
+ uUi(1,1) = t->GetSigmaY2();
+ uUi(1,2) = t->GetSigmaZY();
+ uUi(2,0) = 0.;
+ uUi(2,1) = t->GetSigmaZY();
+ uUi(2,2) = t->GetSigmaZ2();
+ //printf(" Ui :\n");
+ //printf(" %f %f\n",uUi(0,0),uUi(0,1));
+ //printf(" %f %f\n",uUi(1,0),uUi(1,1));