Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 6975)
+++ trunk/MagicSoft/Mars/Changelog	(revision 6976)
@@ -21,4 +21,17 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2005/04/22 Thomas Bretz
+
+   * mbase/MStatusArray.[h,cc]:
+     - switch off adding histograms to gDirectory in newly
+       overwritten Read-function
+
+   * mhflux/MHCollectionArea.[h,cc]:
+     - implemented member function GetHistSel
+     - don't display full statistics
+     - fixed a possible crash in Paint
+
+
 
  2005/04/22 Markus Meyer
Index: trunk/MagicSoft/Mars/mbase/MStatusArray.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusArray.cc	(revision 6975)
+++ trunk/MagicSoft/Mars/mbase/MStatusArray.cc	(revision 6976)
@@ -29,7 +29,20 @@
 //  Helper class for MStatusDisplay
 //
+// If you want to read a MStatusArray (normally with name MStatusDisplay)
+// it is recommended to do it like this:
+//     TFile f("myfile.root", "read");
+//     MStatusArray arr;
+//     arr.Read();
+//
+// If you want to use TFile::Get or TFile::GetObject you should switch off
+// addding Histograms automatically to the current directory first:
+//     TFile f("myfile.root", "read");
+//     TH1::AddDirectory(kFALSE);
+//     f.Get("MStatusDisplay");
+//
 //////////////////////////////////////////////////////////////////////////////
 #include "MStatusArray.h"
 
+#include <TH1.h>      // TH1::AddDirectoryStatus();
 #include <TClass.h>
 #include <TCanvas.h>
@@ -44,4 +57,10 @@
 using namespace std;
 
+// --------------------------------------------------------------------------
+//
+// If o==NULL a new status display is created, otherwise the one with name o
+// is searched in gROOT->GetListOfSpecials().
+// In this display the contents of the MStatusArray is displayed.
+//
 TObject *MStatusArray::DisplayIn(Option_t *o) const
 {
@@ -63,4 +82,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Display the contents of the given tab in the display given as argument.
+//
 void MStatusArray::DisplayIn(MStatusDisplay &d, const char *tab) const
 {
@@ -224,4 +247,18 @@
 // --------------------------------------------------------------------------
 //
+// Switch off adding histograms to current directory before reading.
+// Switch back
+//
+Int_t MStatusArray::Read(const char *name)
+{
+    const Bool_t store = TH1::AddDirectoryStatus();
+    TH1::AddDirectory(kFALSE);
+    const Int_t rc = TObjArray::Read(name?name:"MStatusDisplay");
+    TH1::AddDirectory(store);
+    return rc;
+}
+
+// --------------------------------------------------------------------------
+//
 // Print recursively all objects in this and sub-pads. If !option.IsNull()
 // only objects in the corresponding pad are printed.
Index: trunk/MagicSoft/Mars/mbase/MStatusArray.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MStatusArray.h	(revision 6975)
+++ trunk/MagicSoft/Mars/mbase/MStatusArray.h	(revision 6976)
@@ -30,4 +30,8 @@
 
     void Print(Option_t *o="") const;
+    void Print(Option_t *wildcard, Option_t *option) const
+    {
+        Print(wildcard);
+    }
 
     TObject *FindObject(const char *object, const char *base) const;
@@ -35,4 +39,6 @@
     TObject *FindObject(const TObject *o) const { return 0; }
 
+    Int_t Read(const char *name=NULL);
+
     ClassDef(MStatusArray, 0) // Helper class for status display
 };
Index: trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc	(revision 6975)
+++ trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc	(revision 6976)
@@ -32,4 +32,5 @@
 
 #include <TCanvas.h>
+#include <TPaveStats.h>
 
 #include "MLog.h"
@@ -274,5 +275,27 @@
 void MHCollectionArea::Paint(Option_t *option)
 {
-    TVirtualPad *pad = gPad;
+    TVirtualPad *pad;
+
+    TPaveStats *st=0;
+    for (int x=0; x<4; x++)
+    {
+        pad=gPad->GetPad(x+1);
+        if (!pad || !(st = (TPaveStats*)pad->GetPrimitive("stats")))
+            continue;
+
+        if (st->GetOptStat()==11)
+            continue;
+
+        const Double_t y1 = st->GetY1NDC();
+        const Double_t y2 = st->GetY2NDC();
+        const Double_t x1 = st->GetX1NDC();
+        const Double_t x2 = st->GetX2NDC();
+
+        st->SetY1NDC((y2-y1)/3+y1);
+        st->SetX1NDC((x2-x1)/3+x1);
+        st->SetOptStat(11);
+    }
+
+    pad = gPad;
 
     TH1 *h1=0, *h2=0;
@@ -288,5 +311,5 @@
         h2=fHistSel.ProjectionY("ProjSelY", -1, 9999, "E");
 
-    if (h1->GetMaximum()>0)
+    if (h1 && h1->GetMaximum()>0)
     {
         gPad->SetLogx();
Index: trunk/MagicSoft/Mars/mhflux/MHCollectionArea.h
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHCollectionArea.h	(revision 6975)
+++ trunk/MagicSoft/Mars/mhflux/MHCollectionArea.h	(revision 6976)
@@ -53,4 +53,5 @@
     TH2D &GetHistAll()             { return fHistAll; }
     const TH2D &GetHistAll() const { return fHistAll; }
+    const TH2D &GetHistSel() const { return fHistSel; }
     const TH1D &GetHEnergy() const { return fHEnergy; }
 
