]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliTrackFitterKalman.cxx
Replaced AliInfo with AliDebug
[u/mrichter/AliRoot.git] / STEER / AliTrackFitterKalman.cxx
index 2266395b035609d49f4a727842cee426d7cbe0f5..71523b3d76c1566f240c886d09b69e34402a020e 100755 (executable)
@@ -32,7 +32,7 @@
 #include <TMatrixD.h>
 #include <TMatrixDSym.h>
 
-//#include "AliLog.h"
+#include "AliLog.h"
 #include "AliTrackFitterKalman.h"
 
 ClassImp(AliTrackFitterKalman)
@@ -42,8 +42,7 @@ const Double_t AliTrackFitterKalman::fgkMaxChi2=33.;
 AliTrackFitterKalman::
 AliTrackFitterKalman(AliTrackPointArray *array, Bool_t owner):
   AliTrackFitter(array,owner),
-  fMaxChi2(fgkMaxChi2),
-  fSeed(kFALSE)
+  fMaxChi2(fgkMaxChi2)
 {
   //
   // Constructor
@@ -55,7 +54,7 @@ Bool_t AliTrackFitterKalman::Begin(Int_t first, Int_t last) {
   // Make a seed out of the track points with the indices "first" and "last". 
   // This is the "default" seed.
   //
-  if (fSeed) return kTRUE;
+  fPoints->Sort();
   AliTrackPoint fp,lp;
   fPoints->GetPoint(fp,first); fPoints->GetPoint(lp,last);
   return MakeSeed(&fp,&lp);
@@ -69,17 +68,19 @@ MakeSeed(const AliTrackPoint *p0, const AliTrackPoint *p1) {
   //
   Double_t x0=p0->GetX(), y0=p0->GetY(), z0=p0->GetZ();
   Double_t dx=p1->GetX()-x0, dy=p1->GetY()-y0, dz=p1->GetZ()-z0;
+  if (dy==0.) { 
+     AliError("Seeds perpendicular to Y axis are not allowed !"); 
+     return kFALSE; 
+  }
   Double_t vx=dx/dy;
   Double_t vz=dz/dy;
   Double_t par[5]={x0,y0,z0,vx,vz};
 
   const Float_t *cv0=p0->GetCov();
   const Float_t *cv1=p1->GetCov();
-  Double_t rdx2=(cv0[0]+cv1[0])/dx/dx;
   Double_t rdy2=(cv0[3]+cv1[3])/dy/dy;
-  Double_t rdz2=(cv0[5]+cv1[5])/dz/dz;
-  Double_t svx2=vx*vx*(rdx2+rdy2);     
-  Double_t svz2=vz*vz*(rdz2+rdy2);     
+  Double_t svx2=(cv0[0]+cv1[0])/dy/dy + vx*vx*rdy2;     
+  Double_t svz2=(cv0[5]+cv1[5])/dy/dy + vz*vz*rdy2;     
   Double_t cov[15]={
      cv0[0],
      cv0[1],cv0[3],
@@ -179,6 +180,7 @@ Bool_t AliTrackFitterKalman::Update(const AliTrackPoint *p, Double_t chi2) {
   v(0,0)=cov[0]+c(0,0); v(0,1)=cov[1]+c(0,1); v(0,2)=cov[2]+c(0,2);
   v(1,0)=cov[1]+c(1,0); v(1,1)=cov[3]+c(1,1); v(1,2)=cov[4]+c(1,2);
   v(2,0)=cov[2]+c(2,0); v(2,1)=cov[4]+c(2,1); v(2,2)=cov[5]+c(2,2);
+  if (TMath::Abs(v.Determinant()) < 1.e-33) return kFALSE;
   v.Invert();
 
   TMatrixD ch(5,3);
@@ -267,6 +269,7 @@ Bool_t AliTrackFitterKalman::GetPCA(const AliTrackPoint &p, AliTrackPoint &i) co
 
   TMatrixDSym tmW(tC);
   tmW+=mC;
+  if (TMath::Abs(tmW.Determinant()) < 1.e-33) return kFALSE;
   tmW.Invert();
 
   TMatrixD mW(tC,TMatrixD::kMult,tmW);
@@ -324,5 +327,4 @@ AliTrackFitterKalman::SetSeed(const Double_t par[5], const Double_t cov[15]) {
   cv(0,3)=cv(3,0); cv(1,3)=cv(3,1); cv(2,3)=cv(3,2);
   cv(0,4)=cv(4,0); cv(1,4)=cv(4,1); cv(2,4)=cv(4,2); cv(3,4)=cv(4,3);
 
-  fSeed=kTRUE;
 }