Index: trunk/MagicSoft/Mars/mhist/MBinning.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MBinning.cc	(revision 2112)
+++ trunk/MagicSoft/Mars/mhist/MBinning.cc	(revision 2117)
@@ -16,7 +16,7 @@
 !
 !
-!   Author(s): Thomas Bretz  01/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Author(s): Thomas Bretz, 01/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
 !
 !
@@ -30,4 +30,5 @@
 #include "MBinning.h"
 
+#include <ctype.h>      // tolower
 #include <fstream.h>
 
@@ -60,4 +61,36 @@
 
     fType = kIsDefault;
+}
+
+void MBinning::SetEdges(const TAxis &axe)
+{
+    const TArrayD &arr = *((TAxis&)axe).GetXbins();
+    if (arr.GetSize()>0)
+    {
+        SetEdges(arr);
+        return;
+    }
+
+    SetEdges(axe.GetNbins(), axe.GetXmin(), axe.GetXmax());
+}
+
+void MBinning::SetEdges(const TH1 &h, const Char_t axis='x')
+{
+    TH1 &hist = (TH1&)h; // get rid of const qualifier
+    switch (tolower(axis))
+    {
+    case 'x':
+        SetEdges(*hist.GetXaxis());
+        return;
+    case 'y':
+        SetEdges(*hist.GetYaxis());
+        return;
+    case 'z':
+        SetEdges(*hist.GetZaxis());
+        return;
+    default:
+        *fLog << warn << "MBinning::SetEdges: Axis '" << axis << "' unknown... using x." << endl;
+        SetEdges(*hist.GetXaxis());
+    }
 }
 
Index: trunk/MagicSoft/Mars/mhist/MBinning.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MBinning.h	(revision 2112)
+++ trunk/MagicSoft/Mars/mhist/MBinning.h	(revision 2117)
@@ -7,8 +7,9 @@
 
 #ifndef ROOT_TArrayD
-#include "TArrayD.h"
+#include <TArrayD.h>
 #endif
 
 class TH1;
+class TAxis;
 
 class MBinning : public MParContainer
@@ -38,4 +39,6 @@
     }
 
+    void SetEdges(const TAxis &axe);
+    void SetEdges(const TH1 &h, const Char_t axis='x');
     void SetEdges(const Int_t nbins, const Axis_t lo, Axis_t up);
     void SetEdgesLog(const Int_t nbins, const Axis_t lo, Axis_t up);
Index: trunk/MagicSoft/Mars/mhist/MFillH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 2112)
+++ trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 2117)
@@ -341,4 +341,7 @@
         return kTRUE;
 
+    if (TestBit(kDoNotDisplay))
+        return kTRUE;
+
     fCanvas = &fDisplay->AddTab(fH->GetName());
     fH->Draw();
Index: trunk/MagicSoft/Mars/mhist/MFillH.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MFillH.h	(revision 2112)
+++ trunk/MagicSoft/Mars/mhist/MFillH.h	(revision 2117)
@@ -16,4 +16,9 @@
 class MFillH : public MTask
 {
+public:
+    enum {
+        kDoNotDisplay = BIT(17)
+    };
+
 private:
     MParContainer *fParContainer; // Pointer to the data container storing
Index: trunk/MagicSoft/Mars/mhist/MH.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH.h	(revision 2112)
+++ trunk/MagicSoft/Mars/mhist/MH.h	(revision 2117)
@@ -36,4 +36,6 @@
     static TCanvas *MakeDefCanvas(const TObject *obj,
                                   const UInt_t w=625, const UInt_t h=440);
+
+    // FIXME: * --> & !!!
 
     static void SetBinning(TH1 *h, const MBinning *binsx);
Index: trunk/MagicSoft/Mars/mhist/MH3.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH3.cc	(revision 2112)
+++ trunk/MagicSoft/Mars/mhist/MH3.cc	(revision 2117)
@@ -60,4 +60,5 @@
 #include "MH3.h"
 
+#include <ctype.h>   // tolower
 #include <fstream.h>
 
@@ -636,2 +637,76 @@
     return h;
 }
+
+TString MH3::GetRule(const Char_t axis='x') const
+{
+    switch (tolower(axis))
+    {
+    case 'x':
+        return fData[0] ? fData[0]->GetRule() : TString("");
+    case 'y':
+        return fData[1] ? fData[1]->GetRule() : TString("");
+    case 'z':
+        return fData[2] ? fData[2]->GetRule() : TString("");
+    default:
+        return "<n/a>";
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Returns the total number of bins in a histogram (excluding under- and
+// overflow bins)
+//
+Int_t MH3::GetNbins() const
+{
+    Int_t num = 1;
+
+    switch (fDimension)
+    {
+    case 3:
+        num *= fHist->GetNbinsZ()+2;
+    case 2:
+        num *= fHist->GetNbinsY()+2;
+    case 1:
+        num *= fHist->GetNbinsX()+2;
+    }
+
+    return num;
+}
+
+// --------------------------------------------------------------------------
+//
+// Returns the total number of bins in a histogram (excluding under- and
+// overflow bins) Return -1 if bin is underflow or overflow
+//
+Int_t MH3::FindFixBin(Double_t x, Double_t y, Double_t z) const
+{
+    const TAxis &axex = *fHist->GetXaxis();
+    const TAxis &axey = *fHist->GetYaxis();
+    const TAxis &axez = *fHist->GetZaxis();
+
+    Int_t binz = 0;
+    Int_t biny = 0;
+    Int_t binx = 0;
+
+    switch (fDimension)
+    {
+    case 3:
+        binz = axez.FindFixBin(z);
+        if (binz>axez.GetLast() || binz<axez.GetFirst())
+            return -1;
+    case 2:
+        biny = axey.FindFixBin(y);
+        if (biny>axey.GetLast() || biny<axey.GetFirst())
+            return -1;
+    case 1:
+        binx = axex.FindFixBin(x);
+        if (binx<axex.GetFirst() || binx>axex.GetLast())
+            return -1;
+    }
+
+    const Int_t nx = fHist->GetNbinsX()+2;
+    const Int_t ny = fHist->GetNbinsY()+2;
+
+    return binx + nx*(biny +ny*binz);
+}
Index: trunk/MagicSoft/Mars/mhist/MH3.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH3.h	(revision 2112)
+++ trunk/MagicSoft/Mars/mhist/MH3.h	(revision 2117)
@@ -17,8 +17,6 @@
 protected:
     // Could be const but root < 3.02/06 doesn't like this...
-    Int_t fDimension;            // Number of dimensions of histogram
-    TH1  *fHist;                 // Histogram to fill
-
-    TString     fDataMember[3];  // Data member which should be filled into the histogram x
+    Int_t       fDimension;      // Number of dimensions of histogram
+    TH1        *fHist;           // Histogram to fill
     MDataChain *fData[3];        // Object from which the data is filled
     Double_t    fScale[3];       // Scale for the three axis (eg unit)
@@ -44,4 +42,6 @@
 
     Int_t GetDimension() const { return fDimension; }
+    Int_t GetNbins() const;
+    Int_t FindFixBin(Double_t x, Double_t y=0, Double_t z=0) const;
 
     void SetName(const char *name);
@@ -52,4 +52,5 @@
 
     TString GetDataMember() const;
+    TString GetRule(const Char_t axis='x') const;
 
     TH1 &GetHist() { return *fHist; }
