Index: trunk/MagicSoft/Mars/Makefile.rules
===================================================================
--- trunk/MagicSoft/Mars/Makefile.rules	(revision 1002)
+++ trunk/MagicSoft/Mars/Makefile.rules	(revision 1003)
@@ -5,9 +5,9 @@
 
 $(LIB): $(OBJS) $(HEADERS) $(CINT)Cint.o
-	@echo " - Building Library lib$(LIB) ... "
+	@echo " - Building Library lib$(LIB)"
 	$(AR) $(LIB) *.o
 
 $(CINT)Cint.cc: $(HEADERS) 
-	@echo " - Generating dictionary $(CINT)Cint.cc ..."
+	@echo " - Generating dictionary $(CINT)Cint.cc"
 
 	$(ROOTSYS)/bin/rootcint -f $(CINT)Cint.cc \
@@ -15,13 +15,13 @@
 
 .cxx.o:	
-	@echo " - Compiling " $<
+	@echo " - Compiling" $<
 	$(CXX) $(CXXFLAGS) -c $< -o $@
 
 .cc.o:	
-	@echo " - Compiling " $<
+	@echo " - Compiling" $<
 	$(CXX) $(CXXFLAGS) -c $< -o $@
 
 .c.o:	
-	@echo " - Compiling " $<
+	@echo " - Compiling" $<
 	$(CC) $(CFLAGS) -c $< -o $@
 #
Index: trunk/MagicSoft/Mars/macros/rootlogon.C
===================================================================
--- trunk/MagicSoft/Mars/macros/rootlogon.C	(revision 1002)
+++ trunk/MagicSoft/Mars/macros/rootlogon.C	(revision 1003)
@@ -33,5 +33,8 @@
         cout << "error." << endl;
     else
+    {
+        MParContainer::Class()->IgnoreTObjectStreamer();
         cout << "done." << endl;
+    }
 
     cout << endl;
Index: trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.cc	(revision 1003)
@@ -43,5 +43,5 @@
 #include <fstream.h>
 
-#include <TArrayC.h>
+#include <TList.h>
 
 #include "MLog.h"
@@ -65,11 +65,13 @@
     : fIn(NULL)
 {
-    *fName  = name  ? name  : "MCT1ReadAscii";
-    *fTitle = title ? title : "Task to loop over events in CT1 ascii file";
+    fName  = name  ? name  : "MCT1ReadAscii";
+    fTitle = title ? title : "Task to loop over events in CT1 ascii file";
 
     //
     // remember file name for opening the file in the preprocessor
     //
-    fFileNames = new TArrayC;
+    fFileNames = new TList;
+    fFileNames->SetOwner();
+
     if (fname)
         AddFile(fname);
@@ -93,10 +95,6 @@
 void MCT1ReadAscii::AddFile(const char *txt)
 {
-    const int sz  = fFileNames->GetSize();
-    const int tsz = strlen(txt)+1;
-
-    fFileNames->Set(sz+tsz);
-
-    memcpy(fFileNames->GetArray()+sz, txt, tsz);
+    TNamed *name = new TNamed(txt, "");
+    fFileNames->AddLast(name);
 }
 
@@ -114,7 +112,9 @@
     fIn = NULL;
 
-    const int arrsz = fFileNames->GetSize();
-
-    if (arrsz<1)
+    //
+    // Check for the existance of a next file to read
+    //
+    TNamed *file = (TNamed*)fFileNames->First();
+    if (!file)
         return kFALSE;
 
@@ -122,33 +122,21 @@
     // open the file which is the first one in the chain
     //
-    const char *name = fFileNames->GetArray();
+    const char *name = file->GetName();
 
     fIn = new ifstream(name);
-    if (!(*fIn))
-    {
+
+    const Bool_t noexist = !(*fIn);
+
+    if (noexist)
         *fLog << dbginf << "Cannot open file '" << name << "'" << endl;
-        return kFALSE;
-    }
-
-    //
-    // remove the first entry from the chain
-    //
-    *fLog << "Open file: '" << name << "'" << endl;
-
-    //
-    // create the new char array containing the filenames to process
-    //
-    const int sz  = strlen(name)+1;
-
-    char *dummy = new char[arrsz-sz];
-    memcpy(dummy, name+sz, arrsz-sz);
-
-    //
-    // dummy will be deleted by the destructor of fFileNames
-    //
-    fFileNames->Adopt(arrsz-sz, dummy);
-
-    return kTRUE;
-
+    else
+        *fLog << "Open file: '" << name << "'" << endl;
+
+    //
+    // Remove this file from the list of pending files
+    //
+    fFileNames->Remove(file);
+
+    return !noexist;
 }
 
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 1003)
@@ -58,6 +58,6 @@
 MCerPhotCalc::MCerPhotCalc(const char *name, const char *title)
 {
-    *fName  = name  ? name  : "MCerPhotCalc";
-    *fTitle = title ? title : "Task to calculate Cerenkov photons from raw data";
+    fName  = name  ? name  : "MCerPhotCalc";
+    fTitle = title ? title : "Task to calculate Cerenkov photons from raw data";
 }
 
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc	(revision 1003)
@@ -45,6 +45,6 @@
 {
 
-  *fName  = name  ? name  : "MCerPhotEvt";
-  *fTitle = title ? title : "(Number of Photon)-Event Information";
+  fName  = name  ? name  : "MCerPhotEvt";
+  fTitle = title ? title : "(Number of Photon)-Event Information";
   
   fPixels = new TClonesArray ("MCerPhotPix", 577) ;
Index: trunk/MagicSoft/Mars/manalysis/MHillas.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillas.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/manalysis/MHillas.cc	(revision 1003)
@@ -60,6 +60,6 @@
 MHillas::MHillas(const char *name, const char *title) : fEllipse(NULL)
 {
-    *fName  = name  ? name  : "MHillas";
-    *fTitle = title ? title : "Storage container for Hillas parameter of one event";
+    fName  = name  ? name  : "MHillas";
+    fTitle = title ? title : "Storage container for Hillas parameter of one event";
 
     Reset();
Index: trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc	(revision 1003)
@@ -56,6 +56,6 @@
 MHillasCalc::MHillasCalc(const char *name, const char *title)
 {
-    *fName  = name  ? name  : "MHillasCalc";
-    *fTitle = title ? title : "Task to calculate Hillas parameters";
+    fName  = name  ? name  : "MHillasCalc";
+    fTitle = title ? title : "Task to calculate Hillas parameters";
 }
 
Index: trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 1003)
@@ -66,6 +66,6 @@
     : fCleanLvl1(lvl1), fCleanLvl2(lvl2)
 {
-    *fName  = name  ? name  : "MImgCleanStd";
-    *fTitle = title ? title : "Task which does a standard image cleaning";
+    fName  = name  ? name  : "MImgCleanStd";
+    fTitle = title ? title : "Task which does a standard image cleaning";
 
     *fLog << "Cleaning initialized. Using noise level " << lvl1 << " and " << lvl2 << endl;
Index: trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc	(revision 1003)
@@ -49,6 +49,6 @@
 MMcPedestalCopy::MMcPedestalCopy(const char *name, const char *title)
 {
-    *fName  = name  ? name  : "MMcPedestalCopy";
-    *fTitle = title ? title : "Task to copy monte carlo pedestals into MPedestal Container";
+    fName  = name  ? name  : "MMcPedestalCopy";
+    fTitle = title ? title : "Task to copy monte carlo pedestals into MPedestal Container";
 }
 
Index: trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc	(revision 1003)
@@ -53,6 +53,6 @@
 MPedCalcPedRun::MPedCalcPedRun(const char *name, const char *title)
 {
-    *fName  = name  ? name  : "MPedCalcPedRun";
-    *fTitle = title ? title : "Task to calculate pedestals from pedestal runs raw data";
+    fName  = name  ? name  : "MPedCalcPedRun";
+    fTitle = title ? title : "Task to calculate pedestals from pedestal runs raw data";
 }
 
Index: trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc	(revision 1003)
@@ -42,6 +42,6 @@
 MPedestalCam::MPedestalCam(const char *name, const char *title)
 {
-    *fName  = name  ? name  : "MPedestalCam";
-    *fTitle = title ? title : "Storage container for all Pedestal Information in the camera";
+    fName  = name  ? name  : "MPedestalCam";
+    fTitle = title ? title : "Storage container for all Pedestal Information in the camera";
 
     fArray = new TClonesArray("MPedestalPix", 577);
Index: trunk/MagicSoft/Mars/mbase/MArray.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MArray.h	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MArray.h	(revision 1003)
@@ -12,8 +12,4 @@
 #ifndef MAGIC_H
 #include "MAGIC.h"
-#endif
-
-#ifndef ROOT_TObject
-#include <TObject.h>
 #endif
 
Index: trunk/MagicSoft/Mars/mbase/MArrayB.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MArrayB.h	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MArrayB.h	(revision 1003)
@@ -15,5 +15,4 @@
 
 #include <string.h>
-
 
 class MArrayB : public MArray
Index: trunk/MagicSoft/Mars/mbase/MClone.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MClone.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MClone.cc	(revision 1003)
@@ -66,6 +66,6 @@
 void MClone::Init(const char *name, const char *title)
 {
-    *fName  = name  ? name  : "MClone";
-    *fTitle = title ? title : "Task to clone a parameter container for later usage";
+    fName  = name  ? name  : "MClone";
+    fTitle = title ? title : "Task to clone a parameter container for later usage";
 
     fClone  = NULL;
Index: trunk/MagicSoft/Mars/mbase/MInputStreamID.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MInputStreamID.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MInputStreamID.cc	(revision 1003)
@@ -44,9 +44,9 @@
 MInputStreamID::MInputStreamID(const char *name, const char *title)
 {
-    *fName = name ? name : ClassName();
-    *fTitle = title;
+    fName = name ? name : ClassName();
+    fTitle = title;
 
-    fStreamId = new char[4];
-    strcpy(fStreamId, "All");
+    fStreamId = "All"; //new char[4];
+    //strcpy(fStreamId, "All");
 }
 
Index: trunk/MagicSoft/Mars/mbase/MInputStreamID.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MInputStreamID.h	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MInputStreamID.h	(revision 1003)
@@ -19,21 +19,23 @@
 {
 private:
-    char *fStreamId;		//! which type of task should be processed?
+    TString fStreamId;	//! which type of task should be processed?
 
 public:
     MInputStreamID(const char *name=NULL, const char *title=NULL);
 
-    const char *GetStreamId()
+    const TString &GetStreamId() const { return fStreamId; }
+    void SetStreamId(const char *t)    { fStreamId = t; }
+
+    Bool_t operator==(MInputStreamID &id) const
     {
-	return (const char *)fStreamId;
-    }
-    void SetStreamId(const char *t)
-    {
-        delete fStreamId;
-        fStreamId = new char[strlen(t)+1];
-        strcpy(fStreamId, t);
+        return fStreamId == id.fStreamId;
     }
 
-    ClassDef(MInputStreamID, 1)	//Assigns an ID to tasks or a task list
+    Bool_t operator!=(MInputStreamID &id) const
+    {
+        return fStreamId != id.fStreamId;
+    }
+
+    ClassDef(MInputStreamID, 0)	//Assigns an Id to tasks or a task list
 };
 
Index: trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1003)
@@ -51,6 +51,6 @@
 MParContainer::MParContainer(const MParContainer &named)
 {
-    *fName  = *(named.fName);
-    *fTitle = *(named.fTitle);
+    fName  = named.fName;
+    fTitle = named.fTitle;
 
     fLog = named.fLog;
@@ -70,6 +70,6 @@
     TObject::operator=(rhs);
 
-    *fName  = *(rhs.fName);
-    *fTitle = *(rhs.fTitle);
+    fName  = rhs.fName;
+    fTitle = rhs.fTitle;
 
     fLog         = rhs.fLog;
@@ -81,11 +81,24 @@
 // --------------------------------------------------------------------------
 //
+// Make a clone of an object using the Streamer facility.
+// If newname is specified, this will be the name of the new object
+//
+TObject *MParContainer::Clone(const char *newname) const
+{
+
+   MParContainer *named = (MParContainer*)TObject::Clone(newname);
+   if (newname && strlen(newname)) named->SetName(newname);
+   return named;
+}
+
+// --------------------------------------------------------------------------
+//
 //  Compare two MParContainer objects. Returns 0 when equal, -1 when this is
 //  smaller and +1 when bigger (like strcmp).
 //
-Int_t MParContainer::Compare(TObject *obj)
+Int_t MParContainer::Compare(const TObject *obj) const
 {
     if (this == obj) return 0;
-    return fName->CompareTo(obj->GetName());
+    return fName.CompareTo(obj->GetName());
 }
 
@@ -100,6 +113,6 @@
     TObject::Copy(obj);
 
-    *cont.fName  = *fName;
-    *cont.fTitle = *fTitle;
+    cont.fName  = fName;
+    cont.fTitle = fTitle;
 
     cont.fLog         = fLog;
@@ -113,6 +126,6 @@
 void MParContainer::FillBuffer(char *&buffer)
 {
-    fName->FillBuffer(buffer);
-    fTitle->FillBuffer(buffer);
+    fName.FillBuffer(buffer);
+    fTitle.FillBuffer(buffer);
 }
 
@@ -121,5 +134,5 @@
 //  List MParContainer name and title.
 //
-void MParContainer::ls(Option_t *)
+void MParContainer::ls(Option_t *) const
 {
     TROOT::IndentLevel();
@@ -147,5 +160,5 @@
 void MParContainer::SetName(const char *name)
 {
-    *fName = name;
+    fName = name;
     if (gPad && TestBit(kMustCleanup)) gPad->Modified();
 }
@@ -158,6 +171,6 @@
 void MParContainer::SetObject(const char *name, const char *title)
 {
-    *fName  = name;
-    *fTitle = title;
+    fName  = name;
+    fTitle = title;
     if (gPad && TestBit(kMustCleanup)) gPad->Modified();
 }
@@ -169,5 +182,5 @@
 void MParContainer::SetTitle(const char *title)
 {
-    *fTitle = title;
+    fTitle = title;
     if (gPad && TestBit(kMustCleanup)) gPad->Modified();
 }
@@ -179,5 +192,5 @@
 Int_t MParContainer::Sizeof() const
 {
-    Int_t nbytes = fName->Sizeof() + fTitle->Sizeof();
+    Int_t nbytes = fName.Sizeof() + fTitle.Sizeof();
     return nbytes;
 }
Index: trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1003)
@@ -22,5 +22,5 @@
 class ofstream;
 class ifstream;
-
+/*
 class MParContainer : public TObject
 {
@@ -32,4 +32,6 @@
         fTitle = new TString;
         (*fTitle) = title;
+
+        cout << " <***> " << flush;
     }
 
@@ -53,5 +55,6 @@
       //delete fName; delete fTitle;
     }
-    virtual Int_t    Compare(TObject *obj);
+    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);
@@ -63,5 +66,5 @@
     virtual void     SetObject(const char *name, const char *title);
     virtual void     SetTitle(const char *title=""); // *MENU*
-    virtual void     ls(Option_t *option="");
+    virtual void     ls(Option_t *option="") const;
     virtual void     Print(Option_t *option="") const;
     virtual Int_t    Sizeof() const;
@@ -77,5 +80,77 @@
     ClassDef(MParContainer, 1)  //The basis for all parameter containers
 };
+*/
 
+class MParContainer : public TObject
+{
+protected:
+    TString fName;        // parameter container identifier (name)
+    TString fTitle;       // parameter container title
+
+    MLog   *fLog;         // The general log facility for this object, initialized with the global object
+
+private:
+    Bool_t  fReadyToSave; // should be set to true if the contents of the container is changed somehow
+
+public:
+    MParContainer(const char *name="", const char *title="") : fName(name), fTitle(title), fLog(&gLog), fReadyToSave(kFALSE) {  }
+    MParContainer(const TString &name, const TString &title) : fName(name), fTitle(title), fLog(&gLog), fReadyToSave(kFALSE) {  }
+    MParContainer(const MParContainer &named);
+    MParContainer& operator=(const MParContainer& rhs);
+
+    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 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 void     Reset() {  }
+
+    virtual Bool_t IsReadyToSave()                   { return fReadyToSave; }
+    virtual void   SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
+
+    virtual void AsciiRead(ifstream &fin);
+    virtual void AsciiWrite(ofstream &fout) const;
+
+    ClassDef(MParContainer, 0)  //The basis for all parameter containers
+};
+
+/*
+class MParContainer : public TNamed
+{
+protected:
+    MLog    *fLog;         //! The general log facility for this object, initialized with the global object
+
+private:
+    Bool_t   fReadyToSave; //! should be set to true if the contents of the container is changed somehow
+
+public:
+    MParContainer(const char *name="", const char *title="") : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
+    MParContainer(const TString &name, const TString &title) : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
+
+    void SetLogStream(MLog *lg)                      { fLog = lg; }
+
+    virtual void   Reset()                           {  }
+
+    virtual Bool_t IsReadyToSave()                   { return fReadyToSave; }
+    virtual void   SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
+
+    virtual void AsciiRead(ifstream &fin);
+    virtual void AsciiWrite(ofstream &fout) const;
+
+    ClassDef(MParContainer, 0)  //The basis for all parameter containers
+};
+*/
 #endif
 
Index: trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1003)
@@ -43,5 +43,5 @@
 #include <TNamed.h>
 #include <TClass.h>
-#include <TObjArray.h>
+#include <TOrdCollection.h>
 
 #include "MLog.h"
@@ -57,6 +57,6 @@
 MParList::MParList(const char *name, const char *title)
 {
-    *fName  = name  ? name  : "MParList";
-    *fTitle = title ? title : "A list of Parameter Containers";
+    fName  = name  ? name  : "MParList";
+    fTitle = title ? title : "A list of Parameter Containers";
 
     //
@@ -64,5 +64,8 @@
     // that the destructor of the list deletes all it's objects
     //
-    fAutodelete.SetOwner();
+    fContainer  = new TOrdCollection;
+    fAutodelete = new TOrdCollection;
+
+    fAutodelete->SetOwner();
 }
 
@@ -76,5 +79,5 @@
 MParList::MParList(MParList &ts)
 {
-    fContainer.AddAll(&ts.fContainer);
+    fContainer->AddAll(ts.fContainer);
 }
 
@@ -87,5 +90,8 @@
 {
     if (TestBit(kIsOwner))
-        fContainer.SetOwner();
+        fContainer->SetOwner();
+
+    delete fContainer;
+    delete fAutodelete;
 }
 
@@ -107,5 +113,5 @@
 void MParList::SetLogStream(MLog *log)
 {
-    TIter Next(&fContainer);
+    TIter Next(fContainer);
 
     MParContainer *cont=NULL;
@@ -143,6 +149,6 @@
     // Check if the new container is already existing in the list
     //
-    const TObject *objn = fContainer.FindObject(name);
-    const TObject *objt = fContainer.FindObject(cont);
+    const TObject *objn = fContainer->FindObject(name);
+    const TObject *objt = fContainer->FindObject(cont);
 
     if (objn || objt)
@@ -172,5 +178,5 @@
     if (where)
     {
-        if (!fContainer.FindObject(where))
+        if (!fContainer->FindObject(where))
         {
             *fLog << dbginf << "Error: Cannot find parameter container after which the new one should be added!" << endl;
@@ -181,5 +187,5 @@
     *fLog << "Adding " << name << " to " << GetName() << "... " << flush;
 
-    fContainer.Add(cont);
+    fContainer->Add(cont);
     *fLog << "Done." << endl;
 
@@ -204,5 +210,6 @@
     while ((cont=(MParContainer*)Next()))
     {
-        //
+        AddToList(cont);
+/*        //
         // Get Name of new container
         //
@@ -212,6 +219,6 @@
         // Check if the new container is already existing in the list
         //
-        const TObject *objn = fContainer.FindObject(name);
-        const TObject *objt = fContainer.FindObject(cont);
+        const TObject *objn = fContainer->FindObject(name);
+        const TObject *objt = fContainer->FindObject(cont);
 
         if (objn || objt)
@@ -237,7 +244,7 @@
         *fLog << "Adding " << name << " to " << GetName() << "... " << flush;
 
-        fContainer.Add(cont);
-
-        *fLog << "Done." << endl;
+        fContainer->Add(cont);
+
+        *fLog << "Done." << endl;*/
     }
 }
@@ -250,5 +257,5 @@
 TObject *MParList::FindObject(const char *name) const
 {
-    return fContainer.FindObject(name);
+    return fContainer->FindObject(name);
 }
 
@@ -259,5 +266,5 @@
 TObject *MParList::FindObject(TObject *obj) const
 {
-    return fContainer.FindObject(obj);
+    return fContainer->FindObject(obj);
 }
 
@@ -358,5 +365,5 @@
     // if object is not existing in the list try to create one
     //
-    *fLog << dbginf << "Object '" << oname << "' [" << cname << "] not found... creating." << endl;
+    *fLog << "Object '" << oname << "' [" << cname << "] not yet in " << GetName() << "... creating." << endl;
 
     //
@@ -393,5 +400,5 @@
     // object is deleted together with the list
     //
-    fAutodelete.Add(pcont);
+    fAutodelete->Add(pcont);
 
     //
@@ -419,5 +426,5 @@
 void MParList::SetReadyToSave(Bool_t flag)
 {
-    TIter Next(&fContainer);
+    TIter Next(fContainer);
 
     MParContainer *cont=NULL;
@@ -438,5 +445,5 @@
 void MParList::Reset()
 {
-    TIter Next(&fContainer);
+    TIter Next(fContainer);
 
     MParContainer *cont=NULL;
Index: trunk/MagicSoft/Mars/mbase/MParList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.h	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MParList.h	(revision 1003)
@@ -14,6 +14,6 @@
 #endif
 
-#ifndef ROOT_TOrdCollection
-#include "TOrdCollection.h"
+#ifndef ROOT_TObjArray
+#include <TObjArray.h>
 #endif
 #ifndef MPARCONTAINER_H
@@ -21,5 +21,5 @@
 #endif
 
-#include <TObjArray.h>
+class TOrdCollection;
 
 class MLog;
@@ -28,6 +28,6 @@
 {
 private:
-    TOrdCollection fContainer;	// Collection of Parameter and Data Containers
-    TOrdCollection fAutodelete; // All what this list contains is deleted in the destructor
+    TOrdCollection *fContainer;	// Collection of Parameter and Data Containers
+    TOrdCollection *fAutodelete; // All what this list contains is deleted in the destructor
 
     static TString GetClassName(const char *classname);
Index: trunk/MagicSoft/Mars/mbase/MPrint.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MPrint.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MPrint.cc	(revision 1003)
@@ -54,6 +54,6 @@
 void MPrint::Init(const char *name, const char *title)
 {
-    *fName  = name  ? name  : "MPrint";
-    *fTitle = title ? title : "Task to print a parameter container";
+    fName  = name  ? name  : "MPrint";
+    fTitle = title ? title : "Task to print a parameter container";
 
     fObject = NULL;
Index: trunk/MagicSoft/Mars/mbase/MReadTree.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MReadTree.cc	(revision 1003)
@@ -53,9 +53,7 @@
 #include <fstream.h>
 
-#include <TFile.h>
 #include <TChain.h>
-#include <TArrayC.h>
-#include <TObjArray.h>
 #include <TChainElement.h>
+#include <TOrdCollection.h>
 
 #include "MLog.h"
@@ -64,4 +62,5 @@
 #include "MTime.h"
 #include "MParList.h"
+#include "MTaskList.h"
 
 ClassImp(MReadTree);
@@ -77,10 +76,11 @@
 MReadTree::MReadTree(const char *tname, const char *fname,
                      const char *name, const char *title)
-    : fNumEntry(0), fLeafEnabled(kFALSE)
-{
-    *fName  = name  ? name  : "MReadTree";
-    *fTitle = title ? title : "Task to loop over all events in one single tree";
-
-    fVetoList = new TArrayC;
+    : fNumEntry(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE)
+{
+    fName  = name  ? name  : "MReadTree";
+    fTitle = title ? title : "Task to loop over all events in one single tree";
+
+    fVetoList = new TOrdCollection;
+    fVetoList->SetOwner();
 
     //
@@ -138,21 +138,85 @@
 }
 
-// --------------------------------------------------------------------------
-//
-// The first time this function is called all leafes/branches are disabled
-// and the given branch/leaf is enabled. By enabling only the branches you
+void MReadTree::EnableBranchChoosing()
+{
+    if (fBranchChoosing)
+        return;
+
+    *fLog << "Branch choosing method enabled (only enabled branches are read)." << endl;
+    fChain->SetBranchStatus("*", kFALSE);
+    fBranchChoosing = kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// The first time this function is called all branches are disabled.
+// The given branch is enabled. By enabling only the branches you
 // are processing you can speed up your calculation many times (up to
 // a factor of 10 or 20)
 //
-void MReadTree::UseLeaf(const char *name)
-{
-    if (!fLeafEnabled)
-    {
-        *fLog << "Leaf choosing method enabled (only enabled leaves are read)." << endl;
-        fChain->SetBranchStatus("*", kFALSE);
-        fLeafEnabled = kTRUE;
-    }
-
+void MReadTree::EnableBranch(const char *name)
+{
+    EnableBranchChoosing();
     fChain->SetBranchStatus(name, kTRUE);
+}
+
+// --------------------------------------------------------------------------
+//
+// 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
+    //
+    EnableBranchChoosing();
+
+    //
+    // request the tasklist from the parameter list.
+    // FIXME: Tasklist can have a different name
+    //
+    const MTaskList *tlist = (MTaskList*)plist->FindObject("MTaskList");
+    if (!tlist)
+    {
+        *fLog << "Cannot use auto enabeling scheme for branches. 'MTaskList' not found." << endl;
+        return;
+    }
+
+    //
+    // Loo 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);
+        }
+    }
 }
 
@@ -208,5 +272,5 @@
         // Check if enabeling the branch is allowed
         //
-        if (HasVeto(name))
+        if (fVetoList->FindObject(name))
         {
             *fLog << "Branch " << name << " has veto... skipped." << endl;
@@ -242,10 +306,12 @@
         fChain->SetBranchAddress(name, pcont);
 
-        *fLog << "Branch " << name << " enabled for reading." << endl;
+        *fLog << "Branch " << name << " setup for reading." << endl;
 
         num++;
     }
 
-    *fLog << "MReadTree will read " << num << " branches." << endl;
+    *fLog << "MReadTree setup " << num << " branches." << endl;
+
+    EnableBranches(pList);
 
     return kTRUE;
@@ -261,5 +327,5 @@
 Bool_t MReadTree::Process()
 {
-    return fChain->GetEntry(fNumEntry++) == 0 ? kFALSE : kTRUE;
+    return fChain->GetEntry(fNumEntry++) != 0;
 }
 
@@ -270,5 +336,5 @@
 Bool_t MReadTree::GetEvent()
 {
-    return fChain->GetEntry(fNumEntry) == 0 ? kFALSE : kTRUE;
+    return fChain->GetEntry(fNumEntry) != 0;
 }
 
@@ -338,97 +404,11 @@
 // --------------------------------------------------------------------------
 //
-// This function checks if the Branch Name is part of the Veto List.
-// This means, that the preprocess doesn't enable the branch.
-//
-Bool_t MReadTree::HasVeto(const char *name) const
-{
-    const size_t nlen = strlen(name)+1;
-
-    char  *pos = fVetoList->GetArray();
-    size_t len = fVetoList->GetSize();
-
-    //
-    // now we compare the 'strings' in the list word by word
-    // (string or word in this context means a zero terminated
-    // array of chars
-    //
-
-    for (;;)
-    {
-        //
-        // Search for the first byte of the name
-        //
-        char *c = (char*)memchr(pos, name[0], len);
-
-        //
-        // if we don't find the first byte, the list cannot contain 'name'
-        //
-        if (!c)
-            return kFALSE;
-
-        //
-        // calculate and check how many bytes remains in the list
-        //
-        len -= c-pos;
-
-        //
-        // if there are not enough bytes to match the query we are done
-        //
-        if (len<nlen)
-            return kFALSE;
-
-        //
-        // check if the next 'nlen' byte (including the trailing '\0'
-        // are matching
-        //
-        if (!memcmp(c, name, nlen))
-            return kTRUE;
-
-        //
-        // we didn't find the string, goto the next 'string'
-        //
-        pos = (char*)memchr(c, '\0', len);
-
-        //
-        // check if there is a 'next' string really
-        //
-        if (!pos)
-            return kFALSE;
-
-        //
-        // calculate the remaining length
-        //
-        len -= pos-c;
-
-        //
-        // if there are not enough bytes to match the query we are done
-        //
-        if (len<nlen)
-            return kFALSE;
-    }
-}
-
-
-// --------------------------------------------------------------------------
-//
-// If you don't want that a branch is enabled within the PreProcess you
-// can set a veto for enabeling the branch. (This means also the
-// corresponding object won't be created automatically)
-//
-// This functionality is for experienced users which don't want to
-// read in branches which are not processed in the program (for
-// speed reasons)
+// 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.
 //
 void MReadTree::VetoBranch(const char *name)
 {
-    //
-    // Add this file as the last entry of the list
-    // (including the trailing '\0')
-    //
-    const int sz  = fVetoList->GetSize();
-    const int tsz = strlen(name)+1;
-
-    fVetoList->Set(sz+tsz);
-
-    memcpy(fVetoList->GetArray()+sz, name, tsz);
-}
+    TNamed *branch = new TNamed(name, "");
+    fVetoList->Add(branch);
+}
Index: trunk/MagicSoft/Mars/mbase/MReadTree.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MReadTree.h	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MReadTree.h	(revision 1003)
@@ -6,22 +6,21 @@
 #endif
 
-class TFile;
 class TChain;
-class TArrayC;
 
 class MReadTree : public MTask
 {
 private:
-    TFile   *fFile;       // Pointer to file
-    TChain  *fChain;      // Pointer to tree
+    TChain *fChain;            // Pointer to tree
 
-    TArrayC *fVetoList;   // List of Branches which are not allowed to get enabled
+    UInt_t  fNumEntry;         // Number of actual entry
+    UInt_t  fNumEntries;       // Number of Events in Tree
 
-    UInt_t   fNumEntry;   // Number of actual entry
-    UInt_t   fNumEntries; // Number of Events in Tree
+    Bool_t  fBranchChoosing;   // Flag for branch choosing method
+    Bool_t  fAutoEnable;       // Flag for auto enabeling scheme
 
-    Bool_t   fLeafEnabled; // Flag whether UseLeaf is called the first time or not
+    TOrdCollection *fVetoList; // List of Branches which are not allowed to get enabled
 
-    Bool_t HasVeto(const char *name) const;
+    void EnableBranches(MParList *plist);
+    void EnableBranchChoosing();
 
 public:
@@ -32,8 +31,8 @@
     Bool_t Process();
 
-    Int_t AddFile(const char *fname);
-    void  VetoBranch(const char *name);
+    Int_t  AddFile(const char *fname);
+    void   VetoBranch(const char *name);
 
-    void UseLeaf(const char *name);
+    void   EnableBranch(const char *name);
 
     Bool_t GetEvent();
@@ -46,4 +45,6 @@
     UInt_t GetEntries() const  { return fNumEntries; }
 
+    void   DisableAutoScheme() { fAutoEnable = kFALSE; }
+
     ClassDef(MReadTree, 0)	// Reads one tree
 };
Index: trunk/MagicSoft/Mars/mbase/MTask.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 1003)
@@ -67,4 +67,6 @@
 #include "MTask.h"
 
+#include <TOrdCollection.h>
+
 #include "MLog.h"
 #include "MLogManip.h"
@@ -75,8 +77,52 @@
 
 MTask::MTask(const char *name, const char *title)
-    : fFilter(NULL), fIsPreprocessed(kFALSE), fNumExecutions()
-{
-    *fName  = name  ? name  : "MTask";
-    *fTitle = title ? title : "Base class for all tasks (dummy task).";
+    : fFilter(NULL), fIsPreprocessed(kFALSE), fNumExecutions(0)
+{
+    fName  = name  ? name  : "MTask";
+    fTitle = title ? title : "Base class for all tasks (dummy task).";
+
+    fListOfBranches = new TOrdCollection;
+    fListOfBranches->SetOwner();
+}
+
+MTask::~MTask()
+{
+    delete fListOfBranches;
+}
+
+// --------------------------------------------------------------------------
+//
+// This adds a branch to the list for the auto enabeling schmeme.
+// This makes it possible for MReadTree to decide which branches
+// are really needed for the eventloop. Only the necessary branches
+// are read from disk which speeds up the calculation enormously.
+//
+// You can use TRegExp expressions like "*.fEnergy", but the
+// recommended method is to call this function for exactly all
+// branches you want to have, eg:
+//  AddToBranchList("MMcTrig;1.fNumFirstLevel");
+//  AddToBranchList("MMcTrig;2.fNumFirstLevel");
+//
+// We agreed on the convetion, that all branches are stored with
+// a trailing dot '.' so that always the Master Branch name
+// (eg. MMcTrig) is part of the branch name.
+//
+// Remark: The common place to call AddToBranchList is the
+//         constructor of the derived classes (tasks)
+//
+void MTask::AddToBranchList(const char *b)
+{
+    TNamed *name = new TNamed(b, "");
+    fListOfBranches->Add(name);
+}
+
+// --------------------------------------------------------------------------
+//
+// Copy constructor.
+//
+MTask::MTask(MTask &t)
+{
+    fFilter = t.fFilter;
+    fListOfBranches->AddAll(t.fListOfBranches);
 }
 
Index: trunk/MagicSoft/Mars/mbase/MTask.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.h	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MTask.h	(revision 1003)
@@ -14,4 +14,6 @@
 #endif
 
+class TOrdCollection;
+
 class MFilter;
 class MParList;
@@ -20,8 +22,10 @@
 {
 private:
-    const MFilter *fFilter;
+    TOrdCollection *fListOfBranches; // List of Branch names for auto enabeling scheme
 
-    Bool_t fIsPreprocessed; // Indicates the success of the PreProcessing (set by MTaskList)
-    UInt_t fNumExecutions;  // Number of Excutions
+    const MFilter *fFilter;          // Filter for conditional task execution
+
+    Bool_t fIsPreprocessed;          // Indicates the success of the PreProcessing (set by MTaskList)
+    UInt_t fNumExecutions;           // Number of Excutions
 
     virtual Bool_t PreProcess(MParList *pList);
@@ -29,9 +33,15 @@
     virtual Bool_t PostProcess();
 
+protected:
+    void AddToBranchList(const char *b);
+    void AddToBranchList(const TString &str)
+    {
+        AddToBranchList((const char*)str);
+    }
+
 public:
     MTask(const char *name=NULL, const char *title=NULL);
-    virtual ~MTask()
-    {
-    }
+    MTask(MTask &t);
+    virtual ~MTask();
 
     void SetFilter(const MFilter *filter) { fFilter=filter; }
@@ -42,4 +52,6 @@
     Bool_t CallPostProcess();
 
+    const TOrdCollection *GetListOfBranches() const { return fListOfBranches; }
+
     ClassDef(MTask, 0)		//Abstract base class for a task
 };
Index: trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1003)
@@ -47,4 +47,6 @@
 #include "MTaskList.h"
 
+#include <TOrdCollection.h>
+
 #include "MLog.h"
 #include "MLogManip.h"
@@ -63,6 +65,8 @@
 MTaskList::MTaskList(const char *name, const char *title)
 {
-    *fName  = name  ? name  : "MTaskList";
-    *fTitle = title ? title : "A list for tasks to be executed";
+    fName  = name  ? name  : "MTaskList";
+    fTitle = title ? title : "A list for tasks to be executed";
+
+    fTasks = new TOrdCollection;
 }
 
@@ -75,5 +79,5 @@
 MTaskList::MTaskList(MTaskList &ts)
 {
-    fTasks.AddAll(&ts.fTasks);
+    fTasks->AddAll(ts.fTasks);
 }
 
@@ -86,5 +90,7 @@
 {
     if (TestBit(kIsOwner))
-        fTasks.SetOwner();
+        fTasks->SetOwner();
+
+    delete fTasks;
 }
 
@@ -110,5 +116,5 @@
     // create the Iterator over the tasklist
     //
-    TIter Next(&fTasks);
+    TIter Next(fTasks);
 
     MTask *task=NULL;
@@ -147,6 +153,6 @@
     // Check if the new task is already existing in the list
     //
-    const TObject *objn = fTasks.FindObject(name);
-    const TObject *objt = fTasks.FindObject(task);
+    const TObject *objn = fTasks->FindObject(name);
+    const TObject *objt = fTasks->FindObject(task);
 
     if (objn || objt)
@@ -165,5 +171,5 @@
         // Otherwise add it to the list, but print a warning message
         //
-        *fLog << dbginf << "Warning: Task with the same name '" << task->GetName();
+        *fLog << dbginf << "Warning: Task '" << task->GetName();
         *fLog << "' already existing in '" << GetName() << "'." << endl;
         *fLog << "You may not be able to get a pointer to this task by name." << endl;
@@ -172,5 +178,5 @@
     if (where)
     {
-        if (!fTasks.FindObject(where))
+        if (!fTasks->FindObject(where))
         {
             *fLog << dbginf << "Error: Cannot find task after which the new task should be scheduled!" << endl;
@@ -182,5 +188,5 @@
 
     task->SetStreamId(type);
-    fTasks.Add(task);
+    fTasks->Add(task);
 
     *fLog << "Done." << endl;
@@ -196,5 +202,5 @@
 TObject *MTaskList::FindObject(const char *name) const
 {
-    return fTasks.FindObject(name);
+    return fTasks->FindObject(name);
 }
 
@@ -205,5 +211,5 @@
 TObject *MTaskList::FindObject(TObject *obj) const
 {
-    return fTasks.FindObject(obj);
+    return fTasks->FindObject(obj);
 }
 
@@ -221,5 +227,5 @@
     //  create the Iterator over the tasklist
     //
-    TIter Next(&fTasks);
+    TIter Next(fTasks);
 
     MTask *task=NULL;
@@ -260,5 +266,5 @@
     //  create the Iterator for the TaskList
     //
-    TIter Next(&fTasks);
+    TIter Next(fTasks);
     MTask *task=NULL;
 
@@ -271,6 +277,6 @@
         // if the task has the wrong stream id skip it.
         //
-        if (strcmp(GetStreamId(), task->GetStreamId()) &&
-            strcmp(task->GetStreamId(), "All"))
+        if (GetStreamId() != task->GetStreamId() &&
+            task->GetStreamId() !=  "All")
             continue;
 
@@ -331,5 +337,5 @@
     //  create the Iterator for the TaskList
     //
-    TIter Next(&fTasks);
+    TIter Next(fTasks);
 
     MTask *task=NULL;
@@ -377,5 +383,5 @@
     //  create the Iterator for the TaskList
     //
-    TIter Next(&fTasks);
+    TIter Next(fTasks);
 
     MTask *task=NULL;
@@ -396,5 +402,5 @@
     *fLog << "TaskList: " << GetName() << " <" << GetTitle() << ">" << endl;
 
-    fTasks.Print();
+    fTasks->Print();
 
     *fLog << endl;
Index: trunk/MagicSoft/Mars/mbase/MTaskList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 1003)
@@ -10,7 +10,4 @@
 ///////////////////////////////////////////////////////////////////////
 
-#ifndef ROOT_TOrdCollection
-#include <TOrdCollection.h>
-#endif
 #ifndef MTASK_H
 #include "MTask.h"
@@ -24,6 +21,6 @@
 {
 private:
-    TOrdCollection fTasks;	// Container for the ordered list of different tasks
-    MParList      *fParList;
+    TOrdCollection *fTasks;	// Container for the ordered list of different tasks
+    MParList       *fParList;
 
     UInt_t *fCntContinue;
@@ -53,4 +50,6 @@
     void SetOwner(Bool_t enable=kTRUE);
 
+    const TOrdCollection *GetList() const { return fTasks; }
+
     ClassDef(MTaskList, 0)	//collection of tasks to be performed in the eventloop
 };
Index: trunk/MagicSoft/Mars/mbase/MTime.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTime.h	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MTime.h	(revision 1003)
@@ -24,8 +24,8 @@
     MTime(const char *name=NULL, const char *title=NULL)
     {
-        *fName = name ? name : ClassName();
-        *fTitle = title;
+        fName = name ? name : ClassName();
+        fTitle = title;
 
-        SetTime(0,0);
+        SetTime(0, 0);
     }
 
Index: trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc	(revision 1003)
@@ -59,6 +59,6 @@
     : fOut(NULL), fContainer(NULL)
 {
-    *fName  = name  ? name  : "MWriteAsciiFile";
-    *fTitle = title ? title : "Task to write one container to an ascii file";
+    fName  = name  ? name  : "MWriteAsciiFile";
+    fTitle = title ? title : "Task to write one container to an ascii file";
 
     fNameFile      = filename;
@@ -77,6 +77,6 @@
     : fOut(NULL), fContainer(cont)
 {
-    *fName  = name  ? name  : "MWriteAsciiFile";
-    *fTitle = title ? title : "Task to write one container to an ascii file";
+    fName  = name  ? name  : "MWriteAsciiFile";
+    fTitle = title ? title : "Task to write one container to an ascii file";
 
     fNameFile      = filename;
Index: trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc	(revision 1003)
@@ -46,5 +46,5 @@
 ClassImp(MWriteRootFile);
 
-#define kSaveNow BIT(1)
+#define kFillTree BIT(1)
 
 // --------------------------------------------------------------------------
@@ -62,6 +62,6 @@
                                const char *title)
 {
-    *fName  = name  ? name  : "MWriteRootFile";
-    *fTitle = title ? title : "Task which writes a root-output file";
+    fName  = name  ? name  : "MWriteRootFile";
+    fTitle = title ? title : "Task which writes a root-output file";
 
     //
@@ -113,5 +113,5 @@
 
     TTree *t;
-    TObjArrayIter Next(&fTrees);
+    TIter Next(&fTrees);
     while ((t=(TTree*)Next()))
         cout << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;
@@ -177,5 +177,5 @@
     // loop over all branches which are 'marked' as branches to get written.
     //
-    TObjArrayIter Next(&fBranches);
+    TIter Next(&fBranches);
     while ((entry=(MRootFileBranch*)Next()))
     {
@@ -244,5 +244,5 @@
         //
         TObject *obj;
-        TObjArrayIter NextTree(&fTrees);
+        TIter NextTree(&fTrees);
         while ((obj=NextTree()))
         {
@@ -270,5 +270,5 @@
         // The containers should be written in Splitlevel=1
         //
-        branch = tree->Branch(cname, cont->ClassName(), entry->GetAddress(), 32000, 1);
+        branch = tree->Branch(cname, cont->ClassName(), entry->GetAddress());
 
         *fLog << "Created Branch " << cname << " of " << cont->ClassName() << "." << endl;
@@ -302,5 +302,5 @@
     // Loop over all branch entries
     //
-    TObjArrayIter NextBranch(&fBranches);
+    TIter NextBranch(&fBranches);
     while ((obj=NextBranch()))
     {
@@ -317,5 +317,5 @@
         // the corresponding tree entry.
         //
-        b->GetTree()->SetBit(kSaveNow);
+        b->GetTree()->SetBit(kFillTree);
     }
 
@@ -323,5 +323,5 @@
     // Loop over all tree entries
     //
-    TObjArrayIter NextTree(&fTrees);
+    TIter NextTree(&fTrees);
     while ((obj=NextTree()))
     {
@@ -331,5 +331,5 @@
         // Check the write flag of the tree
         //
-        if (!t->TestBit(kSaveNow))
+        if (!t->TestBit(kFillTree))
             continue;
 
@@ -340,5 +340,5 @@
         //
         t->Fill();
-        t->ResetBit(kSaveNow);
+        t->ResetBit(kFillTree);
     }
 }
Index: trunk/MagicSoft/Mars/mgui/MGeomCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MGeomCam.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mgui/MGeomCam.cc	(revision 1003)
@@ -52,6 +52,6 @@
     : fNumPixels(npix)
 {
-    *fName  = name  ? name  : "MGeomCam";
-    *fTitle = title ? title : "Storage container for  a camera geometry";
+    fName  = name  ? name  : "MGeomCam";
+    fTitle = title ? title : "Storage container for  a camera geometry";
 
     fPixels = new TObjArray(npix);
Index: trunk/MagicSoft/Mars/mhist/MH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH.cc	(revision 1002)
+++ trunk/MagicSoft/Mars/mhist/MH.cc	(revision 1003)
@@ -40,4 +40,6 @@
 #include "MH.h"
 
+#include <TCanvas.h>
+
 ClassImp(MH);
 
@@ -52,6 +54,31 @@
     //   set the name and title of this object
     //
-    *fName  = name  ? name  : "MH" ;
-    *fTitle = title ? title : "Base class for Mars histograms" ;
+    fName  = name  ? name  : "MH" ;
+    fTitle = title ? title : "Base class for Mars histograms" ;
 }
 
+TCanvas *MH::MakeDefCanvas(const char *name, const char *title,
+                           const UInt_t w, const UInt_t h)
+{
+    const TList *list = (TList*)gROOT->GetListOfCanvases();
+
+    const char *def = name ? name : gROOT->GetDefCanvasName();
+
+    TCanvas *c;
+    if (list->FindObject(def))
+    {
+        const char *n = StrDup(Form("%s <%d>", def, list->GetSize()+1));
+        c = new TCanvas(n, title, w, h);
+        delete [] n;
+    }
+    else
+        c = new TCanvas(def, title, w, h);
+
+    return c;
+}
+
+TCanvas *MH::MakeDefCanvas(const TObject *obj,
+                           const UInt_t w, const UInt_t h)
+{
+    return MakeDefCanvas(obj->GetName(), obj->GetTitle(), w, h);
+}
