Index: trunk/MagicSoft/Mars/mfileio/MReadTree.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 1465)
+++ trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 1471)
@@ -801,2 +801,23 @@
     *fLog << " Next Entry to read: " << fNumEntry << endl;
 }
+
+void MReadTree::SavePrimitive(ofstream &out, Option_t *o="")
+{
+    TString name = ToLower(fName);
+
+    out << "   " << ClassName() << " " << name << "(";
+    out << fChain->GetName() << ", \"" << fName << "\", \"" << fTitle << "\");" << endl;
+
+    TIter Next(fChain->GetListOfFiles());
+    TObject *obj = NULL;
+    while ((obj=Next()))
+        out << "   " << name << ".AddFile(\"" << obj->GetTitle() << "\");" << endl;
+
+    if (!fAutoEnable)
+        out << "   " << name << ".DisableAutoScheme();" << endl;
+
+    if (fNumEntry!=0)
+       out << "   " << name << ".SetEventNum(" << fNumEntry << ");" << endl;
+
+
+}
Index: trunk/MagicSoft/Mars/mfileio/MReadTree.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadTree.h	(revision 1465)
+++ trunk/MagicSoft/Mars/mfileio/MReadTree.h	(revision 1471)
@@ -71,4 +71,5 @@
 
     virtual Bool_t Notify();
+    virtual void   SavePrimitive(ofstream &out, Option_t *o="");
 
     ClassDef(MReadTree, 0)	// Reads a tree from file(s)
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 1465)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 1471)
@@ -34,6 +34,7 @@
 //                                                                         //
 /////////////////////////////////////////////////////////////////////////////
-
 #include "MWriteRootFile.h"
+
+#include <fstream.h>
 
 #include <TFile.h>
@@ -383,2 +384,21 @@
 }
 
+void MWriteRootFile::SavePrimitive(ofstream &out, Option_t *o="")
+{
+    out << "   MWriteRootFile " << ToLower(fName) << "(\"";
+    out << fOut->GetName() << "\", \"";
+    out << fOut->GetOption() << "\", \"";
+    out << fOut->GetTitle() << "\", ";
+    out << fOut->GetCompressionLevel() << ", \"";
+    out << fName << "\", " << fTitle << "\");" << endl;;
+
+    MRootFileBranch *entry;
+    TIter Next(&fBranches);
+    while ((entry=(MRootFileBranch*)Next()))
+    {
+        out << "   " << ToLower(fName) << ".AddContainer(\"";
+        out << entry->GetContName() << "\", \"";
+        out << entry->GetName() << "\", \"";
+        out << entry->GetTitle() << "\")" << endl;
+    }
+}
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h	(revision 1465)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h	(revision 1471)
@@ -85,4 +85,5 @@
 
     void Print(Option_t *t=NULL) const;
+    void SavePrimitive(ofstream &out, Option_t *o="");
 
     ClassDef(MWriteRootFile, 0)	// Class to write one container to a root file
