Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1075)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1076)
@@ -1,3 +1,67 @@
                                                                   -*-*- END -*-*-
+ 2001/11/09: Thomas Bretz
+
+   * mbase/MGList.[h,cc], mbase/MGTask.[h,cc], mbase/MGGroupFrame.[h,cc]:
+     - added
+
+   * Makefile.conf.linux, Makefile.conf.linux-gnu:
+     - changed to O3
+     - added -fnonnull-objects
+     - added -Woverloaded-virtual
+
+   * macros/readCT1.C, macros/readMagic.C:
+     - changed to use MClone
+
+   * manalysis/MImgCleanStd.[h,cc]:
+     - derived from TGTask
+     - added CreateGuiElements 
+     - added ProcessMessage
+
+   * mbase/BaseLinkDef.h, mbase/Makefile:
+     - added MGTask
+     - added MGList
+     - added MGGroupFrame
+
+   * mbase/MInputStreamID.cc:
+     - rmoved old comment
+
+   * mbase/MParContainer.[h,cc]:
+     - changed output
+     - made Hash const
+     - added GetDiscriptor
+
+   * mbase/MParList.[h,cc]:
+     - made FindObject const correct (see TObject)
+
+   * mbase/MTask.[h,cc]:
+     - changed output to use GetDescriptor
+     - made Call* functions virtual (used in TGTask)
+
+   * mbase/MTaskList.[h,cc]:
+     - made FindObject const correct (see TObject)
+     - changed output to use GetDescriptor
+
+   * mbase/MTime.cc:
+     - code reformatting
+
+   * mbase/MWriteRootFile.cc:
+     - small changes in output
+
+   * mgui/MHexagon.cc:
+     - changed output according to TEllipse and similar
+     - made ls const
+
+   * mhist/MFillH.cc:
+     - changed output to use GetDescriptor
+
+   * mmain/MAnalysis.[h,cc]:
+     - changed to use new GUI of MImgCleanStd
+
+   * mraw/MRawEvtData.cc:
+     - small changes to output
+     - better sanity check for non existing fRunHeader
+
+
+
  2001/11/09: Thomas Bretz
 
Index: /trunk/MagicSoft/Mars/Makefile.conf.linux
===================================================================
--- /trunk/MagicSoft/Mars/Makefile.conf.linux	(revision 1075)
+++ /trunk/MagicSoft/Mars/Makefile.conf.linux	(revision 1076)
@@ -20,5 +20,5 @@
 #  ----->>>   settings for compilation
 #
-OPTIM    = -O2 -Wall -fno-rtti -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
+OPTIM    = -O3 -Wall -fno-rtti -fnonnull-objects -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual
 DEBUG    =
 ARCHDEF  = -D__LINUX__
Index: /trunk/MagicSoft/Mars/Makefile.conf.linux-gnu
===================================================================
--- /trunk/MagicSoft/Mars/Makefile.conf.linux-gnu	(revision 1075)
+++ /trunk/MagicSoft/Mars/Makefile.conf.linux-gnu	(revision 1076)
@@ -20,5 +20,5 @@
 #
 
-OPTIM    = -O2 -Wall -fno-rtti -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs 
+OPTIM    = -O3 -Wall -fno-rtti -fnonnull-objects -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual
 DEBUG    =
 ARCHDEF  = -D__LINUX__
Index: /trunk/MagicSoft/Mars/macros/readCT1.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/readCT1.C	(revision 1075)
+++ /trunk/MagicSoft/Mars/macros/readCT1.C	(revision 1076)
@@ -37,8 +37,10 @@
 
     MCT1ReadAscii read("/home/tbretz/data/CT1_97_off1.dat");
+    MClone        clone("MCerPhotEvt");
     MImgCleanStd  clean;
     MHillasCalc   hcalc;
 
     tlist.AddToList(&read);
+    tlist.AddToList(&clone);
     tlist.AddToList(&clean);
     tlist.AddToList(&hcalc);
@@ -50,32 +52,20 @@
         return;
 
-    MCerPhotEvt &phevt = *(MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
-
     Int_t icount = 0;
     MCamDisplay display(&geomcam);
     display.Draw();
 
-    while (read.Process())
+    while (tlist.Process())
     {
-        cout << "Event: " << icount++  << endl;
-        hillas.Reset();
+        cout << "Event #" << icount++ << endl;
 
-        display.DrawPhotNum(&phevt);
+        display.DrawPhotNum((MCerPhotEvt*)clone.GetClone());
         gClient->HandleInput();
         if(getchar()=='q')
             break;
 
-        clean.Process();
-
-        if (hcalc.Process()==kCONTINUE)
-        {
-            cout << "skipped." << endl;
-            continue;
-        }
-
         hillas.Print();
         hillas.Draw();
-
-        display.DrawPhotNum(&phevt);
+        display.DrawPhotNum((MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
 
         gClient->HandleInput();
Index: /trunk/MagicSoft/Mars/macros/readMagic.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/readMagic.C	(revision 1075)
+++ /trunk/MagicSoft/Mars/macros/readMagic.C	(revision 1076)
@@ -40,4 +40,5 @@
     MReadTree    read("Events", "~/data/camera.root");
     MCerPhotCalc ncalc;
+    MClone       clone("MCerPhotEvt");
     MImgCleanStd clean;
     MHillasCalc  hcalc;
@@ -45,4 +46,5 @@
     tlist.AddToList(&read);
     tlist.AddToList(&ncalc);
+    tlist.AddToList(&clone);
     tlist.AddToList(&clean);
     tlist.AddToList(&hcalc);
@@ -54,29 +56,19 @@
         return;
 
-    MCerPhotEvt &phevt = *(MCerPhotEvt*)plist.FindObject("MCerPhotEvt");
-
     MCamDisplay display(&geomcam);
     display.Draw();
 
-    while (read.Process())
+    while (tlist.Process())
     {
-        cout << "Event #" << read.GetEventNum() ":" << endl;
-        hillas.Reset();
-        phevt.Reset();
+        cout << "Event #" << read.GetEventNum() << endl;
 
-        ncalc.Process();
-
-        display.DrawPhotNum(&phevt);
+        display.DrawPhotNum((MCerPhotEvt*)clone.GetClone());
         gClient->HandleInput();
         if(getchar()=='q')
             break;
 
-        clean.Process();
-        hcalc.Process();
-
         hillas.Print();
         hillas.Draw();
-
-        display.DrawPhotNum(&phevt);
+        display.DrawPhotNum((MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
 
         gClient->HandleInput();
Index: /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 1076)
@@ -258,5 +258,6 @@
     return kTRUE;
 }
-    
+
+
 // --------------------------------------------------------------------------
 //
@@ -272,2 +273,104 @@
 }
 
+#include <stdlib.h>       // atof
+
+#include <TGFrame.h>      // TGFrame
+#include <TGLabel.h>      // TGLabel
+#include <TGTextEntry.h>  // TGTextEntry
+
+#include "MGGroupFrame.h" // MGGroupFrame
+
+enum {
+    kImgCleanLvl1,
+    kImgCleanLvl2
+};
+
+void MImgCleanStd::CreateGuiElements(MGGroupFrame *f)
+{
+    //
+    // Create a frame for line 3 and 4 to be able
+    // to align entry field and label in one line
+    //
+    TGHorizontalFrame *f1 = new TGHorizontalFrame(f, 0, 0);
+    TGHorizontalFrame *f2 = new TGHorizontalFrame(f, 0, 0);
+
+    /*
+     * --> use with root >=3.02 <--
+     *
+
+     TGNumberEntry *fNumEntry1 = new TGNumberEntry(frame, 3.0, 2, M_NENT_LVL1, kNESRealOne, kNEANonNegative);
+     TGNumberEntry *fNumEntry2 = new TGNumberEntry(frame, 2.5, 2, M_NENT_LVL1, kNESRealOne, kNEANonNegative);
+
+     */
+    TGTextEntry *entry1 = new TGTextEntry(f1, "****", kImgCleanLvl1);
+    TGTextEntry *entry2 = new TGTextEntry(f2, "****", kImgCleanLvl2);
+
+    // --- doesn't work like expected (until root 3.02?) --- fNumEntry1->SetAlignment(kTextRight);
+    // --- doesn't work like expected (until root 3.02?) --- fNumEntry2->SetAlignment(kTextRight);
+
+    entry1->SetText("3.0");
+    entry2->SetText("2.5");
+
+    entry1->Associate(f);
+    entry2->Associate(f);
+
+    TGLabel *l1 = new TGLabel(f1, "Cleaning Level 1 for standard image cleaning.");
+    TGLabel *l2 = new TGLabel(f2, "Cleaning Level 2 for standard image cleaning.");
+
+    l1->SetTextJustify(kTextLeft);
+    l2->SetTextJustify(kTextLeft);
+
+    //
+    // Align the text of the label centered, left in the row
+    // with a left padding of 10
+    //
+    TGLayoutHints *laylabel = new TGLayoutHints(kLHintsCenterY|kLHintsLeft, 10);
+    TGLayoutHints *layframe = new TGLayoutHints(kLHintsCenterY|kLHintsLeft,  5, 0, 10);
+
+    //
+    // Add one entry field and the corresponding label to each line
+    //
+    f1->AddFrame(entry1);
+    f2->AddFrame(entry2);
+
+    f1->AddFrame(l1, laylabel);
+    f2->AddFrame(l2, laylabel);
+
+    f->AddFrame(f1, layframe);
+    f->AddFrame(f2, layframe);
+
+    f->AddToList(entry1);
+    f->AddToList(entry2);
+    f->AddToList(l1);
+    f->AddToList(l2);
+    f->AddToList(laylabel);
+    f->AddToList(layframe);
+}
+
+Bool_t MImgCleanStd::ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2)
+{
+    if (msg!=kC_TEXTENTRY || submsg!=kTE_ENTER)
+        return kTRUE;
+
+    TGTextEntry *txt = (TGTextEntry*)FindWidget(param1);
+
+    if (!txt)
+        return kTRUE;
+
+    Float_t lvl = atof(txt->GetText());
+
+    switch (param1)
+    {
+    case kImgCleanLvl1:
+        fCleanLvl1 = lvl;
+        *fLog << "Cleaning level 1 set to " << lvl << " sigma." << endl;
+        return kTRUE;
+
+    case kImgCleanLvl2:
+        fCleanLvl2 = lvl;
+        *fLog << "Cleaning level 2 set to " << lvl << " sigma." << endl;
+        return kTRUE;
+    }
+
+    return kTRUE;
+}
Index: /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h	(revision 1075)
+++ /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h	(revision 1076)
@@ -2,6 +2,6 @@
 #define MARS_MImgCleanStd
 
-#ifndef MARS_MTask
-#include "MTask.h"
+#ifndef MARS_MGTask
+#include "MGTask.h"
 #endif
 
@@ -9,12 +9,16 @@
 class MCerPhotEvt;
 
-class MImgCleanStd : public MTask
+class MGGroupFrame;
+
+class MImgCleanStd : public MGTask
 {
 private:
-    const MGeomCam *fCam;
-          MCerPhotEvt *fEvt;
+    const MGeomCam    *fCam;  //!
+          MCerPhotEvt *fEvt;  //!
 
     Float_t fCleanLvl1;
     Float_t fCleanLvl2;
+
+    void CreateGuiElements(MGGroupFrame *f);
 
 public:
@@ -26,6 +30,8 @@
     void CleanStep3();
 
-    Bool_t PreProcess (MParList *pList);
+    Bool_t PreProcess(MParList *pList);
     Bool_t Process();
+
+    Bool_t ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2);
 
     ClassDef(MImgCleanStd, 0)    // task doing a standard image cleaning
Index: /trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 1076)
@@ -31,4 +31,8 @@
 #pragma link C++ class MInputStreamID+;
 
+#pragma link C++ class MGTask+;
+#pragma link C++ class MGList+;
+#pragma link C++ class MGGroupFrame+;
+
 #pragma link C++ class MClone+;
 #pragma link C++ class MPrint+;
Index: /trunk/MagicSoft/Mars/mbase/MGGroupFrame.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MGGroupFrame.cc	(revision 1076)
+++ /trunk/MagicSoft/Mars/mbase/MGGroupFrame.cc	(revision 1076)
@@ -0,0 +1,143 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz  11/2001 (tbretz@uni-sw.gwdg.de)
+!
+!   Copyright: MAGIC Software Development, 2000-2001
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MGGroupFrame                                                            //
+//                                                                         //
+// This is a group frame derived from TGGroupFrame with some               //
+// enhancements:                                                           //
+//  - It holds a list which deletes all it's members in ~MGGroupFrame      //
+//    (use AddToList to add an object.                                     //
+//  - You can access the members of the list by their widget id (if they   //
+//    have one)                                                            //
+//  - All messages from associated GUI elemets are redirectd to a given    //
+//    task.                                                                //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+#include "MGGroupFrame.h"
+
+#include "MGList.h"
+#include "MGTask.h"
+
+ClassImp(MGGroupFrame);
+
+// --------------------------------------------------------------------------
+//
+//  For a detailed description check TGGroupFrame::TGGroupFrame.
+//  All messages from associated GUI elements are redirected to the given
+//  task.
+//  Creates a MGList object to store Widgets. Use AddToList to Add
+//  objects.
+//
+MGGroupFrame::MGGroupFrame(MGTask *task,
+                           const TGWindow *p, TGString *title,
+                           UInt_t options = kVerticalFrame,
+                           GContext_t norm=GetDefaultGC()(),
+                           FontStruct_t font=GetDefaultFontStruct(),
+                           ULong_t back=GetDefaultFrameBackground())
+    : TGGroupFrame(p, title, options, norm, font, back), TGWidget(-1)
+{
+    fWidgetFlags = 0;
+    fMsgWindow   = p;
+    fTask        = task;
+
+    fList = new MGList;
+}
+
+// --------------------------------------------------------------------------
+//
+//  For a detailed description check TGGroupFrame::TGGroupFrame.
+//  All messages from associated GUI elements are redirected to the given
+//  task.
+//  Creates a MGList object to store Widgets. Use AddToList to Add
+//  objects.
+//
+MGGroupFrame::MGGroupFrame(MGTask *task,
+                           const TGWindow *p, const char *title,
+                           UInt_t options = kVerticalFrame,
+                           GContext_t norm=GetDefaultGC()(),
+                           FontStruct_t font=GetDefaultFontStruct(),
+                           ULong_t back=GetDefaultFrameBackground())
+: TGGroupFrame(p, title, options, norm, font, back), TGWidget(-1)
+{
+    fWidgetFlags = 0;
+    fMsgWindow   = p;
+    fTask        = task;
+
+    fList = new MGList;
+}
+
+// --------------------------------------------------------------------------
+//
+//  Deleted the MGList object and all its members.
+//
+MGGroupFrame::~MGGroupFrame()
+{
+    fList->SetOwner();
+    delete fList;
+}
+
+// --------------------------------------------------------------------------
+//
+//  Add an object to the MGList. All the objects in MGList are deleted
+//  in the destructor MGGroupFrame automatically.
+//  You can add all object which have to exist until the Group Frame is
+//  destroyed (eg. TGLayoutElements)
+//  If an object is also derived from TGWidget you can get a pointer
+//  to it by its widget Id (use FindWidget)
+//
+void MGGroupFrame::AddToList(TObject *obj)
+{
+    fList->Add(obj);
+}
+
+// --------------------------------------------------------------------------
+//
+//  To get an object which has a widget id (is derived from TGWidget) by
+//  its widget id use FindWidget with the widget id of the object you
+//  are searching for. If no object with this widget id exists NULL
+//  is returned. See also MGList::FindWidget(Int_t)
+//
+TObject *MGGroupFrame::FindWidget(Int_t id) const
+{
+    return fList->FindWidget(id);
+}
+
+// --------------------------------------------------------------------------
+//
+//  If you associate an object with this MGGroupFrame object, like in the
+//  following example:
+//
+//   MGGroupFrame *f = new MGGroupFrame(...);
+//   TGTextEntry *entry = new TGTextEntry(...);
+//   entry->Associate(f);
+//
+//  All messages send to the group frame by the GUI elent are redirected
+//  to the task corresponing to the MGGroupFrame.
+//
+Bool_t MGGroupFrame::ProcessMessage(Long_t msg, Long_t param1, Long_t param2)
+{
+    return fTask->ProcessMessage(GET_MSG(msg), GET_SUBMSG(msg), param1, param2);
+}
Index: /trunk/MagicSoft/Mars/mbase/MGGroupFrame.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MGGroupFrame.h	(revision 1076)
+++ /trunk/MagicSoft/Mars/mbase/MGGroupFrame.h	(revision 1076)
@@ -0,0 +1,42 @@
+#ifndef MARS_MGGroupFrame
+#define MARS_MGGroupFrame
+
+#ifndef ROOT_TGFrame
+#include <TGFrame.h>
+#endif
+#ifndef ROOT_TGWidget
+#include <TGWidget.h>
+#endif
+
+class MGTask;
+class MGList;
+
+class MGGroupFrame : public TGGroupFrame, public TGWidget
+{
+    MGTask  *fTask;
+    MGList *fList;
+
+public:
+    MGGroupFrame(MGTask *task,
+                 const TGWindow *p, TGString *title,
+                 UInt_t options = kVerticalFrame,
+                 GContext_t norm=GetDefaultGC()(),
+                 FontStruct_t font=GetDefaultFontStruct(),
+                 ULong_t back=GetDefaultFrameBackground());
+    MGGroupFrame(MGTask *task,
+                 const TGWindow *p, const char *title,
+                 UInt_t options = kVerticalFrame,
+                 GContext_t norm=GetDefaultGC()(),
+                 FontStruct_t font=GetDefaultFontStruct(),
+                 ULong_t back=GetDefaultFrameBackground());
+    virtual ~MGGroupFrame();
+
+    void     AddToList(TObject *obj);
+    TObject *FindWidget(Int_t id) const;
+
+    virtual Bool_t ProcessMessage(Long_t msg, Long_t param1, Long_t param2);
+
+    ClassDef(MGGroupFrame, 0)
+};
+
+#endif
Index: /trunk/MagicSoft/Mars/mbase/MGList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MGList.cc	(revision 1076)
+++ /trunk/MagicSoft/Mars/mbase/MGList.cc	(revision 1076)
@@ -0,0 +1,161 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz  11/2001 (tbretz@uni-sw.gwdg.de)
+!
+!   Copyright: MAGIC Software Development, 2000-2001
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+//  MGList                                                                 //
+//                                                                         //
+//  This is a TList object which has some enhancements for GUI elements.   //
+//  Use GetWidget to search for a GUI element with a given widget id.      //
+//  Add checkes for the existances of a GUI element with the same widget   //
+//  id (for IDs>=0).                                                       //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+#include "MGList.h"
+
+#include <iostream.h>
+
+#include <TClass.h>
+#include <TGWidget.h>
+
+
+ClassImp(MGList);
+
+// --------------------------------------------------------------------------
+//
+//  Does a dynamic cast from a TObject to a TGWidget. This is necesary
+//  if a class derived from TObject inherits also from TGWidget and
+//  you have only a pointer to the TObject available.
+//
+TGWidget *MGList::GetWidget(TObject *obj) const
+{
+    //
+    // - IsA gives a pointer to the parent class entry in the dictionary
+    // - DynamicCast tries to cast obj of class type obj->IsA to one
+    //   of its base classes TGWidget
+    // - This method is ment for dynamic casts (multi inheritance)
+    //
+    //  If this functions makes trouble check for the correct inheritance
+    //  first via obj->InheritsFrom(TGWidget::Class())
+    //
+    //  The root implementation is used, because for space reasons
+    //  the C++ dynamic_cast<TGWidget*> is turned off by the option
+    //  -fno-rtti, which could be used in 'plain' C++
+    //
+    return (TGWidget*)obj->IsA()->DynamicCast(TGWidget::Class(), obj);
+}
+
+// --------------------------------------------------------------------------
+//
+//  Returns kTRUE if the object is derived from TGWidget and a widget
+//  with the TGWidget id of this object is already in the list.
+//  If the object is not derived from TGWidget or no TGWidget object
+//  with the same widget id is existing in the list kFALSE is returned.
+//  If the TGWidget has an object id < 0 kFALSE is always retuned.
+//
+Bool_t MGList::IsExisting(TObject *obj) const
+{
+    const TGWidget *wid = GetWidget(obj);
+
+    //
+    // check whether it is a TGWidget
+    //
+    if (!wid)
+        return kFALSE;
+
+    const Int_t id = wid->WidgetId();
+
+    //
+    // check whether is has a valid id
+    // (not id=-1, which is the standard id)
+    //
+    if (id < 0)
+        return kFALSE;
+
+    //
+    // check whether Widget id is already existing in the list
+    //
+    return (Bool_t)FindWidget(id);
+}
+
+// --------------------------------------------------------------------------
+//
+//  If the given object obj is derived from TGWidget and a TGWidget with
+//  the same widget id is already existing in the list the object is
+//  ignored, otherwise it is added to the list via TList::Add(TObject *)
+//
+void MGList::Add(TObject *obj)
+{
+    if (IsExisting(obj))
+    {
+        cout << "Widget with id #" << GetWidget(obj)->WidgetId() << " already in list... ignored." << endl;
+        return;
+    }
+
+    TList::Add(obj);
+}
+
+// --------------------------------------------------------------------------
+//
+//  If the given object obj is derived from TGWidget and a TGWidget with
+//  the same widget id is already existing in the list the object is
+//  ignored, otherwise it is added to the list via
+//  TList::Add(TObject *, Option_t *)
+//
+void MGList::Add(TObject *obj, Option_t *opt)
+{
+    if (IsExisting(obj))
+    {
+        cout << "Widget with id #" << GetWidget(obj)->WidgetId() << " already in list... ignored." << endl;
+        return;
+    }
+
+    TList::Add(obj, opt);
+}
+
+// --------------------------------------------------------------------------
+//
+//  Search the list for a object derived from TGidget which has the given
+//  widget id. Returns a pointer to this object otherwise NULL.
+//  For IDs < 0 the function returns always NULL.
+//
+TObject *MGList::FindWidget(Int_t id) const
+{
+    if (id<0)
+        return NULL;
+
+    TObject *obj;
+    TIter Next(this);
+    while ((obj=Next()))
+    {
+        const TGWidget *wid = GetWidget(obj);
+
+        if (!wid)
+            continue;
+
+        if (id == wid->WidgetId())
+            return obj;
+    }
+    return NULL;
+}
Index: /trunk/MagicSoft/Mars/mbase/MGList.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MGList.h	(revision 1076)
+++ /trunk/MagicSoft/Mars/mbase/MGList.h	(revision 1076)
@@ -0,0 +1,28 @@
+#ifndef MARS_MGList
+#define MARS_MGList
+
+#ifndef ROOT_TList
+#include <TList.h>
+#endif
+
+class TGWidget;
+
+class MGList : public TList
+{
+private:
+    TGWidget *GetWidget(TObject *obj) const;
+    Bool_t    IsExisting(TObject *obj) const;
+
+public:
+    MGList() : TList() {}
+
+    void Add(TObject *obj);
+    void Add(TObject *obj, Option_t *opt);
+
+
+    TObject *FindWidget(Int_t id) const;
+
+    ClassDef(MGList, 0)
+};
+
+#endif
Index: /trunk/MagicSoft/Mars/mbase/MGTask.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MGTask.cc	(revision 1076)
+++ /trunk/MagicSoft/Mars/mbase/MGTask.cc	(revision 1076)
@@ -0,0 +1,179 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz  11/2001 (tbretz@uni-sw.gwdg.de)
+!
+!   Copyright: MAGIC Software Development, 2000-2001
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+//   MGTask                                                                //
+//                                                                         //
+//   A MTask with several enhancments for a graphical interface.           //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+
+#include "MGTask.h"
+
+#include <TMethod.h>
+
+#include "MLog.h"
+#include "MGGroupFrame.h"
+
+ClassImp(MGTask);
+
+// --------------------------------------------------------------------------
+//
+//  Default constructor. Initialized fFrame with NULL.
+//
+MGTask::MGTask(const char *name, const char *title)
+    : fFrame(NULL)
+{
+    fName  = name  ? name  : "MGTask";
+    fTitle = title ? title : "Base class for all tasks with graphical I/O.";
+}
+
+// --------------------------------------------------------------------------
+//
+//  Deletes the GUI if one was created.
+//
+MGTask::~MGTask()
+{
+    if (fFrame)
+        delete fFrame;
+}
+
+// --------------------------------------------------------------------------
+//
+//  Hides the graphical interface if existing and calls
+//  MTask::CallPreProcess
+//
+Bool_t MGTask::CallPreProcess(MParList *plist)
+{
+    HideGui();
+
+    return MTask::CallPreProcess(plist);
+}
+
+// --------------------------------------------------------------------------
+//
+//  Shows the graphical interface if existing and calls
+//  MTask::CallPostProcess
+//
+Bool_t MGTask::CallPostProcess()
+{
+    ShowGui();
+
+    return MTask::CallPostProcess();
+}
+
+// --------------------------------------------------------------------------
+//
+// Get the Widget from the MGGroupFrame (GUI) with the Id id.
+//
+TObject *MGTask::FindWidget(Int_t id) const
+{
+    return fFrame->FindWidget(id);
+}
+
+// --------------------------------------------------------------------------
+//
+//  Process a message. Redirect gui events (eg by calling
+//  TGButton->Associate()) to the MGGroupFrame when Creating the GUI in
+//  CreateGuiElements. And process the messages in the overwritten
+//  ProcessMessage function.
+//
+Bool_t MGTask::ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2)
+{
+    fLog->setf(ios::showbase);
+    *fLog << "Task " << GetDescriptor() << " received gui msg " << hex;
+    *fLog << msg << " " << submsg << " " << param1 << " " << param2 << endl;
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+//  Show the gui (and its gui elements) of the task if existing.
+//
+void MGTask::ShowGui()
+{
+    if (fFrame)
+        fFrame->MapWindow();
+}
+
+// --------------------------------------------------------------------------
+//
+//  Hide the gui (and its gui elements) of the task if existing.
+//
+void MGTask::HideGui()
+{
+    if (fFrame)
+        fFrame->UnmapWindow();
+}
+
+// --------------------------------------------------------------------------
+//
+//  Check whether a gui for this task was already created.
+//  If not create a MGGroupFrame to group the gui elements and add it
+//  to the given frame with the given layout hints.
+//  Now call the overwritten function CreateGuiElements to fill the group
+//  frame.
+//
+void MGTask::CreateGui(TGCompositeFrame *f, TGLayoutHints *layout)
+{
+    //
+    // Check whether frame already exists
+    //
+    if (fFrame)
+    {
+        *fLog << GetDescriptor() << ": Gui already created... skipped." << endl;
+        return;
+    }
+
+    //
+    // Check whether a gui is implemented for this class
+    //  - IsA gives a pointer to the dictionary entry of the mostly
+    //    inherited class of this Task
+    //  - GetMethodAllAny checks for the existance of CreateGuiElements
+    //    in the class and all its base classes
+    //  - now get the dictionary entry of the corresponding class
+    //    (in which the mathos was found)
+    //  - if method isn't overwritten the result is the dictionary
+    //    entry for MGTask.
+    //
+    TMethod *method = IsA()->GetMethodAllAny("CreateGuiElements");
+    if (method->GetClass() == MGTask::Class())
+    {
+        *fLog << "Sorry, " << GetDescriptor();
+        *fLog << " doesn't override CreateGuiElements." << endl;
+        return;
+    }
+
+    //
+    //  create group frame
+    //
+    fFrame = new MGGroupFrame(this, f, ClassName());
+    f->AddFrame(fFrame, layout);
+
+    //
+    // add gui elements
+    //
+    CreateGuiElements(fFrame);
+}
Index: /trunk/MagicSoft/Mars/mbase/MGTask.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MGTask.h	(revision 1076)
+++ /trunk/MagicSoft/Mars/mbase/MGTask.h	(revision 1076)
@@ -0,0 +1,50 @@
+#ifndef MARS_MGTask
+#define MARS_MGTask
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MTask                                                                   //
+//                                                                         //
+// Abstract base class for a task                                          //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef MARS_MTask
+#include "MTask.h"
+#endif
+
+class MParList;
+
+class TGLayoutHints;
+class TGCompositeFrame;
+
+class MGGroupFrame;
+
+class MGTask : public MTask
+{
+private:
+    MGGroupFrame *fFrame;     //!
+
+    virtual void CreateGuiElements(MGGroupFrame *f) {}
+
+    void ShowGui();
+    void HideGui();
+
+protected:
+    TObject *FindWidget(Int_t id) const;
+
+public:
+    MGTask(const char *name=NULL, const char *title=NULL);
+    virtual ~MGTask();
+
+    Bool_t CallPreProcess(MParList *plist);
+    Bool_t CallPostProcess();
+
+    virtual Bool_t ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2);
+
+    void CreateGui(TGCompositeFrame *f, TGLayoutHints *layout);
+
+    ClassDef(MGTask, 0)		//Abstract base class for a task
+};
+
+#endif
Index: /trunk/MagicSoft/Mars/mbase/MInputStreamID.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MInputStreamID.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/MInputStreamID.cc	(revision 1076)
@@ -47,6 +47,5 @@
     fTitle = title;
 
-    fStreamId = "All"; //new char[4];
-    //strcpy(fStreamId, "All");
+    fStreamId = "All";
 }
 
Index: /trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1076)
@@ -137,5 +137,5 @@
 {
     TROOT::IndentLevel();
-    *fLog <<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << " : "
+    *fLog <<"OBJ: " << GetDescriptor() << ": " << GetTitle() << ", "
         << Int_t(TestBit(kCanDelete)) << endl;
 }
@@ -147,5 +147,5 @@
 void MParContainer::Print(Option_t *) const
 {
-    *fLog <<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << endl;
+    *fLog <<"OBJ: " << GetDescriptor() << ": " << GetTitle() << endl;
 }
 
@@ -199,5 +199,5 @@
 {
     *fLog << "To use the the ascii input of " << GetName();
-    *fLog << " you have to overload " << GetName() << "::AsciiRead." << endl;
+    *fLog << " you have to overload " << ClassName() << "::AsciiRead." << endl;
 }
 
@@ -205,4 +205,4 @@
 {
     *fLog << "To use the the ascii output of " << GetName();
-    *fLog << " you have to overload " << GetName() << "::AsciiWrite." << endl;
-}
+    *fLog << " you have to overload " << ClassName() << "::AsciiWrite." << endl;
+}
Index: /trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1076)
@@ -100,4 +100,6 @@
     virtual ~MParContainer() {}
 
+    virtual const char *GetDescriptor() const { return Form("%s [%s]", GetName(), ClassName()); }
+
     virtual TObject    *Clone(const char *newname="") const;
     virtual Int_t       Compare(const TObject *obj) const;
@@ -107,5 +109,5 @@
     virtual const char *GetName() const    { return fName.Data(); }
     virtual const char *GetTitle() const   { return fTitle.Data(); }
-    virtual ULong_t     Hash()             { return fName.Hash(); }
+    virtual ULong_t     Hash() const       { return fName.Hash(); }
     virtual Bool_t      IsSortable() const { return kTRUE; }
 
Index: /trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1076)
@@ -227,5 +227,5 @@
 //  check if the object is in the list or not
 //
-TObject *MParList::FindObject(TObject *obj) const
+TObject *MParList::FindObject(const TObject *obj) const
 {
     return fContainer->FindObject(obj);
Index: /trunk/MagicSoft/Mars/mbase/MParList.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParList.h	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/MParList.h	(revision 1076)
@@ -44,5 +44,5 @@
 
     TObject       *FindObject(const char *name) const;
-    TObject       *FindObject(TObject *obj) const;
+    TObject       *FindObject(const TObject *obj) const;
     MParContainer *FindCreateObj(const char *classname, const char *objname=NULL);
 
Index: /trunk/MagicSoft/Mars/mbase/MTask.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 1076)
@@ -67,4 +67,5 @@
 #include "MTask.h"
 
+#include <TMethod.h>
 #include <TOrdCollection.h>
 
@@ -73,4 +74,5 @@
 
 #include "MFilter.h"
+#include "MGGroupFrame.h"
 
 ClassImp(MTask);
@@ -176,4 +178,5 @@
 
     fIsPreprocessed = kFALSE;
+
     return PostProcess();
 }
@@ -224,6 +227,6 @@
 void MTask::PrintStatistics(const Int_t lvl) const
 {
-    *fLog << setw(lvl) << " " << GetName() << " [";
-    *fLog << ClassName() << "] \t" << fNumExecutions;
-    *fLog << endl;
-}
+    *fLog << setw(lvl) << " " << GetDescriptor() << "\t";
+    *fLog << dec << fNumExecutions << endl;
+}
+
Index: /trunk/MagicSoft/Mars/mbase/MTask.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTask.h	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/MTask.h	(revision 1076)
@@ -73,11 +73,11 @@
     UInt_t GetNumExecutions() { return fNumExecutions; }
 
-    Bool_t CallPreProcess(MParList *plist);
-    Bool_t CallProcess();
-    Bool_t CallPostProcess();
+    virtual Bool_t CallPreProcess(MParList *plist);
+    virtual Bool_t CallProcess();
+    virtual Bool_t CallPostProcess();
 
     const TOrdCollection *GetListOfBranches() const { return fListOfBranches; }
 
-    ClassDef(MTask, 0)		//Abstract base class for a task
+    ClassDef(MTask, 0) //Abstract base class for a task
 };
 
Index: /trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1076)
@@ -197,5 +197,5 @@
 //  check if the object is in the list or not
 //
-TObject *MTaskList::FindObject(TObject *obj) const
+TObject *MTaskList::FindObject(const TObject *obj) const
 {
     return fTasks->FindObject(obj);
@@ -360,10 +360,9 @@
         *fLog << "Execution Statistics: " << endl;
         *fLog << "---------------------" << endl;
-        *fLog << GetName() << " [" << ClassName() << "]" << endl;
+        *fLog << GetDescriptor() << endl;
     }
     else
     {
-        *fLog << setw(lvl) << " " << GetName() << " [";
-        *fLog << ClassName() << "]" << endl;
+        *fLog << setw(lvl) << " " << GetDescriptor() << endl;
     }
 
@@ -380,5 +379,5 @@
 void MTaskList::Print(Option_t *t) const
 {
-    *fLog << "TaskList: " << GetName() << " <" << GetTitle() << ">" << endl;
+    *fLog << GetDescriptor() << " <" << GetTitle() << ">" << endl;
 
     fTasks->Print();
Index: /trunk/MagicSoft/Mars/mbase/MTaskList.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 1076)
@@ -40,5 +40,5 @@
 
     TObject *FindObject(const char *name) const;
-    TObject *FindObject(TObject *obj) const;
+    TObject *FindObject(const TObject *obj) const;
 
     Bool_t PreProcess(MParList *pList);
Index: /trunk/MagicSoft/Mars/mbase/MTime.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTime.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/MTime.cc	(revision 1076)
@@ -43,6 +43,6 @@
     fLog->setf(ios::showbase);
     *fLog << "MTime Information:  " << hex 
-        << " " <<setfill('0') << setw(2) << fTimeStamp[0]
-        << " " <<setfill('0') << setw(2) << fTimeStamp[1] << endl << endl;
+        << " " << setfill('0') << setw(2) << fTimeStamp[0]
+        << " " << setfill('0') << setw(2) << fTimeStamp[1] << endl << endl;
 } 
 
Index: /trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc	(revision 1076)
@@ -116,5 +116,5 @@
 void MWriteRootFile::Print(Option_t *) const
 {
-    cout << "File: " << GetFileName() << endl;
+    cout << "File: " << GetFileName() << dec << endl;
     cout << "--------------------------------------------------" << endl;
 
Index: /trunk/MagicSoft/Mars/mbase/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/mbase/Makefile	(revision 1075)
+++ /trunk/MagicSoft/Mars/mbase/Makefile	(revision 1076)
@@ -44,4 +44,7 @@
            MWriteAsciiFile.cc \
            MWriteRootFile.cc \
+           MGList.cc \
+           MGTask.cc \
+           MGGroupFrame.cc \
 	   MArray.cc \
 	   MArrayB.cc \
Index: /trunk/MagicSoft/Mars/mgui/MHexagon.cc
===================================================================
--- /trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/mgui/MHexagon.cc	(revision 1076)
@@ -191,5 +191,5 @@
 //  list this hexagon with its attributes
 //
-void MHexagon::ls(Option_t *)
+void MHexagon::ls(const Option_t *) const
 {
     TROOT::IndentLevel();
@@ -247,5 +247,5 @@
 void MHexagon::Print(Option_t *) const
 {
-    cout << "MHexagon - " << GetName() << ": ";
+    cout << "MHexagon: ";
     cout << "x=" << fX << "mm y=" << fY << "mm r=" << fD << "mm" << endl;
 
Index: /trunk/MagicSoft/Mars/mgui/MHexagon.h
===================================================================
--- /trunk/MagicSoft/Mars/mgui/MHexagon.h	(revision 1075)
+++ /trunk/MagicSoft/Mars/mgui/MHexagon.h	(revision 1076)
@@ -51,5 +51,5 @@
     //virtual void  ExecuteEvent(Int_t event, Int_t px, Int_t py);
 
-    virtual void  ls (Option_t *Option="");
+    virtual void  ls(const Option_t *Option="") const;
     virtual void  Paint(Option_t *Option="");
     virtual void  PaintHexagon(Float_t x, Float_t y, Float_t d);
Index: /trunk/MagicSoft/Mars/mhist/MFillH.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 1076)
@@ -172,6 +172,6 @@
     if (!fH->InheritsFrom("MH"))
     {
-        *fLog << dbginf << fH->GetName() << " [" << fH->ClassName();
-        *fLog << "] doesn't inherit from MH - cannot be used for MFillH... aborting." << endl;
+        *fLog << dbginf << fH->GetDescriptor() << " ";
+        *fLog << "doesn't inherit from MH - cannot be used for MFillH... aborting." << endl;
         return kFALSE;
     }
Index: /trunk/MagicSoft/Mars/mmain/MAnalysis.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 1076)
@@ -25,5 +25,4 @@
 #include "MAnalysis.h"
 
-#include <stdlib.h>        // atof
 #include <iostream.h>
 
@@ -32,4 +31,6 @@
 #include <TGTextEntry.h>   // TGNumberEntry
 
+#include "MImgCleanStd.h"  // MImgCleanStd
+
 ClassImp(MAnalysis)
 
@@ -59,4 +60,7 @@
     TGCompositeFrame *frame = CreateNewTab("Setup");
 
+    TGGroupFrame *grp = new TGGroupFrame(frame, "Setup Display");
+    fList->Add(grp);
+
     //
     // Align the lines:
@@ -64,88 +68,33 @@
     //  - padding: top=20, bottom=0, left=20, right=0
     //
-    TGLayoutHints *layline = new TGLayoutHints(kLHintsNormal, 20, 0, 20);
-    fList->Add(layline);
+    TGLayoutHints *laybut = new TGLayoutHints(kLHintsNormal, 10, 10, 10);
+    fList->Add(laybut);
 
     //
     // Create check buttons for the first two lines
     //
-    fCheckButton1 = new TGCheckButton(frame, "Display Hillas Histograms when finished");  //, M_CHECK_DISPLHIL);
-    fCheckButton2 = new TGCheckButton(frame, "Display Star Map Histogram when finished"); //, M_CHECK_DISPLHIL);
+    fCheckButton1 = new TGCheckButton(grp, "Display Hillas Histograms when finished");  //, M_CHECK_DISPLHIL);
+    fCheckButton2 = new TGCheckButton(grp, "Display Star Map Histogram when finished"); //, M_CHECK_DISPLHIL);
+
+    fList->AddFirst(fCheckButton1);
+    fList->AddFirst(fCheckButton2);
+
+    //
+    // Create first two lines with the checkbuttons
+    //
+    grp->AddFrame(fCheckButton1, laybut);
+    grp->AddFrame(fCheckButton2, laybut);
+
+    TGLayoutHints *laygrp = new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 20, 20, 20);
+    fList->Add(laygrp);
+
+    frame->AddFrame(grp, laygrp);
 
     /*
-     FIXME...
-
-     fList->Add(fCheckButton1);
-     fList->Add(fCheckButton2);
+     * Create GUI for image cleaning
      */
-
-    //
-    // Create first two lines with the checkbuttons
-    //
-    frame->AddFrame(fCheckButton1, layline);
-    frame->AddFrame(fCheckButton2, layline);
-
-    //
-    // Create entry fields and labels for line 3 and 4
-    //
-
-    /*
-     * --> use with root >=3.02 <--
-     *
-
-     TGNumberEntry *fNumEntry1 = new TGNumberEntry(frame, 3.0, 2, M_NENT_LVL1, kNESRealOne, kNEANonNegative);
-     TGNumberEntry *fNumEntry2 = new TGNumberEntry(frame, 2.5, 2, M_NENT_LVL1, kNESRealOne, kNEANonNegative);
-
-     */
-
-    //
-    // Create a frame for line 3 and 4 to be able
-    // to align entry field and label in one line
-    //
-    TGHorizontalFrame *f1 = new TGHorizontalFrame(frame, 0, 0);
-    TGHorizontalFrame *f2 = new TGHorizontalFrame(frame, 0, 0);
-
-    fNumEntry1 = new TGTextEntry(f1, "****");
-    fNumEntry2 = new TGTextEntry(f2, "****");
-
-    // --- doesn't work like expected --- fNumEntry1->SetAlignment(kTextRight);
-    // --- doesn't work like expected --- fNumEntry2->SetAlignment(kTextRight);
-
-    fNumEntry1->SetText("3.0");
-    fNumEntry2->SetText("2.5");
- 
-    fList->Add(fNumEntry1);
-    fList->Add(fNumEntry2);
-
-    TGLabel *l1 = new TGLabel(f1, "Cleaning Level 1 for standard image cleaning.");
-    TGLabel *l2 = new TGLabel(f2, "Cleaning Level 2 for standard image cleaning.");
-
-    l1->SetTextJustify(kTextLeft);
-    l2->SetTextJustify(kTextLeft);
-
-    fList->Add(l1);
-    fList->Add(l2);
-
-    //
-    // Align the text of the label centered, left in the row
-    // with a left padding of 10
-    //
-    TGLayoutHints *laylabel = new TGLayoutHints(kLHintsCenterY|kLHintsLeft, 10); //, 10); //, 5, 5);
-    fList->Add(laylabel);
-
-    //
-    // Add one entry field and the corresponding label to each line
-    //
-    f1->AddFrame(fNumEntry1);
-    f2->AddFrame(fNumEntry2);
-
-    f1->AddFrame(l1, laylabel);
-    f2->AddFrame(l2, laylabel);
-
-    //
-    // Add line 3 and 4 to tab
-    //
-    frame->AddFrame(f1, layline);
-    frame->AddFrame(f2, layline);
+    fImgClean = new MImgCleanStd;
+    fImgClean->CreateGui(frame, laygrp);
+    fList->Add(fImgClean);
 }
 
@@ -192,19 +141,4 @@
     const Bool_t displstarmap = fCheckButton2->GetState();
 
-    Float_t cleanlvl1 = atof(fNumEntry1->GetText());
-    Float_t cleanlvl2 = atof(fNumEntry2->GetText());
-
-    if (cleanlvl1<0)
-    {
-        cleanlvl1=0;
-        fNumEntry1->SetText("0");
-    }
-
-    if (cleanlvl2<0)
-    {
-        cleanlvl2=0;
-        fNumEntry2->SetText("0");
-    }
-
     //
     // Create a empty Parameter List and an empty Task List
@@ -245,10 +179,9 @@
 
     MCerPhotCalc ncalc;
-    MImgCleanStd clean(cleanlvl1, cleanlvl2);
     MHillasCalc  hcalc;
 
     tlist.AddToList(&read);
     tlist.AddToList(&ncalc);
-    tlist.AddToList(&clean);
+    tlist.AddToList(fImgClean);
     tlist.AddToList(&hcalc);
 
Index: /trunk/MagicSoft/Mars/mmain/MAnalysis.h
===================================================================
--- /trunk/MagicSoft/Mars/mmain/MAnalysis.h	(revision 1075)
+++ /trunk/MagicSoft/Mars/mmain/MAnalysis.h	(revision 1076)
@@ -9,4 +9,6 @@
 class TGCheckButton;
 
+class MImgCleanStd;
+
 class MAnalysis : public MBrowser
 {
@@ -15,6 +17,8 @@
     TGCheckButton *fCheckButton2;
 
-    TGTextEntry   *fNumEntry1;
-    TGTextEntry   *fNumEntry2;
+//    TGTextEntry   *fNumEntry1;
+//    TGTextEntry   *fNumEntry2;
+
+    MImgCleanStd  *fImgClean;
 
     void CalculateHillas();
Index: /trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 1075)
+++ /trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 1076)
@@ -59,4 +59,6 @@
 
 #include "MLog.h"
+#include "MLogManip.h"
+
 #include "MArrayS.h"
 #include "MArrayB.h"
@@ -286,5 +288,5 @@
     }
 
-    *fLog << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl;
+    *fLog << dbginf << "Warning - You must specify either 'GRAPH' or 'HIST'" << endl;
 }
 
@@ -296,10 +298,13 @@
 void MRawEvtData::DeletePixels(Bool_t flag)
 {
-    const int npix = fRunHeader->GetNumCrates()*fRunHeader->GetNumPixInCrate();
-
-    if (fArraySize == npix && flag)
-    {
-        fPosInArray = 0;
-        return;
+    if (fRunHeader && flag)
+    {
+        const int npix = fRunHeader->GetNumCrates()*fRunHeader->GetNumPixInCrate();
+
+        if (fArraySize == npix)
+        {
+            fPosInArray = 0;
+            return;
+        }
     }
 
@@ -327,5 +332,5 @@
 void MRawEvtData::InitArrays(Bool_t flag)
 {
-    if (flag)
+    if (flag && fRunHeader)
     {
         const int npix = fRunHeader->GetNumCrates()*fRunHeader->GetNumPixInCrate();
