Index: trunk/MagicSoft/Mars/mbase/MMath.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MMath.cc	(revision 4981)
+++ trunk/MagicSoft/Mars/mbase/MMath.cc	(revision 4982)
@@ -126,21 +126,40 @@
 // If the determinant==0 an empty TVector3 is returned.
 //
+#include <iostream>
 TVector3 MMath::GetParab(const TVector3 &x, const TVector3 &y)
 {
-    const TVector3 sq(x(0)*x(0), x(1)*x(1), x(2)*x(2));
+    Double_t x1 = x(0);
+    Double_t x2 = x(1);
+    Double_t x3 = x(2);
 
-    const TVector3 ai2 = sq.Cross(sq);
+    Double_t y1 = y(0);
+    Double_t y2 = y(1);
+    Double_t y3 = y(2);
 
-    const Double_t det = x.Dot(ai2);
+    const double det =
+        + x2*x3*x3 + x1*x2*x2 + x3*x1*x1
+        - x2*x1*x1 - x3*x2*x2 - x1*x3*x3;
+
+
     if (det==0)
         return TVector3();
 
-    const TVector3 ai1 = x.Cross(sq);
-    const TVector3 ai3 = x.Cross(x);
+    const double det1 = 1.0/det;
 
-    TVector3 res(y.Dot(ai1), y.Dot(ai2), y.Dot(ai3));
-    res *= 1./det;
+    const double ai11 = x2*x3*x3 - x3*x2*x2;
+    const double ai12 = x3*x1*x1 - x1*x3*x3;
+    const double ai13 = x1*x2*x2 - x2*x1*x1;
 
-    return res;
+    const double ai21 = x2*x2 - x3*x3;
+    const double ai22 = x3*x3 - x1*x1;
+    const double ai23 = x1*x1 - x2*x2;
+
+    const double ai31 = x3 - x2;
+    const double ai32 = x1 - x3;
+    const double ai33 = x2 - x1;
+
+    return TVector3((ai11*y1 + ai12*y2 + ai13*y3) * det1,
+                    (ai21*y1 + ai22*y2 + ai23*y3) * det1,
+                    (ai31*y1 + ai32*y2 + ai33*y3) * det1);
 }
 
@@ -158,5 +177,5 @@
 
     const TVector3 vx0(l0, l1, l2);
-    return pow(10, InterpolParabLin(vx0, vy, TMath::Log10(x)));
+    return InterpolParabLin(vx0, vy, TMath::Log10(x));
 }
 
@@ -168,4 +187,4 @@
 
     const TVector3 vx0(l0, l1, l2);
-    return TMath::ACos(InterpolParabLin(vx0, vy, TMath::Cos(x)));
+    return InterpolParabLin(vx0, vy, TMath::Cos(x));
 }
