Index: trunk/MagicSoft/Mars/mhbase/MBinning.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MBinning.cc	(revision 8669)
+++ trunk/MagicSoft/Mars/mhbase/MBinning.cc	(revision 8679)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MBinning.cc,v 1.17 2006-10-17 17:16:00 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MBinning.cc,v 1.18 2007-08-19 21:35:00 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -134,4 +134,16 @@
 // --------------------------------------------------------------------------
 //
+// Initialize Binning from TArrayD.
+//
+MBinning::MBinning(const TArrayD &axis, const char *name, const char *title)
+{
+    fName  = name  ? name : gsDefName.Data();
+    fTitle = title ? title : gsDefTitle.Data();
+
+    SetEdges(axis);
+}
+
+// --------------------------------------------------------------------------
+//
 // Search in the parameter list for the binning with name "name". If found,
 // set the edges and title accordingly. Default is name of object.
Index: trunk/MagicSoft/Mars/mhbase/MBinning.h
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MBinning.h	(revision 8669)
+++ trunk/MagicSoft/Mars/mhbase/MBinning.h	(revision 8679)
@@ -43,4 +43,5 @@
     MBinning(const TH1 &h, const Char_t axis='x', const char *name=0, const char *title=0);
     MBinning(const TAxis &a, const char *name=0, const char *title=0);
+    MBinning(const TArrayD &a, const char *name=0, const char *title=0);
 
     void Copy(TObject &named) const
Index: trunk/MagicSoft/Mars/mhbase/MH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH.cc	(revision 8669)
+++ trunk/MagicSoft/Mars/mhbase/MH.cc	(revision 8679)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.33 2007-08-06 14:44:13 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.34 2007-08-19 21:36:00 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -20,5 +20,5 @@
 !   Author(s): Thomas Bretz  07/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2007
 !
 !
@@ -1409,4 +1409,37 @@
 // --------------------------------------------------------------------------
 //
+// Return the first and last bin of the histogram which is not 0
+//
+void MH::GetRange(const TH1 &h, Int_t &lo, Int_t &hi)
+{
+    lo = 0;
+    hi = 1;
+
+    for (int i=2; i<=h.GetNbinsX(); i++)
+    {
+        if (lo==0 && h.GetBinContent(i)>0)
+            lo = i;
+
+        if (h.GetBinContent(i)>0)
+            hi = i;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the lower edge of the first and the upper edge of the last bin
+// of the histogram which is not 0
+//
+void MH::GetRangeUser(const TH1 &h, Axis_t &lo, Axis_t &hi)
+{
+    Int_t f, l;
+    GetRange(h, f, l);
+
+    lo = h.GetBinLowEdge(f);
+    hi = h.GetBinLowEdge(l+1);
+}
+
+// --------------------------------------------------------------------------
+//
 // See MTask::PrintSkipped
 //
Index: trunk/MagicSoft/Mars/mhbase/MH.h
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH.h	(revision 8669)
+++ trunk/MagicSoft/Mars/mhbase/MH.h	(revision 8679)
@@ -119,4 +119,7 @@
     static void ProjectionY(TH1D &dest, const TH2 &src, Int_t firstxbin=-1, Int_t lastxbin=9999);
 
+    static void GetRangeUser(const TH1 &hist, Axis_t &lo, Axis_t &hi);
+    static void GetRange(const TH1 &hist, Int_t &lo, Int_t &hi);
+
     static TObject *FindObjectInPad(const char *name, TVirtualPad *pad=NULL);
 
