Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 959)
+++ trunk/MagicSoft/Mars/Changelog	(revision 961)
@@ -1,3 +1,32 @@
                                                                   -*-*- END -*-*-
+
+ 2001/10/05: Thomas Bretz
+
+   * manalysis/MHillas.cc, manalysis/MImgCleanStd.cc, mbase/MClone.[h,cc],
+     mbase/MFilterList.h, mbase/MWriteFile.h, mbase/MWriteRootFile.h,
+     mdatacheck/MGDisplayAdc.cc, meventdisp/MGCamDisplay.cc, 
+     meventdisp/MGCamDisplay.h, meventdisp/MGEvtDisplay.h,
+     mgui/MGeomPix.h, mhist/MFillH.h, mhist/MHHillas.h,
+     mmain/MAnalysis.h, mmain/MBrowser.h, mmain/MCameraDisplay.h,
+     mmain/MDataCheck.h, mmain/MEvtDisp.h, mmain/MMonteCarlo.h,
+     mraw/MRawFileRead.cc
+     - comments updated
+     
+   * mbase/MFilter.[h,cc]:
+     - made IsExpressionTrue abstract
+     
+   * meventdisp/MGEvtDisplay.cc:
+     - fixed a bug that only every second event was displayed
+
+   * meventdisp/MGFadcDisp.[h,cc]:
+     - reorganized code (changing pixel number drawed the histogram twice)
+     
+   * mgui/MCamDisplay.[h,cc]:
+     - added fDrawingPad to make sure that all output goes into the same pad
+     
+   * mhist/HistLinkDef.h, mhist/Makefile:
+     - removed old MFillH* classes
+
+
 
  2001/10/02: Thomas Bretz
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 959)
+++ trunk/MagicSoft/Mars/NEWS	(revision 961)
@@ -5,4 +5,11 @@
 
    - Added new GUI functionality (Analysis)
+
+   - Added a camera display to be able to display events in the camera
+     together with the calculated hillas ellipse
+
+   - Added a 'Clone'-Task (MClone) which can clone a parameter container
+     object at any state of the analysis, so that the output are several
+     states
 
 
Index: trunk/MagicSoft/Mars/manalysis/MHillas.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillas.cc	(revision 959)
+++ trunk/MagicSoft/Mars/manalysis/MHillas.cc	(revision 961)
@@ -30,5 +30,9 @@
 // Storage Container for the Hillas parameter                              //
 //                                                                         //
-// FIXME: Here everybody should find an explanation of the parameters      //
+// FIXME: - Here everybody should find an explanation of the parameters    //
+//        - using boooleans for fIsPixelUsed, fIsPixelCore, ... is rather  //
+//          slow because you have to loop over all pixels in any loop.     //
+//          There could be a huge speed improvement using Hash Tables      //
+//          (linked lists, see THashTable and THashList, too)              //
 //                                                                         //
 /////////////////////////////////////////////////////////////////////////////
@@ -160,4 +164,9 @@
 // (The calcualtion is some kind of two dimentional statistics)
 //
+//   FIXME: MHillas::Calc is rather slow at the moment because it loops
+//          unnecessarily over all pixels in all its loops (s.MImgCleanStd)
+//          The speed could be improved very much by using Hash-Tables
+//          (linked lists, see THashTable and THashList, too)
+//
 Bool_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
 {
Index: trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 959)
+++ trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 961)
@@ -31,4 +31,9 @@
 //  Please look at the three CleanSteps and Process                        //
 //                                                                         //
+//   FIXME: MImgCleanStd is rather slow at the moment because it loops     //
+//          unnecessarily over all pixels in all its loops (s.MHillas)     //
+//          The speed could be improved very much by using Hash-Tables     //
+//          (linked lists, see THashTable and THashList, too)              //
+//                                                                         //
 //  Input Containers:                                                      //
 //   MGeomCam, MCerPhotEvt                                                 //
Index: trunk/MagicSoft/Mars/mbase/MClone.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MClone.cc	(revision 959)
+++ trunk/MagicSoft/Mars/mbase/MClone.cc	(revision 961)
@@ -25,4 +25,24 @@
 //////////////////////////////////////////////////////////////////////////////
 //                                                                          //
+//  MClone                                                                  //
+//                                                                          //
+//  This task clones a given paramter container. You can either specify     //
+//  the name of the container which should be cloned or a pointer to the    //
+//  container. If you specify a name the preprocessing tries to find the    //
+//  corresponding container in the parameter list.                          //
+//  Cloning in this context means duplicating the object in memory. This    //
+//  may be used if you change an object in the eventloop (eg. the image     //
+//  cleaning is changing the image) and you want to compare both 'version'  //
+//  of this object afterwards.                                              //
+//  The cloned object can be accessed by using MClone::GetClone.            //
+//  To clone the container more than once use several instances of MClone.  //
+//  The object does only exist until a new object is cloned. It is deleted  //
+//  in the destructor.                                                      //
+//                                                                          //
+//  Input Containers:                                                       //
+//   MParContainer                                                          //
+//                                                                          //
+//  Output Containers:                                                      //
+//   -/-                                                                    //
 //                                                                          //
 //////////////////////////////////////////////////////////////////////////////
@@ -52,5 +72,5 @@
 // --------------------------------------------------------------------------
 //
-// Constructor.
+//  Constructor. Remembers the name to search for in the parameter list.
 //
 MClone::MClone(const char *par, const char *name, const char *title)
@@ -63,5 +83,5 @@
 // --------------------------------------------------------------------------
 //
-// Constructor.
+//  Constructor. Remember the pointer of the object which has to be cloned.
 //
 MClone::MClone(const MParContainer *par, const char *name, const char *title)
@@ -74,5 +94,5 @@
 // --------------------------------------------------------------------------
 //
-// Destructor.
+//  Destructor. Deletes the cloned object.
 //
 MClone::~MClone()
@@ -83,29 +103,44 @@
 // --------------------------------------------------------------------------
 //
-// Checks the parameter list for the existance of the parameter container. If
-// the name of it was given in the constructor. It checks also for the
-// existance of the histogram container in the parameter list if a name was
-// given. If it is not available it tried to create a histogram container
-// with the same type as the given object name.
+//  Checks the parameter list for the existance of the parameter container. If
+//  the name of it was given in the constructor.
 //
 Bool_t MClone::PreProcess(MParList *pList)
 {
-    if (!fParContainer)
-    {
-        fParContainer = (MParContainer*)pList->FindObject(fParContainerName);
-        if (!fParContainer)
-        {
-            *fLog << dbginf << fParContainerName << " not found... aborting." << endl;
-            return kFALSE;
-        }
-    }
-    return kTRUE;
+    //
+    // The pointer is already given by the user.
+    //
+    if (fParContainer)
+        return kTRUE;
+
+    //
+    // Try to find the parameter container with the given name in the list
+    //
+    fParContainer = (MParContainer*)pList->FindObject(fParContainerName);
+    if (fParContainer)
+        return kTRUE;
+
+    //
+    // If it couldn't get found stop Eventloop
+    //
+    *fLog << dbginf << fParContainerName << " not found... aborting." << endl;
+    return kFALSE;
 }
 
+// --------------------------------------------------------------------------
+//
+//  Delete the cloned object if one is existing
+//
 void MClone::Clear(Option_t *)
 {
+    //
+    // Check if an object has been initialized
+    //
     if (!fClone)
         return;
 
+    //
+    // Delete it and set the pointer to NULL for the sanity check (above)
+    //
     delete fClone;
     fClone = NULL;
@@ -114,10 +149,17 @@
 // --------------------------------------------------------------------------
 //
-// Fills the data from the parameter conatiner into the histogram container
+//  Deletes an existing clone and clones the object (parameter container)
+//  again.
 //
 Bool_t MClone::Process()
 {
+    //
+    // Delete an existing clone
+    //
     Clear();
 
+    //
+    // Clone the given parameter container
+    //
     fClone = fParContainer->Clone();
 
Index: trunk/MagicSoft/Mars/mbase/MClone.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MClone.h	(revision 959)
+++ trunk/MagicSoft/Mars/mbase/MClone.h	(revision 961)
@@ -15,8 +15,8 @@
 {
 private:
-    const MParContainer *fParContainer;
-    TString fParContainerName;
+    const MParContainer *fParContainer; // pointer to container which has to be cloned
+    TString fParContainerName;          // given name to search for in the parameterlist
 
-    TObject* fClone;
+    TObject* fClone;                    // pointer to the cloned object. deletion is handled by MClone
 
     void Init(const char *name, const char *title);
@@ -34,5 +34,5 @@
     void Clear(Option_t *opt=NULL);
 
-    ClassDef(MClone, 0) // Task to fill the Hillas parameters into histograms
+    ClassDef(MClone, 0) // Task to clone (duplicate) an object in memory
 };
     
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 959)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 961)
@@ -46,7 +46,10 @@
 // Afterwards the PostProcess functions are executed.                       //
 //                                                                          //
+//                                                                          //
+//  Maybe we can add a TProgressMeter sometimes later to be able to show    //
+//  the progress graphically...                                             //
+//                                                                          //
+//                                                                          //
 //////////////////////////////////////////////////////////////////////////////
-#include "MEvtLoop.h"
-
 #include <iostream.h>
 
@@ -98,5 +101,5 @@
 //
 // The proprocessing part of the eventloop. Be careful, this is
-// for developers use only!
+// for developers or use in special jobs only!
 //
 Bool_t MEvtLoop::PreProcess(const char *tlist)
@@ -144,5 +147,5 @@
 //
 // The processing part of the eventloop. Be careful, this is
-// for developers use only!
+// for developers or use in special jobs only!
 //
 void MEvtLoop::Process(Int_t maxcnt) const
@@ -200,5 +203,5 @@
 //
 //  The postprocessing part of the eventloop. Be careful, this is
-//  for developers use only!
+// for developers or use in special jobs only!
 //
 Bool_t MEvtLoop::PostProcess() const
@@ -218,10 +221,22 @@
     Bool_t rc = PreProcess();
 
+    //
+    // If all Tasks were PreProcesses successfully start Processing.
+    //
     if (rc)
         Process(maxcnt);
 
+    //
+    // Now postprocess all tasks. Only successfully preprocessed tasks are
+    // postprocessed. If the Postprocessing of one task fail return an error.
+    //
     if (!PostProcess())
         return kFALSE;
 
+    //
+    // If postprocessing of all preprocessed tasks was sucefully return rc.
+    // This gives an error in case the preprocessing has failed already.
+    // Otherwise the eventloop is considered: successfully.
+    //
     return rc;
 }
Index: trunk/MagicSoft/Mars/mbase/MFilter.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MFilter.cc	(revision 959)
+++ trunk/MagicSoft/Mars/mbase/MFilter.cc	(revision 961)
@@ -61,6 +61,6 @@
 //      collected in a MTaskList-object or are conected to the same        //
 //      filter.                                                            //
-//    - If you want to use different filters for one task please look for  //
-//      the MFilterList class.                                             //
+//    - If you want to use different filters (combined logically) for one  //
+//      task please look for the MFilterList class.                        //
 //    - Be careful, the return value of IsExpressionTrue is NOT a real     //
 //      boolean. You can return other values, too.                         //
@@ -71,11 +71,4 @@
 
 ClassImp(MFilter);
-
-// --------------------------------------------------------------------------
-//
-Bool_t MFilter::IsExpressionTrue() const
-{
-    return kTRUE;
-}
 
 // --------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mbase/MFilter.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MFilter.h	(revision 959)
+++ trunk/MagicSoft/Mars/mbase/MFilter.h	(revision 961)
@@ -1,12 +1,4 @@
 #ifndef MFILTER_H
 #define MFILTER_H
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MFilter                                                                 //
-//                                                                         //
-// Abstract base class for the filters                                     //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
 
 #ifndef MTASK_H
@@ -24,5 +16,5 @@
     }
 
-    virtual Bool_t IsExpressionTrue() const;
+    virtual Bool_t IsExpressionTrue() const = 0;
 
     virtual Bool_t PreProcess(MParList *pList);
Index: trunk/MagicSoft/Mars/mbase/MFilterList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MFilterList.h	(revision 959)
+++ trunk/MagicSoft/Mars/mbase/MFilterList.h	(revision 961)
@@ -44,5 +44,5 @@
     void Print(Option_t *opt = "");
 
-    ClassDef(MFilterList, 0)		// List of several filters
+    ClassDef(MFilterList, 0)		// List to combine several filters logically
 };
 
Index: trunk/MagicSoft/Mars/mbase/MTask.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 959)
+++ trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 961)
@@ -43,17 +43,23 @@
 //                     As an argument this function gets a pointer to the  //
 //                     parameter list. You can stop the execution by       //
-//                     kFALSE instread of kTRUE.                           //
+//                     returning kFALSE instead of kTRUE. If an error      //
+//                     occured and you return kFALSE make sure, that       //
+//                     any action is closed correctly and all newly        //
+//                     created object are deleted. The PostProcess in      //
+//                     such a case won't be executed by the Tasklist or    //
+//                     Eventloop.                                          //
 //                                                                         //
-//   - Process():      executed for each event in the eventloop. Do in     //
-//                     one task after the other (as the occur in the       //
-//                     tasklist) the action of one task. Only the tasks    //
-//                     with a Stream ID which matches the actual ID of the //
-//                     task list are executed. A task can return kFALSE    //
-//                     to stop the execuition of the pending taks in a     //
-//                     list or kCONTINUE to skip the pending tasks.        //
+//   - Process():      executed for each event in the eventloop. Do it     //
+//                     one task after the other (as they occur in the      //
+//                     tasklist). Only the tasks with a Stream ID          //
+//                     which matches the actual ID of the tasklist         //
+//                     are executed. A task can return kFALSE to           //
+//                     stop the execuition of the tasklist or              //
+//                     kCONTINUE to skip the pending tasks.                //
 //                                                                         //
 //   - PostProcess():  executed after the eventloop. Here you can close    //
 //                     output files, start display of the run parameter,   //
-//                     etc.                                                //
+//                     etc. PostProcess should be executed only if         //
+//                     PreProcess was successfull (returned kTRUE)         //
 //                                                                         //
 /////////////////////////////////////////////////////////////////////////////
@@ -72,5 +78,5 @@
 // the virtual implementation returns kTRUE
 //
-Bool_t MTask::PreProcess( MParList *pList )
+Bool_t MTask::PreProcess(MParList *pList)
 {
     return kTRUE;
Index: trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 959)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 961)
@@ -210,5 +210,5 @@
 // --------------------------------------------------------------------------
 //
-// do pre processing (before eventloop) of all tasks in the task-list
+//  do pre processing (before eventloop) of all tasks in the task-list
 //
 Bool_t MTaskList::PreProcess(MParList *pList)
@@ -297,5 +297,5 @@
         case kTRUE:
             //
-            // everything was OK: go on
+            // everything was OK: go on with the next task
             //
             continue;
@@ -319,12 +319,10 @@
 // --------------------------------------------------------------------------
 //
-// do post processing (before eventloop) of all tasks in the task-list
+//  do post processing (before eventloop) of all tasks in the task-list
+//  only tasks which have successfully been preprocessed are postprocessed.
 //
 Bool_t MTaskList::PostProcess()
 {
     *fLog << "Postprocessing... " << flush;
-
-    // FIXME: At the moment all tasks are post processed independ of
-    // whether it was preprocessed or not.
 
     //
@@ -347,4 +345,5 @@
     //
     //  loop over all tasks for postprocessing
+    //  only tasks which have successfully been preprocessed are postprocessed.
     //
     while ( (task=(MTask*)Next()) )
@@ -355,4 +354,7 @@
         *fLog << task->GetName() << "... " << flush;
 
+        //
+        // FIXME: should we only skip this task?
+        //
         if (!task->PostProcess())
             return kFALSE;
Index: trunk/MagicSoft/Mars/mbase/MWriteFile.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MWriteFile.h	(revision 959)
+++ trunk/MagicSoft/Mars/mbase/MWriteFile.h	(revision 961)
@@ -22,5 +22,5 @@
     virtual Bool_t PostProcess();
 
-    ClassDef(MWriteFile, 0)	// Class to write one container to an ascii file
+    ClassDef(MWriteFile, 0)	// Base class for tasks to write single containers to several output formats
 };
 
Index: trunk/MagicSoft/Mars/mbase/MWriteRootFile.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MWriteRootFile.h	(revision 959)
+++ trunk/MagicSoft/Mars/mbase/MWriteRootFile.h	(revision 961)
@@ -99,5 +99,5 @@
                       const char *tname=NULL, const char *ttitle=NULL);
 
-    ClassDef(MWriteRootFile, 0)	// Class to write one container to an ascii file
+    ClassDef(MWriteRootFile, 0)	// Class to write one container to a root file
 };
 
Index: trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc
===================================================================
--- trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc	(revision 959)
+++ trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc	(revision 961)
@@ -118,5 +118,5 @@
     */
 
-    radio1->SetState(kButtonDown);
+    radio3->SetState(kButtonDown);
 
     radio1->Associate(this);
Index: trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc	(revision 959)
+++ trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc	(revision 961)
@@ -25,20 +25,20 @@
 #include "MGCamDisplay.h"
 
-#include <TList.h>                // TList
-#include <TGButton.h>             // TGPictureButton
-#include <TGButtonGroup.h>
-
-#include "MClone.h"
-#include "MHillas.h"
-#include "MEvtLoop.h"
-#include "MParList.h"
-#include "MTaskList.h"
-#include "MReadTree.h"
-#include "MCamDisplay.h"
-#include "MHillasCalc.h"
-#include "MPedestalCam.h"
-#include "MCerPhotCalc.h"
-#include "MImgCleanStd.h"
-#include "MGeomCamMagic.h"
+#include <TList.h>          // TList::Add
+#include <TCanvas.h>        // TCanvas::cd
+#include <TGButton.h>       // TGPictureButton
+#include <TGButtonGroup.h>  // TGVButtonGroup
+
+#include "MClone.h"         // MClone
+#include "MHillas.h"        // MHillas
+#include "MParList.h"       // MParList::AddToList
+#include "MEvtLoop.h"       // MEvtLoop::GetParList
+#include "MTaskList.h"      // MTaskList::AddToList
+#include "MCamDisplay.h"    // MCamDisplay
+#include "MHillasCalc.h"    // MHillasCalc
+#include "MPedestalCam.h"   // MPedestalCam
+#include "MCerPhotCalc.h"   // MCerPhotCalc
+#include "MImgCleanStd.h"   // MImgCleanStd
+#include "MGeomCamMagic.h"  // MGeomMagicCam
 
 ClassImp(MGCamDisplay);
@@ -189,5 +189,8 @@
     hillas->Print();
     if (fDisplayHillas)
+    {
+        fCanvas->cd();
         hillas->Draw();
+    }
     else
         hillas->Clear();
Index: trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h	(revision 959)
+++ trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h	(revision 961)
@@ -36,5 +36,5 @@
     Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
 
-    ClassDef(MGCamDisplay, 0)
+    ClassDef(MGCamDisplay, 0) // Display for camera images (cerenkov events)
 };
 
Index: trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc	(revision 959)
+++ trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc	(revision 961)
@@ -481,5 +481,5 @@
     case kC_TEXTENTRY:
         if (GET_SUBMSG(msg) == kTE_ENTER)
-            ReadinEvent(atoi(fTxtEvtNr->GetText()));
+            ReadinEvent(atoi(fTxtEvtNr->GetText())-1);
         return kTRUE;
     }
Index: trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.h	(revision 959)
+++ trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.h	(revision 961)
@@ -71,5 +71,5 @@
     virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
 
-    ClassDef(MGEvtDisplay, 0)
+    ClassDef(MGEvtDisplay, 0) // base class to display something event by event
 };
 
Index: trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 959)
+++ trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 961)
@@ -54,5 +54,7 @@
 {
     M_PREVPIXEL = 0x1000,
-    M_NEXTPIXEL = 0x1001
+    M_NEXTPIXEL = 0x1001,
+
+    M_PIXELLIST = 0x1002
 };
 
@@ -127,8 +129,11 @@
 
     //
-    //   Map the window, set up the layout, etc.
-    //
-    SetWMSizeHints(450, 400, 1000, 1000, 10, 10 );      // set the smallest and biggest size of the Main frame
-
+    // set the smallest and biggest size of the Main frame
+    //
+    SetWMSizeHints(450, 400, 1000, 1000, 10, 10);
+
+    //
+    // Map the window, set up the layout, etc.
+    //
     MapSubwindows();
 
@@ -160,21 +165,25 @@
 //   the list of pixels in the fPixelList (TGListBox)
 //
-void MGFadcDisp::CreatePixelList(Int_t lastsel)
+void MGFadcDisp::DisplayPixel(Int_t lastsel, Bool_t update)
 {
     MRawEvtData *data = GetEvent();
 
-    //
-    //   put the selection of the last event in memory
-    //
     MRawEvtPixelIter pixel(data);
-    while (pixel.Next())
+
+    if (update)
     {
-        char txt[100];
-        sprintf(txt, "%d", pixel.GetPixelId());
-        fPixelList->AddEntry(txt, pixel.GetPixelId());
+        //
+        //   put the selection of the last event in memory
+        //
+        while (pixel.Next())
+        {
+            char txt[100];
+            sprintf(txt, "%d", pixel.GetPixelId());
+            fPixelList->AddEntry(txt, pixel.GetPixelId());
+        }
+
+        fPixelList->MapSubwindows();
+        fPixelList->Layout();
     }
-
-    fPixelList->MapSubwindows();
-    fPixelList->Layout();
 
     //
@@ -187,5 +196,5 @@
     {
         pixel.Reset();
-        lastsel=pixel.GetPixelId();
+        lastsel=0; //pixel.GetPixelId();
     }
 
@@ -194,4 +203,5 @@
     data->Draw(txt);
     fPixelList->Select(lastsel, kTRUE);
+    fPixelList->SetTopEntry(lastsel);
 
     fCanvas->Modified();
@@ -209,30 +219,5 @@
     fPixelList->RemoveEntries(0, GetEvent()->GetNumPixels());
 
-    CreatePixelList(lastsel);
-}
-
-// --------------------------------------------------------------------------
-//
-//  Display another pixel
-//
-void MGFadcDisp::DisplayPix(UInt_t i)
-{
-    MRawEvtData *data = GetEvent();
-
-    fCanvas->Clear();
-    fCanvas->cd();
-
-    char txt[256];
-    sprintf(txt, "GRAPH%d", i);
-    data->Draw(txt);
-
-    fCanvas->Modified();
-    fCanvas->Update();
-
-    //
-    // FIXME: too complicated!
-    //
-    fPixelList->RemoveEntries(0, data->GetNumPixels());
-    CreatePixelList(i);
+    DisplayPixel(lastsel);
 }
 
@@ -257,9 +242,9 @@
             {
             case M_PREVPIXEL:
-                DisplayPix(fPixelList->GetSelected()-1);
+                DisplayPixel(fPixelList->GetSelected()-1, kFALSE);
                 return kTRUE;
 
             case M_NEXTPIXEL:
-                DisplayPix(fPixelList->GetSelected()+1);
+                DisplayPixel(fPixelList->GetSelected()+1, kFALSE);
                 return kTRUE;
             }
@@ -270,5 +255,5 @@
                 break;
 
-            DisplayPix(fPixelList->GetSelected());
+            DisplayPixel(fPixelList->GetSelected(), kFALSE);
             return kTRUE;
         }
Index: trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h	(revision 959)
+++ trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h	(revision 961)
@@ -19,7 +19,6 @@
 
     void AddSetupElements();
-    void DisplayPix(UInt_t i);
     void UpdateDisplay();
-    void CreatePixelList(Int_t lastsel=-1);
+    void DisplayPixel(Int_t lastsel=-1, Bool_t update=kTRUE);
 
     MRawEvtData *GetEvent() const;
@@ -32,5 +31,5 @@
     virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
 
-    ClassDef(MGFadcDisp, 0)
+    ClassDef(MGFadcDisp, 0) // Display for single pixel fadc data
 };
 
Index: trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 959)
+++ trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 961)
@@ -89,7 +89,10 @@
     //
     if (!gPad)
-        new TCanvas("CamDisplay", "Magic Camera Display", 0, 0, 650, 500);
+        fDrawingPad = new TCanvas("CamDisplay", "Magic Camera Display", 0, 0, 650, 500);
     else
+    {
         gPad->Clear();
+        fDrawingPad = gPad;
+    }
 
     //
@@ -123,4 +126,5 @@
 void MCamDisplay::DrawPhotNum(const MCerPhotEvt *event)
 {
+    fDrawingPad->cd();
 
     //
@@ -172,4 +176,6 @@
 void MCamDisplay::DrawPhotErr(const MCerPhotEvt *event)
 {
+    fDrawingPad->cd();
+
     //
     // reset the all pixel colors to a default value
Index: trunk/MagicSoft/Mars/mgui/MCamDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamDisplay.h	(revision 959)
+++ trunk/MagicSoft/Mars/mgui/MCamDisplay.h	(revision 961)
@@ -20,4 +20,5 @@
 class TBox;
 class TText;
+class TVirtualPad;
 class TClonesArray;
 
@@ -38,4 +39,6 @@
     TClonesArray  *fLegend;
     TClonesArray  *fLegText;
+
+    TVirtualPad *fDrawingPad;
 
     TBox *GetBox(Int_t i)   { return (TBox*) fLegend->At(i); }
@@ -71,5 +74,5 @@
     }
 
-    ClassDef(MCamDisplay, 0) // Display the magic camera
+    ClassDef(MCamDisplay, 0) // Displays the magic camera
 };
 
Index: trunk/MagicSoft/Mars/mgui/MGeomCam.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomCam.h	(revision 959)
+++ trunk/MagicSoft/Mars/mgui/MGeomCam.h	(revision 961)
@@ -36,5 +36,5 @@
     virtual void Print(Option_t *opt=NULL);
 
-    ClassDef(MGeomCam, 1)		// Geometry base class for the camera
+    ClassDef(MGeomCam, 1)  // Geometry base class for the camera
 };
 
Index: trunk/MagicSoft/Mars/mgui/MGeomPix.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomPix.h	(revision 959)
+++ trunk/MagicSoft/Mars/mgui/MGeomPix.h	(revision 961)
@@ -9,35 +9,35 @@
 { 
 private:
-  Float_t fX;  // the x coordinate
-  Float_t fY;  // the y coordinate
-  Float_t fR;  // the r coordinate
+    Float_t fX;  // the x coordinate
+    Float_t fY;  // the y coordinate
+    Float_t fR;  // the r coordinate
 
-  Byte_t  fNumNeighbors; // number of valid neighbors
-  Short_t fNeighbors[6]; // the IDs of the pixel next to it
-                         // we are assuming an hexagonal geometry
+    Byte_t  fNumNeighbors; // number of valid neighbors
+    Short_t fNeighbors[6]; // the IDs of the pixel next to it
+                           // we are assuming an hexagonal geometry
 
 public:
-  MGeomPix(Float_t x=0. , Float_t y=0., Float_t r=0.) ;
-  
-  void Print(Option_t *opt=NULL) ;
+    MGeomPix(Float_t x=0, Float_t y=0, Float_t r=0);
 
-  void Set (Float_t x, Float_t y, Float_t r) { fX=x; fY=y; fR=r; }
+    void Print(Option_t *opt=NULL);
 
-  void SetNeighbors(Short_t i0=-1, Short_t i1=-1, Short_t i2=-1,
-                    Short_t i3=-1, Short_t i4=-1, Short_t i5=-1);
-  
-  void SetX (Float_t x) { fX = x; }
-  void SetY (Float_t y) { fY = y; }
-  void SetR (Float_t r) { fR = r; }
+    void Set (Float_t x, Float_t y, Float_t r) { fX=x; fY=y; fR=r; }
 
-  Float_t GetX() const  { return fX; }
-  Float_t GetY() const  { return fY; }
-  Float_t GetR() const  { return fR; }
+    void SetNeighbors(Short_t i0=-1, Short_t i1=-1, Short_t i2=-1,
+                      Short_t i3=-1, Short_t i4=-1, Short_t i5=-1);
 
-  Byte_t GetNumNeighbors() const { return fNumNeighbors; }
-  Short_t GetNeighbor(Byte_t i) const { return fNeighbors[i]; }
+    void SetX (Float_t x) { fX = x; }
+    void SetY (Float_t y) { fY = y; }
+    void SetR (Float_t r) { fR = r; }
 
-  ClassDef(MGeomPix, 1)		// Geometric class for one pixel
-} ; 
+    Float_t GetX() const  { return fX; }
+    Float_t GetY() const  { return fY; }
+    Float_t GetR() const  { return fR; }
+
+    Byte_t GetNumNeighbors() const { return fNumNeighbors; }
+    Short_t GetNeighbor(Byte_t i) const { return fNeighbors[i]; }
+
+    ClassDef(MGeomPix, 1) // Geometry class describing the geometry of one pixel
+};
 
 #endif
Index: trunk/MagicSoft/Mars/mgui/MHexagon.h
===================================================================
--- trunk/MagicSoft/Mars/mgui/MHexagon.h	(revision 959)
+++ trunk/MagicSoft/Mars/mgui/MHexagon.h	(revision 961)
@@ -24,36 +24,35 @@
 class MGeomPix;
 
-class MHexagon : public TObject, public TAttLine, public TAttFill 
-{ 
- protected: 
-  
-  Float_t      fX ;  // X coordinate  of center
-  Float_t      fY ;  // Y coordinate  of center
-  Float_t      fD ;  // diameter D or better distance between opposite sides
-  
- public: 
-  
-  MHexagon() ; 
-  MHexagon(Float_t x, Float_t y, Float_t d ) ;
-  MHexagon(MGeomPix &pix);
-  MHexagon( const MHexagon &hexagon) ; 
-  virtual ~MHexagon() ; 
+class MHexagon : public TObject, public TAttLine, public TAttFill
+{
+protected:
 
-  void Copy ( TObject &hexagon ) ; 
+    Float_t fX;  // X coordinate  of center
+    Float_t fY;  // Y coordinate  of center
+    Float_t fD;  // diameter D or better distance between opposite sides
 
-  virtual Int_t  DistancetoPrimitive(Int_t px, Int_t py ) ; 
-  virtual void   DrawHexagon( Float_t x, Float_t y, Float_t d ) ; 
-  
-  virtual void   ExecuteEvent(Int_t event, Int_t px, Int_t py ) ;  
-  
-  virtual void   ls (Option_t *Option="") ; 
-  virtual void   Paint(Option_t *Option="") ; 
-  virtual void   PaintHexagon(Float_t x, Float_t y, Float_t d) ; 
-  virtual void   Print(Option_t *Option="") ;
+public:
 
-  ClassDef ( MHexagon, 0 )    //  a hexagon for MAGIC
+    MHexagon();
+    MHexagon(Float_t x, Float_t y, Float_t d);
+    MHexagon(MGeomPix &pix);
+    MHexagon(const MHexagon &hexagon);
+    virtual ~MHexagon();
 
-} ; 
+    void Copy (TObject &hexagon);
 
-#endif  
+    virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
+    virtual void  DrawHexagon( Float_t x, Float_t y, Float_t d);
 
+    virtual void  ExecuteEvent(Int_t event, Int_t px, Int_t py);
+
+    virtual void  ls (Option_t *Option="");
+    virtual void  Paint(Option_t *Option="");
+    virtual void  PaintHexagon(Float_t x, Float_t y, Float_t d);
+    virtual void  Print(Option_t *Option="");
+
+    ClassDef(MHexagon, 0)    // A hexagon for MAGIC
+};
+
+#endif
+
Index: trunk/MagicSoft/Mars/mhist/HistLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/HistLinkDef.h	(revision 959)
+++ trunk/MagicSoft/Mars/mhist/HistLinkDef.h	(revision 961)
@@ -4,4 +4,6 @@
 #pragma link off all classes;
 #pragma link off all functions;
+
+#pragma link C++ class MFillH;
 
 #pragma link C++ class MH;
@@ -15,8 +17,3 @@
 #pragma link C++ class MHMcRate;
 
-#pragma link C++ class MFillH;
-#pragma link C++ class MFillHFadc;
-#pragma link C++ class MFillHHillas;
-#pragma link C++ class MFillHStarMap;
-
 #endif
Index: trunk/MagicSoft/Mars/mhist/MFillH.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MFillH.h	(revision 959)
+++ trunk/MagicSoft/Mars/mhist/MFillH.h	(revision 961)
@@ -34,5 +34,5 @@
     Bool_t PostProcess();
 
-    ClassDef(MFillH, 0) // Task to fill the Hillas parameters into histograms
+    ClassDef(MFillH, 0) // Task to fill a histogram with data from a parameter container
 };
     
Index: trunk/MagicSoft/Mars/mhist/MH.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH.h	(revision 959)
+++ trunk/MagicSoft/Mars/mhist/MH.h	(revision 961)
@@ -17,5 +17,5 @@
     virtual void Fill(const MParContainer *par) = 0;
 
-    ClassDef(MH, 1) // Container which holds hostograms for the Hillas parameters
+    ClassDef(MH, 1) //A histogram base class for Mars histograms
 };
 
Index: trunk/MagicSoft/Mars/mhist/MHHillas.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHHillas.h	(revision 959)
+++ trunk/MagicSoft/Mars/mhist/MHHillas.h	(revision 961)
@@ -35,5 +35,5 @@
     TObject *DrawClone(Option_t *opt=NULL);
 
-    ClassDef(MHHillas, 1) // Container which holds hostograms for the Hillas parameters
+    ClassDef(MHHillas, 1) // Container which hilds hostograms for the Hillas parameters
 };
 
Index: trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.h	(revision 959)
+++ trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.h	(revision 961)
@@ -42,5 +42,5 @@
     void CalcEfficiency();
 
-    ClassDef(MHMcCollectionArea, 1)  //  Data Container to calculate Collection Area
+    ClassDef(MHMcCollectionArea, 1)  // Data Container to calculate Collection Area
 };
 
Index: trunk/MagicSoft/Mars/mhist/MHMcRate.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcRate.h	(revision 959)
+++ trunk/MagicSoft/Mars/mhist/MHMcRate.h	(revision 961)
@@ -60,5 +60,5 @@
     TObject *DrawClone(Option_t *o=NULL);
 
-    ClassDef(MHMcRate, 1)  //  Data Container to calculate Collection Area
+    ClassDef(MHMcRate, 1)  // Data Container to calculate Collection Area
 };
 
Index: trunk/MagicSoft/Mars/mhist/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mhist/Makefile	(revision 959)
+++ trunk/MagicSoft/Mars/mhist/Makefile	(revision 961)
@@ -29,7 +29,4 @@
 
 SRCFILES = MFillH.cc \
-	   MFillHFadc.cc \
-           MFillHHillas.cc \
-           MFillHStarMap.cc \
            MH.cc \
            MHFadcPix.cc \
Index: trunk/MagicSoft/Mars/mmain/MAnalysis.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MAnalysis.h	(revision 959)
+++ trunk/MagicSoft/Mars/mmain/MAnalysis.h	(revision 961)
@@ -33,5 +33,5 @@
     Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
 
-    ClassDef(MAnalysis, 0) // GUI: The 'data-check' window.
+    ClassDef(MAnalysis, 0) // GUI: The 'Analysis' browser.
 };
 
Index: trunk/MagicSoft/Mars/mmain/MBrowser.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MBrowser.h	(revision 959)
+++ trunk/MagicSoft/Mars/mmain/MBrowser.h	(revision 961)
@@ -70,5 +70,5 @@
      virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
 
-     ClassDef(MBrowser, 0)   // Base class for the gui
+     ClassDef(MBrowser, 0)   // Base class for the Gui-Browsers
 } ; 
 
Index: trunk/MagicSoft/Mars/mmain/MCameraDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MCameraDisplay.h	(revision 959)
+++ trunk/MagicSoft/Mars/mmain/MCameraDisplay.h	(revision 961)
@@ -18,5 +18,5 @@
     Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
 
-    ClassDef(MCameraDisplay, 0) // GUI: The 'data-check' window.
+    ClassDef(MCameraDisplay, 0) // GUI: The 'camera display' browser.
 };
 
Index: trunk/MagicSoft/Mars/mmain/MDataCheck.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MDataCheck.h	(revision 959)
+++ trunk/MagicSoft/Mars/mmain/MDataCheck.h	(revision 961)
@@ -21,5 +21,5 @@
     Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
 
-    ClassDef(MDataCheck, 0) // GUI: The 'data-check' window.
+    ClassDef(MDataCheck, 0) // GUI: The 'data-check' browser.
 };
 
Index: trunk/MagicSoft/Mars/mmain/MEvtDisp.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MEvtDisp.h	(revision 959)
+++ trunk/MagicSoft/Mars/mmain/MEvtDisp.h	(revision 961)
@@ -18,5 +18,5 @@
     Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
 
-    ClassDef(MEvtDisp, 0)
+    ClassDef(MEvtDisp, 0) // GUI: The 'event display' browser.
 };
 
Index: trunk/MagicSoft/Mars/mmain/MMonteCarlo.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MMonteCarlo.h	(revision 959)
+++ trunk/MagicSoft/Mars/mmain/MMonteCarlo.h	(revision 961)
@@ -37,5 +37,5 @@
     Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
 
-    ClassDef(MMonteCarlo, 0) // GUI: The 'monte-carlo' window
+    ClassDef(MMonteCarlo, 0) // GUI: The 'monte-carlo' browser
 };
 
Index: trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawFileRead.cc	(revision 959)
+++ trunk/MagicSoft/Mars/mraw/MRawFileRead.cc	(revision 961)
@@ -23,19 +23,19 @@
 \* ======================================================================== */
 
-////////////////////////////////////////////////////////////////////////
-//
-//  MRawFile
-//
-//  This tasks reads the raw binary file like specified in the TDAS???
-//  and writes the data in the corresponding containers which are
-//  either retrieved from the parameter list or created and added.
-//
-//  Input Containers:
-//   -/-
-//
-//  Output Containers:
-//   MRawRunHeader, MRawEvtHeader, MRawEvtData, MRawCrateArray, MRawEvtTime
-//
-////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+//  MRawFile                                                                //
+//                                                                          //
+//  This tasks reads the raw binary file like specified in the TDAS???      //
+//  and writes the data in the corresponding containers which are           //
+//  either retrieved from the parameter list or created and added.          //
+//                                                                          //
+//  Input Containers:                                                       //
+//   -/-                                                                    //
+//                                                                          //
+//  Output Containers:                                                      //
+//   MRawRunHeader, MRawEvtHeader, MRawEvtData, MRawCrateArray, MTime       //
+//                                                                          //
+//////////////////////////////////////////////////////////////////////////////
 
 #include "MRawFileRead.h"
