Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2097)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2098)
@@ -1,21 +1,48 @@
                                                  -*-*- END OF LINE -*-*-
 
+ 2003/05/08: Thomas Bretz
+
+   * Makefile.rules:
+     - fixed the rmhtml bug
+
+   * macros/collarea.C:
+     - changed to use MStatusDisplay
+     
+   * manalysis/MCT1SupercutsCalc.cc: 
+     - fixed a typo
+     
+   * mbase/MEvtLoop.[h,cc], mbase/MTaskList.[h,cc]:
+     - added FindTask member functions
+     
+   * mbase/MLog.cc:
+     - do not crop logging to GUI to 1000 lines anymore
+
+   * mdata/MDataChain.cc:
+     - use GetRule() in the constructor instead of Print()
+     
+   * mdata/MDataElement.cc, mfilter/MFDataChain.cc:
+     - do not return str+"something"
+     
+   * mhist/MH.[h,cc]:
+     - fixed a bug in DrawCopy(TH1*,TH1*)
+     - overwrite Clone function and do not add TH1 to gDirectory 
+       when cloning MH classes
+     
+   * mimage/MHHillas.cc, mimage/MHHillasSrc.cc:
+     - adde a sanity check to Fill
+     
+   * mimage/MHHillasSrc.cc:
+     - do not set the log scale before we have entries in the histogram
+
+
+
  2003/05/08: Abelardo Moralejo
+
+   * mimage/MImgCleanStd.cc
+     - extended comment on standard cleaning.
 
    * mhistmc/MHMcCollectionAreaCalc.cc
      - Changed binning of histograms, so that the collection area
        can be calculated also between 5 and 10 GeV (for pulsar studies)
-
- 2003/05/08: Thomas Bretz
-
-   * Makefile.rules:
-     - fixed the rmhtml bug
-
-
-
- 2003/05/08: Abelardo Moralejo
-
-   * mimage/MImgCleanStd.cc
-     - extended comment on standard cleaning.
 
 
Index: trunk/MagicSoft/Mars/macros/collarea.C
===================================================================
--- trunk/MagicSoft/Mars/macros/collarea.C	(revision 2097)
+++ trunk/MagicSoft/Mars/macros/collarea.C	(revision 2098)
@@ -16,7 +16,7 @@
 !
 !
-!   Author(s): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de)
+!   Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2001
+!   Copyright: MAGIC Software Development, 2000-2003
 !
 !
@@ -25,5 +25,9 @@
 
 void collarea(TString filename="camera.root", TString outname="")
-{ 
+{
+    MStatusDisplay *d = new MStatusDisplay;
+    // redirect logging output to GUI, kFALSE to disable stream to stdout
+    d->SetLogStream(&gLog, kTRUE);
+
     //
     // first we have to create our empty lists
@@ -54,6 +58,5 @@
     // Start to loop over all events
     //
-    MProgressBar bar;
-    magic.SetProgressBar(&bar);
+    magic.SetDisplay(d);
     if (!magic.Eventloop())
         return;
@@ -65,5 +68,10 @@
     // filled and can be displayed
     //
-    parlist.FindObject("MHMcCollectionArea")->DrawClone();
+    if ((d = magic.GetDisplay()))
+        d->AddTab("Collection Area");
+    else
+        new TCanvas("CollArea", "Result of the collection area calculation");
+
+    parlist.FindObject("MHMcCollectionArea")->DrawClone("nonew");
 
 
Index: trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc	(revision 2097)
+++ trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc	(revision 2098)
@@ -16,6 +16,6 @@
 !
 !
-!   Author(s): Wolfgang Wittek  04/2003 <mailto:wittek@mppmu.mpg.de>
-
+!   Author(s): Wolfgang Wittek, 04/2003 <mailto:wittek@mppmu.mpg.de>
+!
 !   Copyright: MAGIC Software Development, 2000-2003
 !
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 2097)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 2098)
@@ -120,4 +120,24 @@
     if (TestBit(kIsOwner) && fParList)
         delete fParList;
+}
+
+// --------------------------------------------------------------------------
+//
+// If the evntloop knows its tasklist search for the task there,
+// otherwise return NULL.
+//
+MTask *MEvtLoop::FindTask(const char *name) const
+{
+    return fTaskList ? fTaskList->FindTask(name) : NULL;
+}
+
+// --------------------------------------------------------------------------
+//
+// If the evntloop knows its tasklist search for the task there,
+// otherwise return NULL.
+//
+MTask *MEvtLoop::FindTask(const MTask *obj) const
+{
+    return fTaskList ? fTaskList->FindTask(obj) : NULL;
 }
 
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 2097)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 2098)
@@ -14,4 +14,5 @@
 #endif
 
+class MTask;
 class MParList;
 class MTaskList;
@@ -45,4 +46,7 @@
     MParList  *GetParList() const       { return fParList; }
     MTaskList *GetTaskList() const      { return fTaskList; }
+
+    MTask *FindTask(const char *name) const;
+    MTask *FindTask(const MTask *obj) const;
 
     MStatusDisplay *GetDisplay() { return fDisplay; }
Index: trunk/MagicSoft/Mars/mbase/MLog.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 2097)
+++ trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 2098)
@@ -209,5 +209,5 @@
         switch (fOutputLevel)
         {
-        case 0:  out << MLog::kReset;   break;  // all
+        case 0:  out << MLog::kReset;   break;  // all // maybe not necessary?
         case 1:  out << MLog::kRed;     break;  // err
         case 2:  out << MLog::kYellow;  break;  // warn
@@ -284,5 +284,4 @@
 }
 
-#include <TVirtualX.h>
 void MLog::UpdateGui()
 {
@@ -308,6 +307,6 @@
 
     // cut text box top 1000 lines
-    while (txt.RowCount()>1000)
-        txt.DelLine(0);
+    //    while (txt.RowCount()>1000)
+    //        txt.DelLine(1);
 
     // show last entry
Index: trunk/MagicSoft/Mars/mbase/MTaskList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 2097)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 2098)
@@ -52,4 +52,13 @@
     TObject *FindObject(const TObject *obj) const;
 
+    MTask *FindTask(const char *name) const
+    {
+        return (MTask*)FindObject(name);
+    }
+    MTask *FindTask(const MTask *obj) const
+    {
+        return (MTask*)FindObject(obj);
+    }
+
     Bool_t ReInit(MParList *pList=NULL);
 
Index: trunk/MagicSoft/Mars/mdata/MDataChain.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataChain.cc	(revision 2097)
+++ trunk/MagicSoft/Mars/mdata/MDataChain.cc	(revision 2098)
@@ -150,7 +150,5 @@
         return;
     }
-    *fLog << inf << "found: " << flush;
-    fMember->Print();
-    *fLog << endl;
+    *fLog << inf << "found: " << GetRule() << endl;
 }
 
Index: trunk/MagicSoft/Mars/mdata/MDataElement.cc
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataElement.cc	(revision 2097)
+++ trunk/MagicSoft/Mars/mdata/MDataElement.cc	(revision 2098)
@@ -115,4 +115,5 @@
     TString rule = fMatrixName + "[";
     rule += fNumCol;
-    return rule+"]";
+    rule += "]";
+    return rule;
 }
Index: trunk/MagicSoft/Mars/mfilter/MFDataChain.cc
===================================================================
--- trunk/MagicSoft/Mars/mfilter/MFDataChain.cc	(revision 2097)
+++ trunk/MagicSoft/Mars/mfilter/MFDataChain.cc	(revision 2098)
@@ -119,5 +119,6 @@
     str += fValue;
 
-    return ret+str.Strip(TString::kBoth);
+    ret += str.Strip(TString::kBoth);
+    return ret;
 }
 
Index: trunk/MagicSoft/Mars/mhist/MH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH.cc	(revision 2097)
+++ trunk/MagicSoft/Mars/mhist/MH.cc	(revision 2098)
@@ -630,5 +630,5 @@
     // Draw second histogram
     //
-    ((TH1&)hist2).DrawCopy("sames");
+    TH1 *h2 = ((TH1&)hist2).DrawCopy("sames");
     gPad->Update();
 
@@ -642,6 +642,6 @@
                               s2.GetY1NDC()-0.01
                              );
-    l.AddEntry((TH1*)&hist1, hist1.GetTitle());
-    l.AddEntry((TH1*)&hist2, hist2.GetTitle());
+    l.AddEntry(h1, h1->GetTitle());
+    l.AddEntry(h2, h2->GetTitle());
     l.SetTextSize(s2.GetTextSize());
     l.SetTextFont(s2.GetTextFont());
@@ -749,4 +749,21 @@
 // --------------------------------------------------------------------------
 //
+// Encapsulate the TObject::Clone such, that a cloned TH1 (or derived)
+// object is not added to the current directory, when cloned.
+//
+TObject *MH::Clone(const char *name) const
+{
+    Bool_t store = TH1::AddDirectoryStatus();
+    TH1::AddDirectory(kFALSE);
+
+    TObject *o = MParContainer::Clone(name);
+
+    TH1::AddDirectory(store);
+
+    return o;
+}
+
+// --------------------------------------------------------------------------
+//
 // If the opt string contains 'nonew' or gPad is not given a new canvas
 // with size w/h is created. Otherwise the object is cloned and drawn
@@ -763,12 +780,6 @@
     gROOT->SetSelectedPad(NULL);
 
-    Bool_t store = TH1::AddDirectoryStatus();
-    TH1::AddDirectory(kFALSE);
-
     TObject *o = MParContainer::DrawClone(opt);
     o->SetBit(kCanDelete);
-
-    TH1::AddDirectory(store);
-
     return o;
 }
Index: trunk/MagicSoft/Mars/mhist/MH.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH.h	(revision 2097)
+++ trunk/MagicSoft/Mars/mhist/MH.h	(revision 2098)
@@ -61,4 +61,6 @@
     static void Draw(TH1 &hist1, TH1 &hist2, const TString title);
 
+    TObject *Clone(const char *name="") const;
+
     void Draw(Option_t *o="") { MParContainer::Draw(o); }
     TObject *DrawClone(Option_t *opt, Int_t w, Int_t h) const;
Index: trunk/MagicSoft/Mars/mimage/MHHillas.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHHillas.cc	(revision 2097)
+++ trunk/MagicSoft/Mars/mimage/MHHillas.cc	(revision 2098)
@@ -242,4 +242,10 @@
 Bool_t MHHillas::Fill(const MParContainer *par, const Stat_t w)
 {
+    if (!par)
+    {
+        *fLog << err << "MHHillas::Fill: Pointer (!=NULL) expected." << endl;
+        return kFALSE;
+    }
+
     const MHillas &h = *(MHillas*)par;
 
@@ -247,10 +253,10 @@
     const Double_t scale = fUseMmScale ? 1 : fMm2Deg;
 
-    fLength ->Fill(scale*h.GetLength(), w);
-    fWidth  ->Fill(scale*h.GetWidth(), w);
-    fDistC  ->Fill(scale*d, w);
-    fCenter ->Fill(scale*h.GetMeanX(), scale*h.GetMeanY(), w);
-    fDelta  ->Fill(kRad2Deg*h.GetDelta(), w);
-    fSize   ->Fill(h.GetSize(), w);
+    fLength->Fill(scale*h.GetLength(), w);
+    fWidth ->Fill(scale*h.GetWidth(), w);
+    fDistC ->Fill(scale*d, w);
+    fCenter->Fill(scale*h.GetMeanX(), scale*h.GetMeanY(), w);
+    fDelta ->Fill(kRad2Deg*h.GetDelta(), w);
+    fSize  ->Fill(h.GetSize(), w);
 
     return kTRUE;
Index: trunk/MagicSoft/Mars/mimage/MHHillasSrc.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHHillasSrc.cc	(revision 2097)
+++ trunk/MagicSoft/Mars/mimage/MHHillasSrc.cc	(revision 2098)
@@ -130,4 +130,10 @@
 Bool_t MHHillasSrc::Fill(const MParContainer *par, const Stat_t w)
 {
+    if (!par)
+    {
+        *fLog << err << "MHHillasSrc::Fill: Pointer (!=NULL) expected." << endl;
+        return kFALSE;
+    }
+
     const MHillasSrc &h = *(MHillasSrc*)par;
 
@@ -211,9 +217,20 @@
     pad->cd(4);
     gPad->SetBorderMode(0);
-    gPad->SetLogy();
+    //gPad->SetLogy();
     fCosDA->Draw();
 
     pad->Modified();
     pad->Update();
+}
+
+void MHHillasSrc::Paint(Option_t *opt)
+{
+    if (fCosDA->GetEntries()==0)
+        return;
+
+    TVirtualPad *savepad = gPad;
+    gPad->cd(4);
+    gPad->SetLogy();
+    gPad = savepad;
 }
 
