Index: trunk/MagicSoft/Mars/mhbase/MH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH.cc	(revision 8700)
+++ trunk/MagicSoft/Mars/mhbase/MH.cc	(revision 8709)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.35 2007-08-22 18:22:49 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.36 2007-08-25 15:30:24 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -1398,4 +1398,10 @@
         //const Double_t rc = ((1-2*w)*e1*e1+w*w*e2*e2)/(b2*b2);
 
+        if (b2==0)
+        {
+            hres.SetBinError(binx, 0);
+            continue;
+        }
+
         const Double_t c = c2==0 ? 1 : c1/c2;
         const Double_t u = b2==0 ? 0 : b1/b2;
Index: trunk/MagicSoft/Mars/mhbase/MH3.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH3.cc	(revision 8700)
+++ trunk/MagicSoft/Mars/mhbase/MH3.cc	(revision 8709)
@@ -574,4 +574,14 @@
 }
 
+void MH3::HandleLogAxis(TAxis &axe) const
+{
+    if (axe.GetXmax()>3000*axe.GetXmin())
+        return;
+
+    axe.SetMoreLogLabels();
+    if (axe.GetXmax()<5000)
+        axe.SetNoExponent();
+}
+
 // --------------------------------------------------------------------------
 //
@@ -582,5 +592,6 @@
 //   PROFY: Draw a y-profile into the histogram (for 2D histograms only)
 //   ONLY:  Draw the profile histogram only (for 2D histograms only)
-//   BLUE:  Draw the profile in blue color instead of the histograms line color
+//   BLUE:  Draw the profile in blue color instead of the histograms
+//          line color
 //
 // If the kIsLog?-Bit is set the axis is displayed lkogarithmically.
@@ -597,7 +608,19 @@
     pad->SetGridy();
 
-    if (fHist->TestBit(kIsLogx)) pad->SetLogx();
-    if (fHist->TestBit(kIsLogy)) pad->SetLogy();
-    if (fHist->TestBit(kIsLogz)) pad->SetLogz();
+    if (fHist->TestBit(kIsLogx))
+    {
+        pad->SetLogx();
+        HandleLogAxis(*fHist->GetXaxis());
+    }
+    if (fHist->TestBit(kIsLogy))
+    {
+        pad->SetLogy();
+        HandleLogAxis(*fHist->GetYaxis());
+    }
+    if (fHist->TestBit(kIsLogz))
+    {
+        pad->SetLogz();
+        HandleLogAxis(*fHist->GetZaxis());
+    }
 
     fHist->SetFillStyle(4000);
Index: trunk/MagicSoft/Mars/mhbase/MH3.h
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH3.h	(revision 8700)
+++ trunk/MagicSoft/Mars/mhbase/MH3.h	(revision 8709)
@@ -27,4 +27,6 @@
     Double_t    fScale[3];       // Scale for the three axis (eg unit)
     Byte_t      fStyleBits;      // Set the range of a histogram automatically in Finalize
+
+    void HandleLogAxis(TAxis &axe) const;
 
     void StreamPrimitive(ostream &out) const;
Index: trunk/MagicSoft/Mars/mhbase/MHn.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MHn.cc	(revision 8700)
+++ trunk/MagicSoft/Mars/mhbase/MHn.cc	(revision 8709)
@@ -410,31 +410,31 @@
 
         case 2:   // 2
-            pad->Divide(1,2);
+            pad->Divide(1,2, 1e-5, 1e-5);
             break;
         case 3:   // 3
-            pad->Divide(2,2);
+            pad->Divide(2,2, 1e-5, 1e-5);
             delete pad->GetPad(4);
             break;
          case 4:   // 4
-            pad->Divide(2,2);
+            pad->Divide(2,2, 1e-5, 1e-5);
             break;
         case 5:   // 5
-            pad->Divide(3,2);
+            pad->Divide(3,2, 1e-5, 1e-5);
             delete pad->GetPad(6);
             break;
         case 6:   // 6
-            pad->Divide(3,2);
+            pad->Divide(3,2, 1e-5, 1e-5);
             break;
 
         case 12:  // 2
-            pad->Divide(2,1);
+            pad->Divide(2,1, 1e-5, 1e-5);
             break;
         case 13:  // 3
             break;
         case 14:  // 4
-            pad->Divide(2,2);
+            pad->Divide(2,2, 1e-5, 1e-5);
             break;
         case 15:  // 5
-            pad->Divide(2,3);
+            pad->Divide(2,3, 1e-5, 1e-5);
             pad->GetPad(4)->SetPad(0.51, 0.01, 0.99, 0.65);
             delete pad->GetPad(6);
