Index: trunk/MagicSoft/Mars/mmain/MAnalysis.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 1023)
+++ trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 1030)
@@ -31,6 +31,4 @@
 #include <TGButton.h>      // TGTextButton
 #include <TGTextEntry.h>   // TGNumberEntry
-#include <TGProgressBar.h> // TGHProgressBar
-
 
 ClassImp(MAnalysis)
@@ -48,5 +46,5 @@
     fList->Add(hillas);
 
-    TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsLeft, 10, 10, 5, 5);
+    TGLayoutHints *laybut = new TGLayoutHints(kLHintsCenterY|kLHintsLeft, 10, 10, 5, 5);
     fList->Add(laybut);
 
@@ -209,11 +207,4 @@
     }
 
-    TGHProgressBar bar(fTop2);
-    TGLayoutHints laybar(kLHintsExpandX|kLHintsCenterY|kLHintsRight, 10, 10, 5, 5); //, 10); //, 5, 5);
-    bar.SetWidth(150);
-    fTop2->AddFrame(&bar, &laybar);
-    Layout();
-    MapSubwindows();
-
     //
     // Create a empty Parameter List and an empty Task List
@@ -252,5 +243,4 @@
     //
     MReadTree read("Events", fInputFile);
-    read.SetProgressBar(&bar);
 
     MCerPhotCalc ncalc;
@@ -277,5 +267,12 @@
     MEvtLoop evtloop;
     evtloop.SetParList(&plist);
-    evtloop.SetProgressBar(&bar);
+
+    //
+    // Add ProgressBar to window
+    //
+    TGProgressBar *bar = CreateProgressBar(fTop2);
+    read.SetProgressBar(bar);
+    evtloop.SetProgressBar(bar);
+
     //
     // Execute your analysis
@@ -283,7 +280,8 @@
     Bool_t rc = evtloop.Eventloop();
 
-    fTop2->RemoveFrame(&bar);
-    Layout();
-    MapSubwindows();
+    //
+    // Remove progressbar from window
+    //
+    DestroyProgressBar(bar);
 
     if (!rc)
Index: trunk/MagicSoft/Mars/mmain/MBrowser.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MBrowser.cc	(revision 1023)
+++ trunk/MagicSoft/Mars/mmain/MBrowser.cc	(revision 1030)
@@ -34,4 +34,5 @@
 #include <TGListBox.h>      // TGListBox
 #include <TGComboBox.h>     // TGComboBox
+#include <TGProgressBar.h>  // TGHProgressBar
 #include <TGFSContainer.h>  // TGFileContainer
 
@@ -80,15 +81,22 @@
 void MBrowser::CreateUpperFrame(TGCompositeFrame *frametop)
 {
+    TGLayoutHints *lay1 = new TGLayoutHints(kLHintsTop    |kLHintsExpandX, 2, 2, 2, 0);
+    TGLayoutHints *lay2 = new TGLayoutHints(kLHintsCenterY|kLHintsExpandX, 2, 2, 2, 2);
+    TGLayoutHints *lay3 = new TGLayoutHints(kLHintsBottom |kLHintsExpandX, 2, 2, 0, 2);
+    fList->Add(lay1);
+    fList->Add(lay2);
+    fList->Add(lay3);
 
     //
     // *********** Create Contents of frame top (upper part) **********
     //
-    fTop1 = new TGHorizontalFrame(frametop, 300, 100);
-    fTop2 = new TGHorizontalFrame(frametop, 300, 100);
-    fTop3 = new TGHorizontalFrame(frametop, 300, 100);
-
-    frametop->AddFrame(fTop1);
-    frametop->AddFrame(fTop2);
-    frametop->AddFrame(fTop3);
+    fTop1 = new TGHorizontalFrame(frametop, 500, 50);
+    fTop2 = new TGHorizontalFrame(frametop, 500, 50);
+    fTop3 = new TGHorizontalFrame(frametop, 500, 50);
+
+    // FIXME: If I use TGLayoutHints the Progress Bar doesn't disappear!
+    frametop->AddFrame(fTop1);//, lay1);
+    frametop->AddFrame(fTop2);//, lay2);
+    frametop->AddFrame(fTop3);//, lay3);
 
     fList->Add(fTop1);
@@ -271,7 +279,10 @@
     // ---- Create the top window with a lot of buttons ----
     //
+    TGLayoutHints *layframetop = new TGLayoutHints(kLHintsExpandX);
+    fList->Add(layframetop);
+
     TGCompositeFrame *frametop = new TGCompositeFrame(this, 300, 100, kVerticalFrame);
     fList->Add(frametop);
-    AddFrame(frametop);
+    AddFrame(frametop, layframetop);
 
     linesep = new TGHorizontal3DLine(this);
@@ -297,10 +308,7 @@
     //
     ChangeDir();
-    SetWMSizeHints(400, 350, 1000, 1000, 10, 10);      // set the smallest and biggest size of the Main frame
-}
-
-
-// ======================================================================
-// ======================================================================
+    SetWMSizeHints(400, 350, 1000, 1000, 10, 10); // set the smallest and biggest size of the Main frame
+}
+
 
 MBrowser::~MBrowser()
@@ -313,6 +321,33 @@
 } 
 
-// ======================================================================
-// ======================================================================
+TGProgressBar *MBrowser::CreateProgressBar(TGHorizontalFrame *frame)
+{
+    static TGLayoutHints laybar(kLHintsCenterY|kLHintsRight/*|kLHintsExpandX*/,
+                                10, 10);
+
+    TGHProgressBar *bar=new TGHProgressBar(frame);
+
+    bar->SetWidth(150);
+    bar->ShowPosition();
+
+    frame->AddFrame(bar, &laybar);
+
+    Layout();
+    MapSubwindows();
+
+    return bar;
+}
+
+void MBrowser::DestroyProgressBar(TGProgressBar *bar)
+{
+    TGHorizontalFrame *frame = (TGHorizontalFrame*)bar->GetParent();
+
+    frame->RemoveFrame(bar);
+
+    Layout();
+    MapSubwindows();
+
+    delete bar;
+}
 
 void MBrowser::CloseWindow()
@@ -326,8 +361,4 @@
 }
 
-
-// ======================================================================
-// ======================================================================
-
 Bool_t MBrowser::InputFileSelected() 
 {
@@ -337,8 +368,4 @@
     return fInputFile[0]!='\0';
 }
-
-
-// ======================================================================
-// ======================================================================
 
 void MBrowser::DisplError(const char *txt)
Index: trunk/MagicSoft/Mars/mmain/MBrowser.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MBrowser.h	(revision 1023)
+++ trunk/MagicSoft/Mars/mmain/MBrowser.h	(revision 1030)
@@ -14,4 +14,5 @@
 class TGListView;
 class TGComboBox;
+class TGProgressBar;
 class TGPictureButton;
 class TGFileContainer;
@@ -54,4 +55,7 @@
     void ChangeDir(const char *txt=NULL);
 
+    TGProgressBar *CreateProgressBar(TGHorizontalFrame *frame);
+    void DestroyProgressBar(TGProgressBar *bar);
+
     TGHorizontalFrame *fTop1;
     TGHorizontalFrame *fTop2;
Index: trunk/MagicSoft/Mars/mmain/MDataCheck.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MDataCheck.cc	(revision 1023)
+++ trunk/MagicSoft/Mars/mmain/MDataCheck.cc	(revision 1030)
@@ -56,6 +56,6 @@
 : MBrowser(main, p, w, h)
 {
-    TGTextButton *pedadc = new TGTextButton(fTop2, "ADC Spectra of Pedestals", kButPedAdc);
-    TGTextButton *cradc  = new TGTextButton(fTop2, "ADC Specta of Cosmics",    kButEvtAdc);
+    TGTextButton *pedadc = new TGTextButton(fTop1, "ADC Spectra of Pedestals", kButPedAdc);
+    TGTextButton *cradc  = new TGTextButton(fTop1, "ADC Specta of Cosmics",    kButEvtAdc);
     TGTextButton *pedtdc = new TGTextButton(fTop3, "TDC Spectra of Pedestals", kButPedTdc);
     TGTextButton *crtdc  = new TGTextButton(fTop3, "TDC Specta of Cosmics",    kButEvtTdc);
@@ -74,6 +74,6 @@
     fList->Add(laybut);
 
-    fTop2->AddFrame(pedadc, laybut);
-    fTop2->AddFrame(cradc,  laybut);
+    fTop1->AddFrame(pedadc, laybut);
+    fTop1->AddFrame(cradc,  laybut);
 
     fTop3->AddFrame(pedtdc, laybut);
@@ -115,9 +115,11 @@
     plist.AddToList(&tasks);
 
-    MReadTree readin(treeName, inputfile);
-    tasks.AddToList(&readin);
+    MReadTree read(treeName, inputfile);
+    read.DisableAutoScheme();
 
-    MFillH fillspect("MRawEvtData", "MHFadcCam");
-    tasks.AddToList(&fillspect);
+    MFillH fill("MRawEvtData", "MHFadcCam");
+
+    tasks.AddToList(&read);
+    tasks.AddToList(&fill);
 
     //
@@ -127,10 +129,22 @@
     magic.SetParList(&plist);
 
-    // ADD ProgressBar, TGHProgressBar::ShowStatus();
+    //
+    // Add ProgressBar to window
+    //
+    TGProgressBar *bar = CreateProgressBar(fTop1);
+    read.SetProgressBar(bar);
+    magic.SetProgressBar(bar);
 
     //
-    // start the loop running
+    // Execute your analysis
     //
-    if (!magic.Eventloop())
+    Bool_t rc = magic.Eventloop(300);
+
+    //
+    // Remove progressbar from window
+    //
+    DestroyProgressBar(bar);
+
+    if (!rc)
         return;
 
Index: trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc	(revision 1023)
+++ trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc	(revision 1030)
@@ -32,4 +32,5 @@
 #include <TGButton.h>       // TGTextButton
 #include <TGTextEntry.h>    // TGTextEntry
+#include <TGProgressBar.h>  // TGHProgressBar
 #include <TGButtonGroup.h>  // TGVButtonGroup
 
@@ -44,7 +45,7 @@
 void MMonteCarlo::AddButtons()
 {
-    TGTextButton *carea = new TGTextButton(fTop1, "Collection Area", M_BUTTON_COLAREA);
-    TGTextButton *trate = new TGTextButton(fTop1, "Trigger Rate",    M_BUTTON_RATE);
-    TGTextButton *thold = new TGTextButton(fTop1, "Threshold",       M_BUTTON_THRESHOLD);
+    TGTextButton *carea = new TGTextButton(fTop2, "Collection Area", M_BUTTON_COLAREA);
+    TGTextButton *trate = new TGTextButton(fTop2, "Trigger Rate",    M_BUTTON_RATE);
+    TGTextButton *thold = new TGTextButton(fTop2, "Threshold",       M_BUTTON_THRESHOLD);
 
     fList->Add(carea);
@@ -59,7 +60,7 @@
     fList->Add(laybut);
 
-    fTop1->AddFrame(carea, laybut);
-    fTop1->AddFrame(trate, laybut);
-    fTop1->AddFrame(thold, laybut);
+    fTop2->AddFrame(carea, laybut);
+    fTop2->AddFrame(trate, laybut);
+    fTop2->AddFrame(thold, laybut);
 }
 
@@ -208,5 +209,5 @@
 }
 
-void MMonteCarlo::CalculateCollectionArea() const
+void MMonteCarlo::CalculateCollectionArea()
 {
     //
@@ -231,10 +232,6 @@
     //  - Then we can fill the efficiency histograms
     //
-    MReadTree reader("Events", fInputFile);
-//    reader.UseLeaf("fImpact");
-//    reader.UseLeaf("fEnergy");
-//    reader.UseLeaf("fNumFirstLevel");
-
-    tlist.AddToList(&reader);
+    MReadTree read("Events", fInputFile);
+    tlist.AddToList(&read);
 
     MMcCollectionAreaCalc effi;
@@ -248,7 +245,21 @@
 
     //
-    // Start to loop over all events
-    //
-    if (!magic.Eventloop())
+    // Add ProgressBar to window
+    //
+    TGProgressBar *bar = CreateProgressBar(fTop2);
+    read.SetProgressBar(bar);
+    magic.SetProgressBar(bar);
+
+    //
+    // Execute your analysis
+    //
+    Bool_t rc = magic.Eventloop();
+
+    //
+    // Remove progressbar from window
+    //
+    DestroyProgressBar(bar);
+
+    if (!rc)
         return;
 
@@ -260,5 +271,5 @@
 }
 
-void MMonteCarlo::CalculateTriggerRate() const
+void MMonteCarlo::CalculateTriggerRate()
 {
     // This macro has two input parameter:
@@ -332,13 +343,6 @@
     //    analised trigger conditions should be set (BgR[])
     //
-    MReadTree reader("Events", fInputFile);
-/*    reader.UseLeaf("fImpact");
-    reader.UseLeaf("fEnergy");
-    reader.UseLeaf("fPhi");
-    reader.UseLeaf("fTheta");
-    reader.UseLeaf("fNumFirstLevel");
-    reader.UseLeaf("fPhotElfromShower");
-*/
-    tlist.AddToList(&reader);
+    MReadTree read("Events", fInputFile);
+    tlist.AddToList(&read);
 
     Float_t BgR[10]={660, 4, 0, 0, 0, 0, 0, 0, 0, 0};
@@ -354,7 +358,21 @@
 
     //
-    // Start to loop over all events
-    //
-    if (!magic.Eventloop())
+    // Add ProgressBar to window
+    //
+    TGProgressBar *bar = CreateProgressBar(fTop2);
+    read.SetProgressBar(bar);
+    magic.SetProgressBar(bar);
+
+    //
+    // Execute your analysis
+    //
+    Bool_t rc = magic.Eventloop();
+
+    //
+    // Remove progressbar from window
+    //
+    DestroyProgressBar(bar);
+
+    if (!rc)
         return;
 
@@ -362,5 +380,5 @@
 }
 
-void MMonteCarlo::CalculateThreshold() const
+void MMonteCarlo::CalculateThreshold()
 {
     const Int_t dim = GetDim();
@@ -423,8 +441,7 @@
     //      like one dimension MMcThresholdCalc
     //
+
     MReadTree read("Events", fInputFile);
-/*    read.UseLeaf("fEnergy");
-    read.UseLeaf("fNumFirstLevel");
-*/
+
     MMcThresholdCalc calc(dim);
     tlist.AddToList(&read);
@@ -435,8 +452,21 @@
 
     //
-    // Begin the loop (if the loop wasn't successfull
-    // don't try to draw the results
-    //
-    if (!evtloop.Eventloop())
+    // Add ProgressBar to window
+    //
+    TGProgressBar *bar = CreateProgressBar(fTop2);
+    read.SetProgressBar(bar);
+    evtloop.SetProgressBar(bar);
+
+    //
+    // Execute your analysis
+    //
+    Bool_t rc = evtloop.Eventloop();
+
+    //
+    // Remove progressbar from window
+    //
+    DestroyProgressBar(bar);
+
+    if (!rc)
         return;
 
Index: trunk/MagicSoft/Mars/mmain/MMonteCarlo.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MMonteCarlo.h	(revision 1023)
+++ trunk/MagicSoft/Mars/mmain/MMonteCarlo.h	(revision 1030)
@@ -20,7 +20,7 @@
     Int_t GetDim() const;
 
-    void CalculateCollectionArea() const;
-    void CalculateTriggerRate() const;
-    void CalculateThreshold() const;
+    void CalculateCollectionArea();
+    void CalculateTriggerRate();
+    void CalculateThreshold();
 
     void AddButtons();
