Index: trunk/MagicSoft/Mars/mhist/MBinning.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MBinning.cc	(revision 1481)
+++ trunk/MagicSoft/Mars/mhist/MBinning.cc	(revision 1483)
@@ -36,4 +36,7 @@
 ClassImp(MBinning);
 
+static const TString gsDefName  = "MBinning";
+static const TString gsDefTitle = "Container describing the binning of an axis";
+
 // --------------------------------------------------------------------------
 //
@@ -46,6 +49,6 @@
     //   set the name and title of this object
     //
-    fName  = name  ? name  : "MBinning";
-    fTitle = title ? title : "Container describing the binning of an axis";
+    fName  = name  ? name  : gsDefName.Data();
+    fTitle = title ? title : gsDefTitle.Data();
 
     SetEdges(10, 0, 1);
@@ -105,6 +108,13 @@
 void MBinning::StreamPrimitive(ofstream &out) const
 {
-    out << "   MBinning " << ToLower(fName) << "(\"";
-    out << fName << "\", \"" << fTitle << "\");" << endl;
+    out << "   MBinning " << GetUniqueName();
+    if (fName!=gsDefName)
+    {
+        out << "(\"" << fName << "\"";
+        if (fTitle!=gsDefTitle)
+            out << ", \"" << fTitle << "\"";
+        out <<")";
+    }
+    out << ";" << endl;
 
     if (IsDefault())
@@ -113,5 +123,5 @@
     if (IsLinear() || IsLogarithmic())
     {
-        out << "   " << ToLower(fName) << ".SetEdges";
+        out << "   " << GetUniqueName() << ".SetEdges";
         if (IsLogarithmic())
             out << "Log";
@@ -124,5 +134,5 @@
     for (int i=0; i<GetNumEdges(); i++)
         out << "      dummy[" << i << "]=" << GetEdges()[i] << ";" << endl;
-    out << "      " << ToLower(fName) << ".SetEdges(dummy);" << endl;
+    out << "      " << GetUniqueName() << ".SetEdges(dummy);" << endl;
     out << "   }" << endl;
 }
Index: trunk/MagicSoft/Mars/mhist/MFillH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 1481)
+++ trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 1483)
@@ -358,13 +358,13 @@
         fParContainer->SavePrimitive(out);
 
-    out << "   MFillH " << ToLower(fName) << "(";
+    out << "   MFillH " << GetUniqueName() << "(";
 
     if (fH)
-        out << "&" << ToLower(fH->GetName());
+        out << "&" << fH->GetUniqueName();
     else
         out << "\"" << fHName << "\"";
 
     if (fParContainer)
-        out << ", &" << ToLower(fParContainer->GetName());
+        out << ", &" << fParContainer->GetUniqueName();
     else
         if (!fParContainerName.IsNull())
Index: trunk/MagicSoft/Mars/mhist/MH3.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH3.cc	(revision 1481)
+++ trunk/MagicSoft/Mars/mhist/MH3.cc	(revision 1483)
@@ -78,8 +78,11 @@
 ClassImp(MH3);
 
+static const TString gsDefName  = "MH3";
+static const TString gsDefTitle = "Container for a %dD Mars Histogram";
+
 MH3::MH3() : fDimension(0), fHist(NULL)
 {
-    fName  = "MH3";
-    fTitle = "Container for a 1D Mars Histogram";
+    fName  = gsDefName;
+    fTitle = Form(gsDefTitle.Data(), 0);
 
     fData[0]  = fData[1]  = fData[2]  = NULL;
@@ -101,6 +104,6 @@
     fData[2] = NULL;
 
-    fName  = "MH3";
-    fTitle = "Container for a 1D Mars Histogram";
+    fName  = gsDefName;
+    fTitle = Form(gsDefTitle.Data(), 1);
 
     fHist->SetDirectory(NULL);
@@ -127,6 +130,6 @@
     fData[2] = NULL;
 
-    fName  = "MH3";
-    fTitle = "Container for a 2D Mars Histogram";
+    fName  = gsDefName;
+    fTitle = Form(gsDefTitle.Data(), 2);
 
     fHist->SetDirectory(NULL);
@@ -153,6 +156,6 @@
     fData[2] = new MDataChain(memberz);
 
-    fName  = "MH3";
-    fTitle = "Container for a 3D Mars Histogram";
+    fName  = gsDefName;
+    fTitle = Form(gsDefTitle.Data(), 3);
 
     fHist->SetDirectory(NULL);
@@ -386,5 +389,5 @@
 void MH3::StreamPrimitive(ofstream &out) const
 {
-    TString name = ToLower(fName);
+    TString name = GetUniqueName();
 
     out << "   MH3 " << name << "(\"";
@@ -397,6 +400,9 @@
     out << ");" << endl;
 
-    out << "   " << name << ".SetName(\"" << fName << "\");" << endl;
-    out << "   " << name << ".SetTitle(\"" << fTitle << "\");" << endl;
+    if (fName!=gsDefName)
+        out << "   " << name << ".SetName(\"" << fName << "\");" << endl;
+
+    if (fTitle!=Form(gsDefTitle.Data(), fDimension))
+        out << "   " << name << ".SetTitle(\"" << fTitle << "\");" << endl;
 
     switch (fDimension)
