Index: trunk/MagicSoft/Mars/BUGS
===================================================================
--- trunk/MagicSoft/Mars/BUGS	(revision 949)
+++ trunk/MagicSoft/Mars/BUGS	(revision 949)
@@ -0,0 +1,8 @@
+                                                               -*-*- END -*-*-
+
+List of known bugs:
+-------------------
+
+ - if you try to use the constructor MFillH(const char *, ...)
+   in a precompiled program, the program will fail.
+   MFillH(MParContainer *, ...) works
Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 948)
+++ trunk/MagicSoft/Mars/Changelog	(revision 949)
@@ -9,8 +9,31 @@
      - fixed many, many memory leaks
      - small changes in layout
-     
+
+   * mmain/MAnalysis.[h,cc]:
+     - added
+
    * macros/*:
      - added Copyright notice
      - added some small sanity checks
+
+   * macros/MagicHillas.C:
+     - fixed '->' bug
+     - changed MFillHStarMap to MFillH
+     
+   * mbase/MReadTree.cc, mraw/MRawFileWrite.cc:
+     - removed an old debug statement
+     
+   * mmain/MMars.cc:
+     - added new Analysis functionality
+     
+   * mmain/MainLinkDef.h:
+     - addded MAnalysis
+     
+   * mmain/Makefile:
+     - added MAnalysis.cc
+     
+   * mmc/McLinkDef.h:
+     - removed nonsens define statement
+     
 
 
Index: trunk/MagicSoft/Mars/Makefile
===================================================================
--- trunk/MagicSoft/Mars/Makefile	(revision 948)
+++ trunk/MagicSoft/Mars/Makefile	(revision 949)
@@ -35,7 +35,8 @@
 #  ----->>>   mars libraries
 #
-SUBDIRS = mgui        \
-          mmain       \
+SUBDIRS = mmain       \
+          mgui        \
 	  manalysis   \
+          mbase       \
           meventdisp  \
           mdatacheck  \
@@ -43,5 +44,4 @@
           mhist       \
           mfilter     \
-          mbase       \
           mraw        \
           mmc
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 948)
+++ trunk/MagicSoft/Mars/NEWS	(revision 949)
@@ -3,4 +3,6 @@
 
  *** Version 0.5
+
+   - Added new GUI functionality (Analysis)
 
 
Index: trunk/MagicSoft/Mars/macros/MagicHillas.C
===================================================================
--- trunk/MagicSoft/Mars/macros/MagicHillas.C	(revision 948)
+++ trunk/MagicSoft/Mars/macros/MagicHillas.C	(revision 949)
@@ -37,5 +37,5 @@
 
     MTaskList tlist;
-    plist->AddToList(&tlist);
+    plist.AddToList(&tlist);
 
     //
@@ -44,8 +44,8 @@
     //
     MGeomCamMagic geomcam;
-    plist->AddToList(&geomcam);
+    plist.AddToList(&geomcam);
 
     MPedestalCam pedest;
-    plist->AddToList(&pedest);
+    plist.AddToList(&pedest);
 
     //
@@ -55,8 +55,8 @@
     //
     MHHillas *hists = new MHHillas;
-    plist->AddToList(hists);
+    plist.AddToList(hists);
 
     MHStarMap *smap = new MHStarMap;
-    plist->AddToList(smap);
+    plist.AddToList(smap);
 
     //
@@ -67,5 +67,5 @@
     //  3) clean the image                           MImgCleanStd
     //  4) calculate hillas                          MHillasCalc
-    //  5) fill the hillas into the histograms       MFillHHillas
+    //  5) fill the hillas into the histograms       MFillH
     //
 
@@ -76,5 +76,5 @@
     //   CalEvents:  Calibration Events
     //
-    MReadTree read("Events", "data/cer000020.root");
+    MReadTree read("Events", "data/octobertest.root");
     // read.AddFile("data/cer000019.root");
 
@@ -83,6 +83,7 @@
     MHillasCalc     hcalc;
     MFillH          hfill("MHillas", "MHHillas");
-    MFillHStarMap   sfill("MHillas", "MHStarMap");
-    MWriteRootFile write("hillas.root");
+    MFillH          sfill("MHillas", "MHStarMap");
+
+    MWriteRootFile  write("hillas.root");
     write.AddContainer("MHillas");
     write.AddContainer("MHHillas");
Index: trunk/MagicSoft/Mars/mbase/MReadTree.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 948)
+++ trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 949)
@@ -228,5 +228,4 @@
     //
     fChain->GetEntry(fNumEntry);
-    cout << " " << fChain->LoadTree(fNumEntry) << " "<<flush;
 
     fNumEntry++;
Index: trunk/MagicSoft/Mars/mmain/MAnalysis.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 949)
+++ trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 949)
@@ -0,0 +1,208 @@
+/* ======================================================================== *\
+!
+! *
+! * 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  9/2001 (tbretz@uni-sw.gwdg.de)
+!
+!   Copyright: MAGIC Software Development, 2000-2001
+!
+!
+\* ======================================================================== */
+
+#include "MAnalysis.h"
+
+#include <TGButton.h>  // TGTextButton
+
+ClassImp(MAnalysis)
+
+enum {
+  M_BUTTON_HILLAS
+};
+
+MAnalysis::MAnalysis(const TGWindow *main, const TGWindow *p,
+                     const UInt_t w, const UInt_t h)
+: MBrowser(main, p, w, h)
+{
+    TGTextButton *hillas = new TGTextButton(fTop2, "Calculate Standard Hillas", M_BUTTON_HILLAS);
+
+    hillas->Associate(this);
+
+    fList->Add(hillas);
+
+    TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsLeft, 10, 10, 5, 5);
+    fList->Add(laybut);
+
+    fTop2->AddFrame(hillas, laybut);
+
+    MapSubwindows();
+
+    Layout();
+
+    SetWindowName("Analysis Window");
+    SetIconName("Analysis");
+
+    MapWindow();
+}
+
+// ======================================================================
+
+#include "MParList.h"
+#include "MTaskList.h"
+#include "MGeomCamMagic.h"
+#include "MPedestalCam.h"
+#include "MHHillas.h"
+#include "MHStarMap.h"
+#include "MReadTree.h"
+#include "MCerPhotCalc.h"
+#include "MImgCleanStd.h"
+#include "MHillasCalc.h"
+#include "MFillH.h"
+#include "MEvtLoop.h"
+#include "MHillas.h"
+
+void MAnalysis::CalculateHillas(const char *fname)
+{
+    //
+    // This is a demonstration program which calculates the Hillas
+    // parameter out of a Magic root file.
+
+    //
+    // Create a empty Parameter List and an empty Task List
+    // The tasklist is identified in the eventloop by its name
+    //
+    MParList  plist;
+
+    MTaskList tlist;
+    plist.AddToList(&tlist);
+
+    //
+    // The geometry container must be created by yourself to make sure
+    // that you don't choos a wrong geometry by chance
+    //
+    MGeomCamMagic geomcam;
+    plist.AddToList(&geomcam);
+
+    MPedestalCam pedest;
+    plist.AddToList(&pedest);
+
+    //
+    // The Hillas histograms (MHHillas) could be created automatically
+    // but to make sure, that they are not deleted when the macro is
+    // finished you must create them yourself and add it to the list
+    //
+    MHillas hillas;
+    plist.AddToList(&hillas);
+
+    MHHillas *hists = new MHHillas;
+    plist.AddToList(hists);
+
+    MHStarMap *smap = new MHStarMap;
+    plist.AddToList(smap);
+
+    // FIXME: Where do we delete this two objects???
+
+    //
+    // Now setup the tasks and tasklist:
+    //
+    //  1) read in the data from a magic root file   MReadTree
+    //  2) calculate number of cerenkov photons      MCerPhotCalc
+    //  3) clean the image                           MImgCleanStd
+    //  4) calculate hillas                          MHillasCalc
+    //  5) fill the hillas into the histograms       MFillH
+    //
+
+    //
+    // The first argument is the tree you want to read.
+    //   Events:     Cosmic ray events
+    //   PedEvents:  Pedestal Events
+    //   CalEvents:  Calibration Events
+    //
+    MReadTree      read("Events", fname);
+    MCerPhotCalc   ncalc;
+    MImgCleanStd   clean;
+    MHillasCalc    hcalc;
+    MFillH         hfill(&hillas, hists);
+    MFillH         sfill(&hillas, smap);
+    //
+    // FIXME:
+    // -----
+    // I cannot use MFillH fill("name", "name") here.
+    // for me it is not yet clear why this doesn't work
+    //
+
+    /*
+     MWriteRootFile write("hillas.root");
+     write.AddContainer("MHillas");
+     write.AddContainer("MHHillas");
+     write.AddContainer(smap);
+     */
+
+    tlist.AddToList(&read);
+    tlist.AddToList(&ncalc);
+    tlist.AddToList(&clean);
+    tlist.AddToList(&hcalc);
+    tlist.AddToList(&hfill);
+    tlist.AddToList(&sfill);
+    //tlist.AddToList(&write);
+
+    //
+    // Create and setup the eventloop
+    //
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    //
+    // Execute your analysis
+    //
+    if (!evtloop.Eventloop())
+        return;
+
+    //
+    // After the analysis is finished we can display the histograms
+    //
+    hists->Draw();
+    smap->Draw();
+}
+
+// ======================================================================
+
+Bool_t MAnalysis::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
+{
+    // Process events generated by the buttons in the frame.
+
+    if (GET_MSG(msg)!=kC_COMMAND || GET_SUBMSG(msg)!=kCM_BUTTON)
+        return MBrowser::ProcessMessage(msg, parm1, parm2);
+
+    switch (parm1)
+    {
+    case M_BUTTON_HILLAS:
+        if (!InputFileSelected())
+        {
+            DisplError("No Input (root) File selected!");
+            return kTRUE;
+        }
+
+        switch (parm1)
+        {
+        case M_BUTTON_HILLAS:
+            CalculateHillas(fInputFile);
+            return kTRUE;
+        }
+        return kTRUE;
+    }
+
+    return MBrowser::ProcessMessage(msg, parm1, parm2);
+}
Index: trunk/MagicSoft/Mars/mmain/MAnalysis.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MAnalysis.h	(revision 949)
+++ trunk/MagicSoft/Mars/mmain/MAnalysis.h	(revision 949)
@@ -0,0 +1,28 @@
+#ifndef MANALYSIS_H
+#define MANALYSIS_H
+
+#ifndef MAGIC_H
+#include "MAGIC.h"
+#endif
+
+#ifndef MBROWSER_H
+#include "MBrowser.h"
+#endif
+
+class MAnalysis : public MBrowser
+{
+private:
+    void CalculateHillas(const char *fname);
+
+public:
+    MAnalysis(const TGWindow *main=NULL, const TGWindow *p=NULL,
+              const UInt_t w=500, const UInt_t h=500) ;
+
+    Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
+
+    ClassDef(MAnalysis, 0) // GUI: The 'data-check' window.
+};
+
+#endif
+
+
Index: trunk/MagicSoft/Mars/mmain/MMars.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MMars.cc	(revision 948)
+++ trunk/MagicSoft/Mars/mmain/MMars.cc	(revision 949)
@@ -36,4 +36,5 @@
 
 #include "MEvtDisp.h"
+#include "MAnalysis.h"
 #include "MDataCheck.h"
 #include "MMonteCarlo.h"
@@ -54,5 +55,5 @@
   M_BUTTON_ANALYSE,
   M_BUTTON_MONTECARLO
-} ; 
+};
 
 void MMars::CreateMenuBar()
@@ -263,5 +264,5 @@
 
             case M_BUTTON_ANALYSE:
-                DisplWarning("Analysis not yet implemented!");
+                new MAnalysis(this);
                 return kTRUE;
 
Index: trunk/MagicSoft/Mars/mmain/MainLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MainLinkDef.h	(revision 948)
+++ trunk/MagicSoft/Mars/mmain/MainLinkDef.h	(revision 949)
@@ -8,4 +8,5 @@
 
 #pragma link C++ class MMars;
+#pragma link C++ class MAnalysis;
 #pragma link C++ class MEvtDisp;
 #pragma link C++ class MDataCheck;
Index: trunk/MagicSoft/Mars/mmain/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mmain/Makefile	(revision 948)
+++ trunk/MagicSoft/Mars/mmain/Makefile	(revision 949)
@@ -22,5 +22,6 @@
 #  connect the include files defined in the config.mk file
 #
-INCLUDES = -I. -I../mbase -I../manalysis -I../mdatacheck -I../meventdisp
+INCLUDES = -I. -I../mbase -I../manalysis -I../mdatacheck -I../meventdisp \
+	   -I../mgui -I../mhist
 
 #------------------------------------------------------------------------------
@@ -31,4 +32,5 @@
 	   MEvtDisp.cc \
 	   MMars.cc \
+           MAnalysis.cc \
 	   MMonteCarlo.cc \
            MBrowser.cc
Index: trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc	(revision 948)
+++ trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc	(revision 949)
@@ -203,5 +203,5 @@
     //
     const UShort_t type = fRawEvtHeader->GetTrigType();
-    cout << "W" << flush;
+
     //
     // writa data to the tree. the tree is choosen by the type of the event
Index: trunk/MagicSoft/include-Classes/MMcFormat/McLinkDef.h
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/McLinkDef.h	(revision 948)
+++ trunk/MagicSoft/include-Classes/MMcFormat/McLinkDef.h	(revision 949)
@@ -1,4 +1,3 @@
 #ifdef __CINT__
-#define __CINT__
 
 #pragma link off all globals;
