Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1470)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1471)
@@ -2,4 +2,11 @@
 
  2002/08/01: Thomas Bretz
+
+   * manalysis/MHillasSrcCalc.[h,cc], manalysis/MImgCleanStd.[h,cc],
+     manalysis/MSrcPosCam.[h,cc], mbase/MEvtLoop.[h,cc], 
+     mbase/MParContainer.[h,cc], mbase/MParList.[h,cc],
+     mbase/MTaskList.[h,cc], mfileio/MReadTree.[h,cc],
+     mfileio/MWriteRootFile.[h,cc], mhist/MFillH.[h,cc]:
+     - added SavePrimitive
 
    * manalysis/MHillas.[h,cc]:
Index: /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc	(revision 1470)
+++ /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc	(revision 1471)
@@ -32,4 +32,6 @@
 //////////////////////////////////////////////////////////////////////////////
 #include "MHillasSrcCalc.h"
+
+#include <fstream.h>
 
 #include "MParList.h"
@@ -94,2 +96,9 @@
 }
 
+
+void MHillasSrcCalc::SavePrimitive(ofstream &out, Option_t *o="")
+{
+    out << "   MHillasSrcCalc " << ToLower(fName) << "(\"";
+    out << fSrcName << "\", \"" << fHillasName << "\", \"";
+    out << fName << "\", \"" << fTitle << "\");" << endl;
+}
Index: /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h	(revision 1470)
+++ /trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h	(revision 1471)
@@ -27,4 +27,6 @@
     Bool_t Process();
 
+    void SavePrimitive(ofstream &out, Option_t *o="");
+
     ClassDef(MHillasSrcCalc, 0) // task to calculate the source position depandant hillas parameters
 };
Index: /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 1470)
+++ /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc	(revision 1471)
@@ -44,4 +44,5 @@
 
 #include <stdlib.h>       // atof
+#include <fstream.h>      // ofstream, SavePrimitive
 
 #include <TGFrame.h>      // TGFrame
@@ -406,2 +407,9 @@
     return kTRUE;
 }
+
+void MImgCleanStd::SavePrimitive(ofstream &out, Option_t *o="")
+{
+    out << "   MImgCleanStd " << ToLower(fName) << "(";
+    out << fCleanLvl1 << ", " << fCleanLvl2 << ", \"";
+    out << fName << "\", \"" << fTitle << "\");" << endl;
+}
Index: /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h	(revision 1470)
+++ /trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h	(revision 1471)
@@ -34,4 +34,5 @@
 
     void Print(Option_t *o="") const;
+    void SavePrimitive(ofstream &out, Option_t *o="");
 
     Bool_t ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2);
Index: /trunk/MagicSoft/Mars/manalysis/MSrcPosCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MSrcPosCam.cc	(revision 1470)
+++ /trunk/MagicSoft/Mars/manalysis/MSrcPosCam.cc	(revision 1471)
@@ -81,2 +81,9 @@
 }
 */
+
+void MSrcPosCam::SavePrimitive(ofstream &out, Option_t *o="")
+{
+    out << "   MSrcPosCam " << ToLower(fName) << "(\"";
+    out << fName << "\", " << fTitle << "\");" << endl;
+
+    out << "   " << ToLower(fName) << ".SetXY(" << fX << ", " << fY << ");" << endl;}
Index: /trunk/MagicSoft/Mars/manalysis/MSrcPosCam.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MSrcPosCam.h	(revision 1470)
+++ /trunk/MagicSoft/Mars/manalysis/MSrcPosCam.h	(revision 1471)
@@ -29,4 +29,6 @@
     //void AsciiWrite(ofstream &fout) const;
 
+    void SavePrimitive(ofstream &out, Option_t *o="");
+
     ClassDef(MSrcPosCam, 1) // container to store source position in the camera plain
 };
Index: /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1470)
+++ /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1471)
@@ -54,4 +54,5 @@
 #include "MEvtLoop.h"
 
+#include <fstream.h>     // ofstream, SavePrimitive
 #include <iostream.h>
 
@@ -274,2 +275,11 @@
 }
 
+void MEvtLoop::SavePrimitive(ofstream &out, Option_t *)
+{
+    fParList->SavePrimitive(out);
+
+    out << "   MEvtLoop evtloop;" << endl;
+    out << "   evtloop.SetParList(&" << ToLower(fParList->GetName()) << ")" << endl;
+    out << "   if (!evtloop.Eventloop())" << endl;
+    out << "      return;" << endl;
+}
Index: /trunk/MagicSoft/Mars/mbase/MEvtLoop.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 1470)
+++ /trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 1471)
@@ -46,4 +46,6 @@
     Bool_t Eventloop(Int_t maxcnt=-1, const char *tlist="MTaskList");
 
+    void SavePrimitive(ofstream &out, Option_t *o="");
+
     ClassDef(MEvtLoop, 0) // Class to execute the tasks in a tasklist
 };
Index: /trunk/MagicSoft/Mars/mbase/MParContainer.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1470)
+++ /trunk/MagicSoft/Mars/mbase/MParContainer.cc	(revision 1471)
@@ -346,2 +346,10 @@
     return call;
 }
+
+void MParContainer::SavePrimitive(ofstream &out, Option_t *o="")
+{
+    out << "   // SavePrimitive not overloaded... using default." << endl;
+    out << "   " << ClassName() << " " << ToLower(fName) << "(\"";
+    out << fName << "\", \"" << fTitle << "\");" << endl;
+}
+
Index: /trunk/MagicSoft/Mars/mbase/MParContainer.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1470)
+++ /trunk/MagicSoft/Mars/mbase/MParContainer.h	(revision 1471)
@@ -61,4 +61,5 @@
     virtual void        Print(Option_t *option="") const;
     virtual Int_t       Sizeof() const;
+    virtual void        SavePrimitive(ofstream &out, Option_t *o="");
 
     virtual void   SetLogStream(MLog *lg) { fLog = lg; }
Index: /trunk/MagicSoft/Mars/mbase/MParList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1470)
+++ /trunk/MagicSoft/Mars/mbase/MParList.cc	(revision 1471)
@@ -41,4 +41,6 @@
 #include "MParList.h"
 
+#include <fstream.h>     // ofstream, SavePrimitive
+
 #include <TNamed.h>
 #include <TClass.h>
@@ -657,2 +659,17 @@
     return list;
 }
+
+void MParList::SavePrimitive(ofstream &out, Option_t *o="")
+{
+    out << "   MParList " << ToLower(fName) << ";" << endl << endl;
+
+    TIter Next(fContainer);
+
+    TObject *cont = NULL;
+    while ((cont=Next()))
+    {
+        cont->SavePrimitive(out, "");
+        out << "   " << ToLower(fName) << ".AddToList(&";
+        out << ToLower(cont->GetName()) << ");" << endl << endl;
+    }
+}
Index: /trunk/MagicSoft/Mars/mbase/MParList.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MParList.h	(revision 1470)
+++ /trunk/MagicSoft/Mars/mbase/MParList.h	(revision 1471)
@@ -78,4 +78,5 @@
 
     void Print(Option_t *t = NULL) const;
+    void SavePrimitive(ofstream &out, Option_t *o="");
 
     ClassDef(MParList, 0) // list of parameter containers (MParContainer)
Index: /trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1470)
+++ /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1471)
@@ -57,4 +57,6 @@
 #include "MTaskList.h"
 
+#include <fstream.h>     // ofstream, SavePrimitive
+
 #include <TClass.h>
 #include <TBaseClass.h>
@@ -512,2 +514,17 @@
 }
 
+
+void MTaskList::SavePrimitive(ofstream &out, Option_t *o="")
+{
+    out << "   MTaskList " << ToLower(fName) << ";" << endl << endl;
+
+    TIter Next(fTasks);
+
+    TObject *cont = NULL;
+    while ((cont=Next()))
+    {
+        cont->SavePrimitive(out, "");
+        out << "   " << ToLower(fName) << ".AddToList(&";
+        out << ToLower(cont->GetName()) << ");" << endl << endl;
+    }
+}
Index: /trunk/MagicSoft/Mars/mbase/MTaskList.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 1470)
+++ /trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 1471)
@@ -56,4 +56,6 @@
     void SetOwner(Bool_t enable=kTRUE);
 
+    void SavePrimitive(ofstream &out, Option_t *o="");
+
     const TList *GetList() const { return fTasks; }
 
Index: /trunk/MagicSoft/Mars/mfileio/MReadTree.cc
===================================================================
--- /trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 1470)
+++ /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 1470)
+++ /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 1470)
+++ /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 1470)
+++ /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
Index: /trunk/MagicSoft/Mars/mhist/MFillH.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 1470)
+++ /trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 1471)
@@ -69,4 +69,6 @@
 #include "MFillH.h"
 
+#include <fstream.h>
+
 #include "MLog.h"
 #include "MLogManip.h"
@@ -331,2 +333,8 @@
     return kTRUE;
 }
+
+void MFillH::SavePrimitive(ofstream &out, Option_t *o="")
+{
+    out << "   MFillH " << ToLower(fName) << "(\"";
+    out << fHName << "\", \"" << fParContainerName << "\")" << endl;
+}
Index: /trunk/MagicSoft/Mars/mhist/MFillH.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MFillH.h	(revision 1470)
+++ /trunk/MagicSoft/Mars/mhist/MFillH.h	(revision 1471)
@@ -33,4 +33,6 @@
     Bool_t PostProcess();
 
+    void SavePrimitive(ofstream &out, Option_t *o="");
+
     ClassDef(MFillH, 0) // Task to fill a histogram with data from a parameter container
 };
