Index: trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1476)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1477)
@@ -80,5 +80,5 @@
     fTitle = rhs.fTitle;
 
-    fLog         = rhs.fLog;
+    fLog = rhs.fLog;
     fReadyToSave = rhs.fReadyToSave;
 
@@ -123,5 +123,5 @@
     cont.fTitle = fTitle;
 
-    cont.fLog         = fLog;
+    cont.fLog = fLog;
     cont.fReadyToSave = fReadyToSave;
 }
@@ -168,4 +168,5 @@
 {
     fName = name;
+    ResetBit(kIsSavedAsPrimitive);
     if (gPad && TestBit(kMustCleanup)) gPad->Modified();
 }
@@ -180,4 +181,5 @@
     fName  = name;
     fTitle = title;
+    ResetBit(kIsSavedAsPrimitive);
     if (gPad && TestBit(kMustCleanup)) gPad->Modified();
 }
@@ -190,4 +192,5 @@
 {
     fTitle = title;
+    ResetBit(kIsSavedAsPrimitive);
     if (gPad && TestBit(kMustCleanup)) gPad->Modified();
 }
@@ -356,5 +359,18 @@
 void MParContainer::SavePrimitive(ofstream &out, Option_t *o)
 {
-    out << "   // SavePrimitive not overloaded... using default." << endl;
+    if (IsSavedAsPrimitive())
+        return;
+
+    StreamPrimitive(out);
+    SetBit(kIsSavedAsPrimitive);
+}
+
+// --------------------------------------------------------------------------
+//
+// Creates the string written by SavePrimitive and returns it.
+//
+void MParContainer::StreamPrimitive(ofstream &out) const
+{
+    out << "   // Using MParContainer::StreamPrimitive" << endl;
     out << "   " << ClassName() << " " << ToLower(fName) << "(\"";
     out << fName << "\", \"" << fTitle << "\");" << endl;
Index: trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1476)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1477)
@@ -34,6 +34,12 @@
     MLog   *fLog;         // The general log facility for this object, initialized with the global object
 
+    virtual void StreamPrimitive(ofstream &out) const;
+
 private:
     Bool_t  fReadyToSave; // should be set to true if the contents of the container is changed somehow
+
+    enum {
+        kIsSavedAsPrimitive = BIT(15)
+    };
 
 public:
@@ -67,4 +73,5 @@
     virtual Bool_t IsReadyToSave() const             { return fReadyToSave; }
     virtual void   SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
+    virtual Bool_t IsSavedAsPrimitive() const        { return TestBit(kIsSavedAsPrimitive); }
 
     TMethodCall *GetterMethod(const char *name) const;
Index: trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1476)
+++ trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1477)
@@ -666,5 +666,5 @@
 // gui elements to a macro-file.
 //
-void MParList::SavePrimitive(ofstream &out, Option_t *o)
+void MParList::StreamPrimitive(ofstream &out) const
 {
     out << "   MParList " << ToLower(fName) << "(\"";
@@ -677,4 +677,5 @@
     {
         cont->SavePrimitive(out, "");
+
         out << "   " << ToLower(fName) << ".AddToList(&";
         out << ToLower(cont->GetName()) << ");" << endl << endl;
@@ -691,15 +692,5 @@
 {
     MParContainer::SetNames(arr);
-    cout << fContainer << endl;
-    //    fContainer->ForEach(MParContainer, SetNames)(arr);
-    TIter Next(fContainer);
-
-    MParContainer *cont = NULL;
-    while ((cont=(MParContainer*)Next()))
-    {
-        cout << cont << " " << cont->GetName() << endl;
-        cont->SetNames(arr);
-    }
-
-}
-
+    fContainer->ForEach(MParContainer, SetNames)(arr);
+}
+
Index: trunk/MagicSoft/Mars/mbase/MParList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.h	(revision 1476)
+++ trunk/MagicSoft/Mars/mbase/MParList.h	(revision 1477)
@@ -32,4 +32,6 @@
 
     enum { kIsOwner = BIT(14) };
+
+    void StreamPrimitive(ofstream &out) const;
 
 public:
@@ -78,5 +80,4 @@
 
     void Print(Option_t *t = NULL) const;
-    void SavePrimitive(ofstream &out, Option_t *o="");
 
     void GetNames(TObjArray &arr) const;
Index: trunk/MagicSoft/Mars/mbase/MTask.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 1476)
+++ trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 1477)
@@ -265,12 +265,21 @@
 // --------------------------------------------------------------------------
 //
-// Implementation of SavePrimitive. Used to write the call to a constructor
-// to a macro. In the original root implementation it is used to write
-// gui elements to a macro-file.
-//
-void MTask::SavePrimitive(ofstream &out, Option_t *o)
+// First call MParContainer::SavePrimitive which should stream the primitive
+// to the output stream. Then, if a filter is set, stream first the filter
+// and afterwards set the filter for this task.
+//
+void MTask::SavePrimitive(ofstream &out, Option_t *o="")
 {
     MParContainer::SavePrimitive(out);
-    if (fFilter)
-        out << "   " << ToLower(fName) << ".SetFilter(&" << ToLower(fFilter->GetName()) <<");" << endl;
-}
+    if (!fFilter)
+        return;
+
+    /*
+     If we don't stream filter which are not in the task list itself
+     (which means: alrteady streamed) we may be able to use the
+     primitive streamer as some kind of validity check for the macros
+
+     fFilter->SavePrimitive(out);
+     out << "   " << ToLower(fName) << ".SetFilter(&" << ToLower(fFilter->GetName()) <<");" << endl;
+     */
+}
Index: trunk/MagicSoft/Mars/mbase/MTask.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.h	(revision 1476)
+++ trunk/MagicSoft/Mars/mbase/MTask.h	(revision 1477)
@@ -22,10 +22,10 @@
 {
 private:
-    TList *fListOfBranches; // List of Branch names for auto enabeling scheme
+    TList *fListOfBranches; //! List of Branch names for auto enabeling scheme
 
     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
+    Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList)
+    UInt_t fNumExecutions;  //! Number of Excutions
 
     virtual Bool_t PreProcess(MParList *pList);
@@ -71,5 +71,4 @@
     const MFilter *GetFilter() const      { return fFilter; }
     virtual void PrintStatistics(const Int_t lvl=0) const;
-    virtual void SavePrimitive(ofstream &out, Option_t *o="");
 
     UInt_t GetNumExecutions() { return fNumExecutions; }
@@ -83,5 +82,7 @@
     const TList *GetListOfBranches() const { return fListOfBranches; }
 
-    ClassDef(MTask, 0) //Abstract base class for a task
+    void SavePrimitive(ofstream &out, Option_t *o="");
+
+    ClassDef(MTask, 1) //Abstract base class for a task
 };
 
Index: trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1476)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1477)
@@ -520,5 +520,5 @@
 // gui elements to a macro-file.
 //
-void MTaskList::SavePrimitive(ofstream &out, Option_t *o)
+void MTaskList::StreamPrimitive(ofstream &out) const
 {
     out << "   MTaskList " << ToLower(fName) << "(\"";
Index: trunk/MagicSoft/Mars/mbase/MTaskList.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 1476)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 1477)
@@ -33,4 +33,6 @@
     Bool_t CheckClassForProcess(TClass *cls);
 
+    void StreamPrimitive(ofstream &out) const;
+
 public:
     MTaskList(const char *name=NULL, const char *title=NULL);
@@ -56,6 +58,4 @@
     void SetOwner(Bool_t enable=kTRUE);
 
-    void SavePrimitive(ofstream &out, Option_t *o="");
-
     const TList *GetList() const { return fTasks; }
 
