Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1481)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1483)
@@ -371,5 +371,5 @@
     out << "   MEvtLoop evtloop;" << endl;
     if (fParList)
-        out << "   evtloop.SetParList(&" << ToLower(fParList->GetName()) << ");" << endl;
+        out << "   evtloop.SetParList(&" << fParList->GetUniqueName() << ");" << endl;
     else
         out << "   // fParList empty..." << endl;
Index: trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1481)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1483)
@@ -37,4 +37,5 @@
 #include "MParContainer.h"
 
+#include <ctype.h>       // isdigit
 #include <fstream.h>     // ofstream, AsciiWrite
 
@@ -139,4 +140,22 @@
 // --------------------------------------------------------------------------
 //
+//  Return a unique name for this container. It is created from
+//  the container name and the unique Id. (This is mostly used
+//  in the StreamPrimitive member functions)
+//
+const TString MParContainer::GetUniqueName() const
+{
+    TString ret = ToLower(fName);
+
+    if (isdigit(ret[ret.Length()-1]))
+        ret+="_";
+
+    ret+=GetUniqueID();
+
+    return ret;
+}
+
+// --------------------------------------------------------------------------
+//
 //  List MParContainer name and title.
 //
@@ -359,7 +378,10 @@
 void MParContainer::SavePrimitive(ofstream &out, Option_t *o)
 {
+    static UInt_t uid = 0;
+
     if (IsSavedAsPrimitive())
         return;
 
+    SetUniqueID(uid++/*gRandom->Uniform(kMaxInt)*/);
     StreamPrimitive(out);
     SetBit(kIsSavedAsPrimitive);
@@ -373,5 +395,5 @@
 {
     out << "   // Using MParContainer::StreamPrimitive" << endl;
-    out << "   " << ClassName() << " " << ToLower(fName) << "(\"";
+    out << "   " << ClassName() << " " << GetUniqueName() << "(\"";
     out << fName << "\", \"" << fTitle << "\");" << endl;
 }
Index: trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1481)
+++ trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1483)
@@ -55,9 +55,10 @@
     virtual void        FillBuffer(char *&buffer);
 
-    virtual const char *GetDescriptor() const { return Form("%s [%s]", fName.Data(), ClassName()); }
-    virtual const char *GetName() const       { return fName.Data(); }
-    virtual const char *GetTitle() const      { return fTitle.Data(); }
-    virtual ULong_t     Hash() const          { return fName.Hash(); }
-    virtual Bool_t      IsSortable() const    { return kTRUE; }
+    virtual const char   *GetDescriptor() const { return Form("%s [%s]", fName.Data(), ClassName()); }
+    virtual const TString GetUniqueName() const;
+    virtual const char   *GetName() const       { return fName.Data(); }
+    virtual const char   *GetTitle() const      { return fTitle.Data(); }
+    virtual ULong_t       Hash() const          { return fName.Hash(); }
+    virtual Bool_t        IsSortable() const    { return kTRUE; }
 
     virtual void        SetName(const char *name); // *MENU*
Index: trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1481)
+++ trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1483)
@@ -52,4 +52,7 @@
 ClassImp(MParList);
 
+static const TString gsDefName  = "MParList";
+static const TString gsDefTitle = "A list of Parameter Containers";
+
 // --------------------------------------------------------------------------
 //
@@ -59,6 +62,6 @@
 MParList::MParList(const char *name, const char *title)
 {
-    fName  = name  ? name  : "MParList";
-    fTitle = title ? title : "A list of Parameter Containers";
+    fName  = name  ? name  : gsDefName.Data();
+    fTitle = title ? title : gsDefTitle.Data();
 
     //
@@ -668,19 +671,31 @@
 void MParList::StreamPrimitive(ofstream &out) const
 {
-    out << "   MParList " << ToLower(fName) << "(\"";
-    out << fName << "\", \"" << fTitle << "\");" << endl << endl;
+    out << "   MParList " << GetUniqueName();
+    if (fName!=gsDefName)
+    {
+        out << "(\"" << fName << "\"";
+        if (fTitle!=gsDefTitle)
+            out << ", \"" << fTitle << "\"";
+        out <<")";
+    }
+    out << ";" << endl << endl;
 
     TIter Next(fContainer);
 
-    TObject *cont = NULL;
-    while ((cont=Next()))
+    MParContainer *cont = NULL;
+    while ((cont=(MParContainer*)Next()))
     {
         cont->SavePrimitive(out, "");
 
-        out << "   " << ToLower(fName) << ".AddToList(&";
-        out << ToLower(cont->GetName()) << ");" << endl << endl;
-    }
-}
-
+        out << "   " << GetUniqueName() << ".AddToList(&";
+        out << cont->GetUniqueName() << ");" << endl << endl;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Adds one TNamed object per object in the list. The TNamed object must
+// be deleted by the user.
+//
 void MParList::GetNames(TObjArray &arr) const
 {
@@ -689,4 +704,9 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Sets name and title of each object in the list from the objects in
+// the array.
+//
 void MParList::SetNames(TObjArray &arr)
 {
Index: trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1481)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1483)
@@ -71,4 +71,6 @@
 ClassImp(MTaskList);
 
+static const TString gsDefName  = "MTaskList";
+static const TString gsDefTitle = "A list for tasks to be executed";
 // --------------------------------------------------------------------------
 //
@@ -79,6 +81,6 @@
 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  : gsDefName.Data();
+    fTitle = title ? title : gsDefTitle.Data();
 
     fTasks = new TList;
@@ -522,15 +524,22 @@
 void MTaskList::StreamPrimitive(ofstream &out) const
 {
-    out << "   MTaskList " << ToLower(fName) << "(\"";
-    out << fName << "\", \"" << fTitle << "\");" << endl << endl;
+    out << "   MTaskList " << GetUniqueName();
+    if (fName!=gsDefName)
+    {
+        out << "(\"" << fName << "\"";
+        if (fTitle!=gsDefTitle)
+            out << ", \"" << fTitle << "\"";
+        out <<")";
+    }
+    out << ";" << endl << endl;
 
     TIter Next(fTasks);
 
-    TObject *cont = NULL;
-    while ((cont=Next()))
+    MParContainer *cont = NULL;
+    while ((cont=(MParContainer*)Next()))
     {
         cont->SavePrimitive(out, "");
-        out << "   " << ToLower(fName) << ".AddToList(&";
-        out << ToLower(cont->GetName()) << ");" << endl << endl;
+        out << "   " << GetUniqueName() << ".AddToList(&";
+        out << cont->GetUniqueName() << ");" << endl << endl;
     }
 }
