Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1029)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1030)
@@ -1,3 +1,61 @@
                                                                   -*-*- END -*-*-
+
+ 2001/11/01: Thomas Bretz
+ 
+   * mbase/MParContainer.cc:
+     - removed 'newname' from TObject::Clone call.
+
+   * mbase/MParContainer.h:
+     - layout changes
+
+   * mbase/MParList.h:
+     - changed destructor definition to virtual
+
+   * mbase/MReadTree.[h,cc]:
+     - added initialization for fProgress
+     - changed output
+     - move some code to new functions
+     - branch enabling now checks for the existance of the branch
+     - veto branch disables the corresponding sub branches now physically
+     - changed comments
+
+   * mdatacheck/MGDisplayAdc.cc:
+     - added some sanity checks
+
+   * meventdisp/MGCamDisplay.cc, meventdisp/MGEvtDisplay.[h,cc],
+     meventdisp/MGFadcDisp.cc:
+     - moved some code to MGEvtDisplay
+
+   * mhist/MFillH.cc:
+     - added warning to comment
+
+   * mhist/MHFadcCam.[h,cc]:
+     - added Clone-function. It seems, that this is necessary since 
+       root 3.01
+
+   * mhist/MHFadcPix.cc:
+     - changed axis titles
+
+   * mmain/MAnalysis.cc:
+     - added progress bar
+
+   * mmain/MBrowser.[h,cc]:
+     - added layout hints to fTop1,2,3
+     - adde Create/DestroyProgrssBar
+
+   * mmain/MDataCheck.cc:
+     - changes to the layout
+     - disable auto scheme
+     - added progress bar
+
+   * mmain/MMonteCarlo.[h,cc]:
+     - layout changes
+     - added progress bar
+     
+   * mraw/MRawEvtData.cc:
+     - new sanity check in Draw
+
+
+
  2001/11/01: Thomas Bretz
 
@@ -40,5 +98,4 @@
      mgui/MGeomCam.cc, mhist/MHFadcPix.cc, mmc/MMcTrig.cxx:
      - removed inline statement, to make it link on alpha
-
 
 
Index: trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1029)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1030)
@@ -87,5 +87,5 @@
 {
 
-   MParContainer *named = (MParContainer*)TObject::Clone(newname);
+   MParContainer *named = (MParContainer*)TObject::Clone();
    if (newname && strlen(newname)) named->SetName(newname);
    return named;
Index: trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1029)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1030)
@@ -98,24 +98,25 @@
     MParContainer(const MParContainer &named);
     MParContainer& operator=(const MParContainer& rhs);
+    virtual ~MParContainer() {}
 
-    void SetLogStream(MLog *lg) { fLog = lg; }
+    virtual TObject    *Clone(const char *newname="") const;
+    virtual Int_t       Compare(const TObject *obj) const;
+    virtual void        Copy(TObject &named);
+    virtual void        FillBuffer(char *&buffer);
 
-    virtual TObject *Clone(const char *newname="") const;
-    virtual Int_t    Compare(const TObject *obj) const;
-    virtual void     Copy(TObject &named);
-    virtual void     FillBuffer(char *&buffer);
-    virtual const char  *GetName() const  { return fName.Data(); }
-    virtual const char  *GetTitle() const { return fTitle.Data(); }
-    virtual ULong_t  Hash()               { return fName.Hash(); }
-    virtual Bool_t   IsSortable() const   { return kTRUE; }
-    virtual void     SetName(const char *name); // *MENU*
-    virtual void     SetObject(const char *name, const char *title);
-    virtual void     SetTitle(const char *title=""); // *MENU*
-    virtual void     ls(Option_t *option="") const;
-    virtual void     Print(Option_t *option="") const;
-    virtual Int_t    Sizeof() const;
+    virtual const char *GetName() const    { return fName.Data(); }
+    virtual const char *GetTitle() const   { return fTitle.Data(); }
+    virtual ULong_t     Hash()             { return fName.Hash(); }
+    virtual Bool_t      IsSortable() const { return kTRUE; }
 
-    virtual void     Reset() {  }
+    virtual void        SetName(const char *name); // *MENU*
+    virtual void        SetObject(const char *name, const char *title);
+    virtual void        SetTitle(const char *title=""); // *MENU*
+    virtual void        ls(Option_t *option="") const;
+    virtual void        Print(Option_t *option="") const;
+    virtual Int_t       Sizeof() const;
 
+    virtual void   SetLogStream(MLog *lg) { fLog = lg; }
+    virtual void   Reset() { }
     virtual Bool_t IsReadyToSave()                   { return fReadyToSave; }
     virtual void   SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
Index: trunk/MagicSoft/Mars/mbase/MParList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.h	(revision 1029)
+++ trunk/MagicSoft/Mars/mbase/MParList.h	(revision 1030)
@@ -24,5 +24,5 @@
 {
 private:
-    TOrdCollection *fContainer;	// Collection of Parameter and Data Containers
+    TOrdCollection *fContainer;	 // Collection of Parameter and Data Containers
     TOrdCollection *fAutodelete; // All what this list contains is deleted in the destructor
 
@@ -36,5 +36,5 @@
     MParList(MParList &ts);
 
-    ~MParList();
+    virtual ~MParList();
 
     Bool_t AddToList(MParContainer *obj, MParContainer *where = NULL);
Index: trunk/MagicSoft/Mars/mbase/MReadTree.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 1029)
+++ trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 1030)
@@ -78,5 +78,5 @@
 MReadTree::MReadTree(const char *tname, const char *fname,
                      const char *name, const char *title)
-    : fNumEntry(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE)
+    : fNumEntry(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE), fProgress(NULL)
 {
     fName  = name  ? name  : "MReadTree";
@@ -165,20 +165,56 @@
 // --------------------------------------------------------------------------
 //
-// This is the implementation of the Auto Enabling Scheme.
-// For more information see MTask::AddBranchToList.
-// This function loops over all tasks in the tasklist and enables
-// all branches which are requested by the tasks.
-//
-// To enable 'unknown' branches which are not in the Branchlist of
-// the tasks you can call EnableBranch
+// Checks whether a branch with the given name exists in the chain
+// and sets the branch status of this branch corresponding to status.
+//
+void MReadTree::SetBranchStatus(TObject *branch, Bool_t status)
+{
+    //
+    // Get branch name
+    //
+    const char *name = branch->GetName();
+
+    //
+    // Check whether this branch really exists
+    //
+    if (!fChain->GetBranch(name))
+        return;
+
+    //
+    // Set the branch status
+    //
+    fChain->SetBranchStatus(name, status);
+    *fLog << (status ? "Enabled" : "Disabled");
+    *fLog << " subbranch '" << name << "'." << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+// Set the status of all branches in the list to status.
+//
+void MReadTree::SetBranchStatus(const TOrdCollection *list, Bool_t status)
+{
+    //
+    // Loop over all subbranches in this master branch
+    //
+    TIter Next(list);
+
+    TObject *obj;
+    while ((obj=Next()))
+        SetBranchStatus(obj, status);
+}
+
+// --------------------------------------------------------------------------
+//
+//  This is the implementation of the Auto Enabling Scheme.
+//  For more information see MTask::AddBranchToList.
+//  This function loops over all tasks in the tasklist and enables
+//  all branches which are requested by the tasks.
+//
+//  To enable 'unknown' branches which are not in the Branchlist of
+//  the tasks you can call EnableBranch
 //
 void MReadTree::EnableBranches(MParList *plist)
 {
-    //
-    // if auto enabling is off reject the request
-    //
-    if (!fAutoEnable)
-        return;
-
     //
     // check whether branch choosing must be switched on
@@ -198,27 +234,26 @@
 
     //
-    // Loo over all tasks in the task list.
+    // Loop over all tasks in the task list.
     //
     MTask *task;
     TIter NextTask(tlist->GetList());
     while ((task=(MTask*)NextTask()))
-    {
-        //
-        // Loop over all branches of this task
-        //
-        TNamed *branch;
-        TIter NextBranch(task->GetListOfBranches());
-        while ((branch=(TNamed*)NextBranch()))
-        {
-            //
-            // Get branch name to enable and enable the branch
-            //
-            const char *name = branch->GetName();
-
-            *fLog << "Enabeling '" << name << "'." << endl;
-
-            fChain->SetBranchStatus(name, kTRUE);
-        }
-    }
+        SetBranchStatus(task->GetListOfBranches(), kTRUE);
+}
+
+// --------------------------------------------------------------------------
+//
+//  The disables all subbranches of the given master branch.
+//
+void MReadTree::DisableSubBranches(TBranch *branch)
+{
+    //
+    // This is not necessary, it would work without. But the output
+    // may confuse the user...
+    //
+    if (fAutoEnable || fBranchChoosing)
+        return;
+
+    SetBranchStatus(branch->GetListOfBranches(), kFALSE);
 }
 
@@ -244,5 +279,5 @@
     if (!fNumEntries)
     {
-        *fLog << dbginf << "No entries found in chain (file/s)." << endl;
+        *fLog << dbginf << "No entries found in file(s)." << endl;
         return kFALSE;
     }
@@ -276,5 +311,6 @@
         if (fVetoList->FindObject(name))
         {
-            *fLog << "Branch " << name << " has veto... skipped." << endl;
+            *fLog << "Master branch " << name << " has veto... skipped." << endl;
+            DisableSubBranches(branch);
             continue;
         }
@@ -299,4 +335,5 @@
             //
             *fLog << dbginf << "Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl;
+            DisableSubBranches(branch);
             continue;
         }
@@ -308,13 +345,20 @@
         fChain->SetBranchAddress(name, pcont);
 
-        *fLog << "Branch " << name << " setup for reading." << endl;
+        *fLog << "Master branch address " << name << " setup for reading." << endl;
 
         num++;
     }
 
-    *fLog << "MReadTree setup " << num << " branches." << endl;
-
-    EnableBranches(pList);
-
+    *fLog << "MReadTree setup " << num << " master branches addresses." << endl;
+
+    //
+    // If auto enabling scheme isn't disabled, do auto enabling
+    //
+    if (fAutoEnable)
+        EnableBranches(pList);
+
+    //
+    // If a progress bar is given set its range.
+    //
     if (fProgress)
         fProgress->SetRange(0, fNumEntries);
@@ -351,15 +395,12 @@
 Bool_t MReadTree::DecEventNum(UInt_t dec)
 {
-    //!
-    //! this function makes Process() read the event one (or more) before
-    //! the actual position (event) in the tree
-    //!
-    if (fNumEntry < dec/*+1*/)
-    {
-        *fLog << "MReadTree::SetPrevEvent: WARNING: " << fNumEntry/*-1*/ << "-" << dec << " out of Range." << endl;
+    if (fNumEntry-dec >= fNumEntries)
+    {
+        *fLog << "MReadTree::DecEventNum: WARNING - Event " << fNumEntry << "-";
+        *fLog << dec << "=" << (Int_t)fNumEntry-dec << " out of Range." << endl;
         return kFALSE;
     }
 
-    fNumEntry -= dec/*+1*/;
+    fNumEntry -= dec;
     return kTRUE;
 }
@@ -372,17 +413,12 @@
 Bool_t MReadTree::IncEventNum(UInt_t inc)
 {
-    //!
-    //! this function makes Process() read the next (or more) after
-    //! the actual position (event) in the tree
-    //! (Be careful: IncEventNum() or IncEventNum(1) does not chenge anything
-    //!  in the standard behaviour of the task)
-    //!
-    if (fNumEntry+inc/*-1*/ >= fNumEntries)
-    {
-        *fLog << "MReadTree::SkipEvents: WARNING: " << fNumEntry/*-1*/ << "+" << inc << " out of Range." << endl;
+    if (fNumEntry+inc >= fNumEntries)
+    {
+        *fLog << "MReadTree::IncEventNum: WARNING - Event " << fNumEntry << "+";
+        *fLog << inc << "=" << (Int_t)fNumEntry+inc << " out of Range." << endl;
         return kFALSE;
     }
 
-    fNumEntry += inc/*-1*/;
+    fNumEntry += inc;
     return kTRUE;
 }
@@ -390,5 +426,5 @@
 // --------------------------------------------------------------------------
 //
-// this function makes Process() read event number nr next
+// This function makes Process() read event number nr next
 //
 // Remark: You can use this function after instatiating you MReadTree-object
@@ -397,7 +433,7 @@
 Bool_t MReadTree::SetEventNum(UInt_t nr)
 {
-    if (nr>=fNumEntries)
-    {
-        *fLog << "MReadTree::SetEventNum: WARNING: " << nr << " out of Range." << endl;
+    if (nr >= fNumEntries)
+    {
+        *fLog << "MReadTree::SetEventNum: WARNING - " << nr << " out of Range." << endl;
         return kFALSE;
     }
@@ -409,7 +445,10 @@
 // --------------------------------------------------------------------------
 //
-// If you don't want that an object is created for this branch
-// and/or the branch address is set in the Preprocessing of
-// MReadTree use VetoBranch. This saves mainly memory space.
+//  For the branch with the given name:
+//   1) no object is automatically created
+//   2) the branch address for this branch is not set
+//      (because we lack the object, see 1)
+//   3) The whole branch (exactly: all its subbranches) are disabled
+//      this means are not read in memory by TTree:GetEntry
 //
 void MReadTree::VetoBranch(const char *name)
Index: trunk/MagicSoft/Mars/mbase/MReadTree.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MReadTree.h	(revision 1029)
+++ trunk/MagicSoft/Mars/mbase/MReadTree.h	(revision 1030)
@@ -7,4 +7,5 @@
 
 class TChain;
+class TBranch;
 class TGProgressBar;
 
@@ -22,22 +23,26 @@
     TOrdCollection *fVetoList; // List of Branches which are not allowed to get enabled
 
-    TGProgressBar *fProgress;  // Possible display of status
+    TGProgressBar  *fProgress; // Possible display of status
 
+    void SetBranchStatus(const TOrdCollection *list, Bool_t status);
+    void SetBranchStatus(TObject *branch, Bool_t status);
+
+    void DisableSubBranches(TBranch *b);
     void EnableBranches(MParList *plist);
     void EnableBranchChoosing();
 
+    Bool_t PreProcess(MParList *pList);
+    Bool_t Process();
+  
 public:
     MReadTree(const char *treename, const char *filename=NULL, const char *name=NULL, const char *title=NULL);
     ~MReadTree();
 
-    Bool_t PreProcess(MParList *pList);
-    Bool_t Process();
+    Int_t  AddFile(const char *fname);
+    void   DisableAutoScheme() { fAutoEnable = kFALSE; }
+    void   EnableBranch(const char *name);
+    void   VetoBranch(const char *name);
 
     void   SetProgressBar(TGProgressBar *bar) { fProgress = bar; }
-
-    Int_t  AddFile(const char *fname);
-    void   VetoBranch(const char *name);
-
-    void   EnableBranch(const char *name);
 
     Bool_t GetEvent();
@@ -50,7 +55,5 @@
     UInt_t GetEntries() const  { return fNumEntries; }
 
-    void   DisableAutoScheme() { fAutoEnable = kFALSE; }
-
-    ClassDef(MReadTree, 0)	// Reads one tree
+    ClassDef(MReadTree, 0)	// Reads a tree from file(s)
 };
 
Index: trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc
===================================================================
--- trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc	(revision 1029)
+++ trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc	(revision 1030)
@@ -279,6 +279,4 @@
 }  
 
-// ======================================================================
-
 void MGDisplayAdc::CloseWindow()
 {
@@ -289,9 +287,4 @@
     delete this;
 }
-
-
-
-// ======================================================================
-// ======================================================================
 
 Bool_t MGDisplayAdc::BuildHistoList()
@@ -307,5 +300,6 @@
     //
     const Int_t nhi = fHists->GetEntries();
-    for (Int_t i=0 ; i<nhi; i++)
+
+    for (Int_t i=0; i<nhi; i++)
         fHistoList->AddEntry(fHists->GetHistHi(i)->GetName(), i+1);
 
@@ -316,9 +310,13 @@
 } 
 
-// ======================================================================
-// ======================================================================
 void MGDisplayAdc::UpdateHist()
 {
     const Int_t selected = fHistoList->GetSelected();
+
+    if (selected<0)
+    {
+        cout << "MGDisplayAdc: No histograms found in list. " << endl;
+        return;
+    }
 
     fHistoList->Select(selected); // ???
Index: trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc	(revision 1029)
+++ trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc	(revision 1030)
@@ -115,9 +115,4 @@
     plist->AddToList(pedest);
 
-    fInitOk = fEvtLoop->PreProcess();
-
-    if (fInitOk)
-        GetTaskList()->Process();
-
     return geom;
 }
@@ -147,6 +142,7 @@
     fDisplay = new MCamDisplay(geom);
     fDisplay->Draw();
-
     fList->Add(fDisplay);
+
+    ReadFirstEvent();
 
     //
@@ -161,8 +157,4 @@
     SetWindowName("Hillas Event Display");
     SetIconName("Hillas");
-
-    UpdateDisplay();
-    UpdateNumOfEvts();
-    UpdateEventCounter();
 
     MapWindow();
@@ -177,5 +169,5 @@
 void MGCamDisplay::UpdateDisplay()
 {
-    if (!fInitOk)
+    if (!IsInitOk())
         return;
 
Index: trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc	(revision 1029)
+++ trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc	(revision 1030)
@@ -139,16 +139,4 @@
 // --------------------------------------------------------------------------
 //
-//  Show the correct number of events
-//
-void MGEvtDisplay::UpdateNumOfEvts()
-{
-    char txt[100];
-    sprintf(txt, "out of %d Events", GetReader()->GetEntries());
-
-    fNumOfEvts->SetText(new TGString(txt));
-}
-
-// --------------------------------------------------------------------------
-//
 //  Add the second part of the top frame: This are the event number controls
 //
@@ -405,5 +393,4 @@
     AddMenuBar();
     AddFrames(fname, tname);
-    UpdateEventCounter();
 }
 
@@ -435,43 +422,24 @@
 //  and updates the display
 //
-void MGEvtDisplay::ReadinEvent(UInt_t iEvt)
-{
-    if (!fInitOk)
-        return;
-
-    Int_t buttons = 4;
-    Int_t retval  = 0;
-
-    //
-    //  first check if the new event is in the range of possible events
-    //
-    if (iEvt >= GetReader()->GetEntries())
+void MGEvtDisplay::ReadinEvent()
+{
+    if (GetTaskList()->Process())
     {
-        new TGMsgBox(gClient->GetRoot(), this, "WARNING!",
-                     "The event number is out of range!!!",
-                     kMBIconExclamation, buttons, &retval);
+        GetReader()->DecEventNum();
+        UpdateDisplay();
     }
-    else
-    {
-        GetReader()->SetEventNum(iEvt);
-
-        if (GetTaskList()->Process())
-            UpdateDisplay();
-    }
-
-    UpdateEventCounter();
-}
-
-// --------------------------------------------------------------------------
-//
-//  Update the event counter
-//
-void MGEvtDisplay::UpdateEventCounter()
-{
-    char txt[256];
-
-    sprintf(txt, "%d", GetReader()->GetEventNum());
-
-    fTxtEvtNr->SetText(txt);
+
+    fTxtEvtNr->SetText(Form("%d", GetReader()->GetEventNum()+1));
+}
+
+void MGEvtDisplay::ReadFirstEvent()
+{
+    fInitOk = fEvtLoop->PreProcess();
+
+    if (fInitOk)
+        ReadinEvent();
+
+    TGString *txt = new TGString(Form("out of %d Events", GetReader()->GetEntries()));
+    fNumOfEvts->SetText(txt);
 }
 
@@ -526,5 +494,5 @@
 // --------------------------------------------------------------------------
 //
-//    ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
+//  ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
 //
 // Processes information from all GUI items.
@@ -535,62 +503,38 @@
 Bool_t MGEvtDisplay::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
 {
-    switch(GET_MSG(msg))
+    if (GET_MSG(msg)!=kC_TEXTENTRY && GET_MSG(msg)!=kC_COMMAND)
+        return kTRUE;
+
+    switch(GET_SUBMSG(msg))
     {
-    case kC_COMMAND:
+    case kTE_ENTER:
+    case kCM_BUTTON:
+        if (parm1==kClose)
+        {
+            CloseWindow();
+            return kTRUE;
+        }
+
+        if (!fInitOk)
+            return kTRUE;
+
         switch(GET_SUBMSG(msg))
         {
+        case kTE_ENTER:
+            if (GetReader()->SetEventNum(atoi(fTxtEvtNr->GetText())-1))
+                ReadinEvent();
+            return kTRUE;
+
         case kCM_BUTTON:
             switch (parm1)
             {
             case kEvtPrev:
-                //
-                // '-2' is because MReadTree::Process increases the
-                // Event number by one - this is the natural behaviour
-                // after reading one event
-                //
-                ReadinEvent(GetReader()->GetEventNum()-2);
+                if (GetReader()->DecEventNum())
+                    ReadinEvent();
                 return kTRUE;
 
             case kEvtNext:
-                //
-                // '+0' is because MReadTree::Process increases the
-                // Event number by one - this is the natural behaviour
-                // after reading one event
-                //
-                ReadinEvent(GetReader()->GetEventNum());
-                return kTRUE;
-
-            case kClose:
-                CloseWindow();
-                return kTRUE;
-            }
-            return kTRUE;
-
-        case kCM_MENU:
-            switch (parm1)
-            {
-            case kFileSaveAs:
-                SaveAsDialog();
-                return kTRUE;
-            case kFileSaveAsRoot:
-                fCanvas->SaveAs("display.root");
-                return kTRUE;
-            case kFileSaveAsC:
-                fCanvas->SaveSource("display.C");
-                return kTRUE;
-            case kFileSaveAsPS:
-                fCanvas->SaveAs("display.ps");
-                return kTRUE;
-            case kFileSaveAsEPS:
-                fCanvas->SaveAs("display.eps");
-                return kTRUE;
-            case kFileSaveAsGIF:
-                fCanvas->SaveAs("display.gif");
-                return kTRUE;
-            case kFilePrint:
-                fCanvas->Print();
-                return kTRUE;
-            case kClose:
-                CloseWindow();
+                if (GetReader()->IncEventNum())
+                    ReadinEvent();
                 return kTRUE;
             }
@@ -599,10 +543,35 @@
         return kTRUE;
 
-    case kC_TEXTENTRY:
-        if (GET_SUBMSG(msg) == kTE_ENTER)
-            ReadinEvent(atoi(fTxtEvtNr->GetText())-1);
+    case kCM_MENU:
+        switch (parm1)
+            {
+            case kFileSaveAs:
+                SaveAsDialog();
+                return kTRUE;
+            case kFileSaveAsRoot:
+                fCanvas->SaveAs("display.root");
+                return kTRUE;
+            case kFileSaveAsC:
+                // FIXME: The line opening the canvas is wrong.
+                fCanvas->SaveSource("display.C");
+                return kTRUE;
+            case kFileSaveAsPS:
+                fCanvas->SaveAs("display.ps");
+                return kTRUE;
+            case kFileSaveAsEPS:
+                fCanvas->SaveAs("display.eps");
+                return kTRUE;
+            case kFileSaveAsGIF:
+                fCanvas->SaveAs("display.gif");
+                return kTRUE;
+            case kFilePrint:
+                fCanvas->Print();
+                return kTRUE;
+            case kClose:
+                CloseWindow();
+                return kTRUE;
+            }
         return kTRUE;
     }
-
     return kTRUE;
 }
Index: trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.h	(revision 1029)
+++ trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.h	(revision 1030)
@@ -40,6 +40,7 @@
 
     void SaveAsDialog() const;
+    void ReadinEvent();
 
-    void ReadinEvent(UInt_t iEvt);
+    Bool_t fInitOk;
 
 protected:
@@ -54,12 +55,10 @@
     TGVerticalFrame  *fMidFrame;
 
-    Bool_t fInitOk;
-
     MParList  *GetParList() const;
     MTaskList *GetTaskList() const;
     MReadTree *GetReader() const;
 
-    void UpdateEventCounter();
-    void UpdateNumOfEvts();
+    void   ReadFirstEvent();
+    Bool_t IsInitOk() { return fInitOk; }
 
     virtual void UpdateDisplay() = 0;
Index: trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 1029)
+++ trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc	(revision 1030)
@@ -125,8 +125,6 @@
     // preprocess eventloop and read in first event (process)
     //
-    fInitOk = fEvtLoop->PreProcess();
-
-    if (fInitOk)
-        GetTaskList()->Process();
+    GetReader()->DisableAutoScheme();
+    ReadFirstEvent();
 
     //
@@ -144,8 +142,4 @@
     SetWindowName("Fadc Event Display");
     SetIconName("Fadc");
-
-    UpdateDisplay();
-    UpdateNumOfEvts();
-    UpdateEventCounter();
 
     MapWindow();
@@ -220,5 +214,5 @@
 void MGFadcDisp::UpdateDisplay()
 {
-    if (!fInitOk)
+    if (!IsInitOk())
         return;
 
Index: trunk/MagicSoft/Mars/mhist/MFillH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 1029)
+++ trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 1030)
@@ -25,5 +25,5 @@
 //////////////////////////////////////////////////////////////////////////////
 //                                                                          //
-//  MFill                                                                   //
+//  MFillH                                                                  //
 //                                                                          //
 //  This is a common interface (task) to fill mars histograms. Every mars   //
@@ -35,4 +35,12 @@
 //  objects in the parameter list or by specifiing a pointer to the object. //
 //  (s. Constructor)                                                        //
+//                                                                          //
+//  WARNING:                                                                //
+//   Because MFillH is a generalized task to fill histograms it doesn't     //
+//   know about which branches from a file are necessary to fill the        //
+//   histograms. If you are reading data from a file which is directly      //
+//   filled into a histogram via MFillH, please call either                 //
+//   MReadTree::DisableAutoScheme() or enable the necessary branches by     //
+//   yourself, using MReadTree::EnableBranch()                              //
 //                                                                          //
 //  Input Containers:                                                       //
Index: trunk/MagicSoft/Mars/mhist/MHFadcCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHFadcCam.cc	(revision 1029)
+++ trunk/MagicSoft/Mars/mhist/MHFadcCam.cc	(revision 1030)
@@ -44,12 +44,12 @@
 //  creates an a list of histograms for all pixels and both gain channels
 //
-MHFadcCam::MHFadcCam (const char *name, const char *title)
+#include <iostream.h>
+MHFadcCam::MHFadcCam(const char *name, const char *title)
 {
     //
     //   set the name and title of this object
     //
-    
-    fName  = name  ? name  : "MHFadcCam" ;
-    fTitle = title ? title : "Container for ADC spectra histograms" ;
+    fName  = name  ? name  : "MHFadcCam";
+    fTitle = title ? title : "Container for ADC spectra histograms";
 
     //
@@ -65,7 +65,24 @@
 
 // --------------------------------------------------------------------------
-MHFadcCam::~MHFadcCam ()
+MHFadcCam::~MHFadcCam()
 {
     delete fArray;
+}
+
+// --------------------------------------------------------------------------
+//
+// Our own clone function is necessary since root 3.01/06 or Mars 0.4
+// I don't know the reason
+//
+TObject *MHFadcCam::Clone(const char *) const
+{
+    MHFadcCam *cam = new MHFadcCam;
+
+    for (int i=0; i<577; i++)
+    {
+        delete (*cam->fArray)[i];
+        (*cam->fArray)[i] = (MHFadcPix*)(*fArray)[i]->Clone();
+    }
+    return cam;
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHFadcCam.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHFadcCam.h	(revision 1029)
+++ trunk/MagicSoft/Mars/mhist/MHFadcCam.h	(revision 1030)
@@ -26,5 +26,5 @@
 
 public:
-     MHFadcCam(const char *name=NULL, const char *title=NULL);
+    MHFadcCam(const char *name=NULL, const char *title=NULL);
     ~MHFadcCam();
 
@@ -46,5 +46,7 @@
     void DrawPix(UInt_t i)     { (*this)[i]->Draw(); }
 
-    Int_t GetEntries()         { return fArray->GetEntries(); }
+    Int_t GetEntries() const   { return fArray->GetEntries(); }
+
+    TObject *Clone(const char *opt="") const;
 
     ClassDef(MHFadcCam, 1) // A list of histograms storing the Fadc spektrum of one pixel
Index: trunk/MagicSoft/Mars/mhist/MHFadcPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHFadcPix.cc	(revision 1029)
+++ trunk/MagicSoft/Mars/mhist/MHFadcPix.cc	(revision 1030)
@@ -54,6 +54,6 @@
 
     fHistHi->SetDirectory(NULL);
-    fHistHi->SetXTitle("Time/Slices");
-    fHistHi->SetYTitle("Signal");
+    fHistHi->SetXTitle("Signal/FADC Units");
+    fHistHi->SetYTitle("Count");
 
     delete [] name;
@@ -66,6 +66,6 @@
 
     fHistLo->SetDirectory(NULL);
-    fHistLo->SetXTitle("Time/Slices");
-    fHistLo->SetYTitle("Signal");
+    fHistLo->SetXTitle("Signal/FADC Units");
+    fHistLo->SetYTitle("Count");
 
     delete [] name;
Index: trunk/MagicSoft/Mars/mmain/MAnalysis.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MAnalysis.cc	(revision 1029)
+++ 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 1029)
+++ 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 1029)
+++ 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 1029)
+++ 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 1029)
+++ 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 1029)
+++ 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();
Index: trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 1029)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 1030)
@@ -209,9 +209,9 @@
 void MRawEvtData::Draw(Option_t *opt)
 {
-    // ----- AppendPad(opt);
-
-    //
-    // FIXME: BIG MEMORY LEAK! (( How and when are the objects deleted?)
-    //
+    if (GetNumPixels()==0)
+    {
+        *fLog << "Sorry, no pixel to draw!" << endl;
+        return;
+    }
 
     TString str(opt);
@@ -247,4 +247,9 @@
         graph->Draw("AC*");
 
+        TH1F *hist = graph->GetHistogram();
+
+        hist->SetXTitle("Time/FADC Slices");
+        hist->SetYTitle("Signal/FADC Units");
+
         return;
     }
@@ -269,4 +274,6 @@
 
         TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n);
+        hist->SetXTitle("Time/FADC Slices");
+        hist->SetYTitle("Signal/FADC Units");
 
         for (int i=0; i<n; i++)
