Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 8695)
+++ trunk/MagicSoft/Mars/Changelog	(revision 8696)
@@ -62,4 +62,9 @@
    * mmuon/MHMuonPar.cc:
      - enable all grids
+
+   * mimage/MNewImagePar.cc:
+     - Set fConcCOG to 0 if smaller 0. This produces at least a defined
+       value (-inf) when the logarithm is calculated, which is better
+       than an undefined one (NaN).
 
 
Index: trunk/MagicSoft/Mars/mhbase/MH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH.cc	(revision 8695)
+++ trunk/MagicSoft/Mars/mhbase/MH.cc	(revision 8696)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.34 2007-08-19 21:36:00 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.35 2007-08-22 18:22:49 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -1416,5 +1416,5 @@
     hi = 1;
 
-    for (int i=2; i<=h.GetNbinsX(); i++)
+    for (int i=1; i<=h.GetNbinsX(); i++)
     {
         if (lo==0 && h.GetBinContent(i)>0)
@@ -1438,4 +1438,75 @@
     lo = h.GetBinLowEdge(f);
     hi = h.GetBinLowEdge(l+1);
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the first and last column (x-bin) of the histogram which is not 0.
+// Therefor a proper projection is produced if the argument is a TH2.
+//
+// TH3 are not yet supported
+//
+void MH::GetRangeX(const TH1 &hist, Int_t &lo, Int_t &hi)
+{
+    if (hist.InheritsFrom(TH3::Class()))
+        return;
+
+    if (hist.InheritsFrom(TH2::Class()))
+    {
+        TH1 *pro = static_cast<const TH2&>(hist).ProjectionX();
+        GetRange(*pro, lo, hi);
+        delete pro;
+        return;
+    }
+
+    GetRange(hist, lo, hi);
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the first and last row (y-bin) of the histogram which is not 0.
+// Therefor a proper projection is produced if the argument is a TH2.
+//
+// TH3 are not yet supported
+//
+void MH::GetRangeY(const TH1 &hist, Int_t &lo, Int_t &hi)
+{
+    if (hist.InheritsFrom(TH3::Class()))
+        return;
+
+    if (hist.InheritsFrom(TH2::Class()))
+    {
+        TH1 *pro = static_cast<const TH2&>(hist).ProjectionY();
+        GetRange(*pro, lo, hi);
+        delete pro;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the lower edge of the first and the upper edge of the last bin
+// of the histogram h returned by GetRangeX
+//
+void MH::GetRangeUserX(const TH1 &h, Axis_t &lo, Axis_t &hi)
+{
+    Int_t f, l;
+    GetRangeX(h, f, l);
+
+    lo = h.GetXaxis()->GetBinLowEdge(f);
+    hi = h.GetXaxis()->GetBinLowEdge(l+1);
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the lower edge of the first and the upper edge of the last bin
+// of the histogram h returned by GetRangeY
+//
+void MH::GetRangeUserY(const TH1 &h, Axis_t &lo, Axis_t &hi)
+{
+    Int_t f, l;
+    GetRangeY(h, f, l);
+
+    lo = h.GetYaxis()->GetBinLowEdge(f);
+    hi = h.GetYaxis()->GetBinLowEdge(l+1);
 }
 
Index: trunk/MagicSoft/Mars/mhbase/MH.h
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH.h	(revision 8695)
+++ trunk/MagicSoft/Mars/mhbase/MH.h	(revision 8696)
@@ -120,9 +120,13 @@
 
     static void GetRangeUser(const TH1 &hist, Axis_t &lo, Axis_t &hi);
+    static void GetRangeUserX(const TH1 &hist, Axis_t &lo, Axis_t &hi);
+    static void GetRangeUserY(const TH1 &hist, Axis_t &lo, Axis_t &hi);
     static void GetRange(const TH1 &hist, Int_t &lo, Int_t &hi);
+    static void GetRangeX(const TH1 &hist, Int_t &lo, Int_t &hi);
+    static void GetRangeY(const TH1 &hist, Int_t &lo, Int_t &hi);
 
     static TObject *FindObjectInPad(const char *name, TVirtualPad *pad=NULL);
 
-    static void SetPalette(TString paletteName, Int_t ncol=50);
+    static void SetPalette(TString paletteName="pretty", Int_t ncol=50);
 
     ClassDef(MH, 2) //A base class for Mars histograms
