Index: /trunk/MagicSoft/Mars/manalysis/MHillas.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MHillas.cc	(revision 700)
+++ /trunk/MagicSoft/Mars/manalysis/MHillas.cc	(revision 701)
@@ -55,6 +55,6 @@
 
     fEllipse = new TEllipse(cos(fTheta)*fDist, sin(fTheta)*fDist,
-                            fWidth, fLength,
-                            0, 360, fAlpha);
+                            fLength, fWidth,
+                            0, 360, fTheta*kRad2Deg+fAlpha-180);
 
     fEllipse->SetLineWidth(2);
@@ -137,12 +137,7 @@
     float s = sin(theta); // [1]
 
-    const float direction = c*xmean + s*ymean;
-
-    if (direction<0)
-    {
-        c = -c;
-        s = -s;
-    }
-
+    //
+    // resolve four-fold ambiguity of solution
+    //
     float axis1 =  2.0*c*s*sigmaxy + c*c*sigmaxx + s*s*sigmayy; // [mm^2]
     float axis2 = -2.0*c*s*sigmaxy + s*s*sigmaxx + c*c*sigmayy; // [mm^2]
@@ -158,16 +153,22 @@
 
     //
-    // check the rotation of the axis
+    // check the rotation of the axis (maybe turn by 90ø)
     //
-    const int rotation = axis1<axis2;
+    const int   rotation = axis1<axis2;
 
-    fLength = rotation ? sqrt(axis2) : sqrt(axis1);      // [mm]
-    fWidth  = rotation ? sqrt(axis1) : sqrt(axis2);      // [mm]
+    fLength = rotation ? sqrt(axis2) : sqrt(axis1);     // [mm]
+    fWidth  = rotation ? sqrt(axis1) : sqrt(axis2);     // [mm]
 
-    fAlpha = 180/kPI*atan((-xmean*s+ymean*c)/direction); // [deg]
+    fAlpha  = rotation ?
+        fabs(atan((-xmean*c - ymean*s)/(c*ymean - s*xmean))) :
+        fabs(atan(( ymean*c - xmean*s)/(c*xmean + s*ymean))) ;
 
-    fDist  = sqrt(xmean*xmean + ymean*ymean);            // [mm]
+        // [deg]
 
-    fTheta = atan(ymean/xmean);                          // [rad]
-    if (xmean<0) fTheta += kPI;                          // [deg]
+    fAlpha *= kRad2Deg;                                  // [deg]
+
+    fDist   = sqrt(xmean*xmean + ymean*ymean);           // [mm]
+
+    fTheta  = atan(ymean/xmean);                         // [rad]
+    if (xmean<0) fTheta += kPI;                          // [rad]
 }
