]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITStrackerSA.cxx
load AddTaskEmcalJet.C
[u/mrichter/AliRoot.git] / ITS / AliITStrackerSA.cxx
index 198d9ab0b7a114fbad37ce6bf05f566b9d45450d..ea8abebb330c94bfd3515b6d7877e8c36e4c35eb 100644 (file)
@@ -776,11 +776,18 @@ Int_t AliITStrackerSA::FindEquation(Double_t x1, Double_t y1, Double_t x2, Doubl
 
    //given (x,y) of three recpoints (in global coordinates) 
    //returns the parameters a,b,c of circonference x*x + y*y +a*x + b*y +c
-
-   Double_t den = (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1);
+   double dx31=x3-x1,dy31=y3-y1,dx21=x2-x1,dy21=y2-y1;
+   Double_t den = dx31*dy21-dx21*dy31;
    if(den==0) return 0;
-   a = ((y3-y1)*(x2*x2+y2*y2-x1*x1-y1*y1)-(y2-y1)*(x3*x3+y3*y3-x1*x1-y1*y1))/den;
-   b = -(x2*x2-x1*x1+y2*y2-y1*y1+a*(x2-x1))/(y2-y1);
+   else den = 1./den;
+   //
+   double r31 = -dx31*(x1+x3) - dy31*(y1+y3);
+   double r21 = -dx21*(x1+x2) - dy21*(y1+y2);
+   //
+   double da = r31*dy21 - r21*dy31;
+   double db = r21*dx31 - r31*dx21;
+   a = da*den;
+   b = db*den;
    c = -x1*x1-y1*y1-a*x1-b*y1;
    return 1;
  }
@@ -1045,9 +1052,9 @@ void AliITStrackerSA::GetCoorErrors(AliITSRecPoint* cl,Double_t &sx,Double_t &sy
 Int_t AliITStrackerSA::FindIndex(Int_t lay, Double_t lamVal) const {
   // Find the cluster at limit of lambda window 
 
-
   Int_t base = 0;
   Int_t last = fCluCoord[lay]->GetEntriesFast()-1;
+  if(last<0) return 0;
   Int_t position;
   Double_t lamfirst=((AliITSclusterTable*)fCluCoord[lay]->At(base))->GetLambda();
   if(lamfirst>lamVal) return base;
@@ -1061,6 +1068,6 @@ Int_t AliITStrackerSA::FindIndex(Int_t lay, Double_t lamVal) const {
     if(a>0) last = position;
     else  base = position;
   }
-  return -1;
+  return 0;
 }