Index: trunk/MagicSoft/Mars/mbase/MWriteRootFile.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MWriteRootFile.h	(revision 993)
+++ trunk/MagicSoft/Mars/mbase/MWriteRootFile.h	(revision 994)
@@ -13,32 +13,18 @@
 class TBranch;
 
-class MRootFileTree : public TObject
+class MRootFileBranch : public TNamed
 {
 private:
     TTree         *fTree;
-    Bool_t         fWriteFlag;
-    ULong_t        fNumEntries;
+    TBranch       *fBranch;
 
-public:
-    MRootFileTree(TTree *tree) : fTree(tree), fWriteFlag(kFALSE), fNumEntries(0) {}
-    TTree *GetTree() const { return fTree; }
-    Bool_t HasWriteFlag() const { return fWriteFlag; }
-    ULong_t GetNumEntries() const { return fNumEntries; }
-    void operator++(int) { fNumEntries++; }
-    void SetWriteFlag() { fWriteFlag = kTRUE; }
-    void DelWriteFlag() { fWriteFlag = kFALSE; }
+    MParContainer *fContainer;
+    TString        fContName;
 
-    ClassDef(MRootFileTree, 0)  // Storage container for MWriteRootFile to store Tree informations
-};
-
-class MRootFileBranch : public TObject
-{
-private:
-    MRootFileTree *fTree;
-    TBranch       *fBranch;
-    MParContainer *fContainer;
-    TString       *fContName;
-    TString       *fTreeName;
-    TString       *fTreeTitle;
+    void Init(const char *name, const char *title)
+    {
+        SetName(name?name:"");
+        SetTitle(title?title:"");
+    }
 
 public:
@@ -46,27 +32,23 @@
         : fTree(NULL), fBranch(NULL), fContainer(NULL)
     {
-        fContName  = new TString(cname);
-        fTreeName  = tname ? new TString(tname) : NULL;
-        fTreeTitle = ttitle ? new TString(ttitle) : NULL;
+        Init(tname, ttitle);
+        fContName = cname;
     }
 
     MRootFileBranch(MParContainer *cont, const char *tname=NULL, const char *ttitle=NULL)
-        : fTree(NULL), fBranch(NULL), fContName(NULL)
+        : fTree(NULL), fBranch(NULL), fContName("")
     {
+        Init(tname, ttitle);
         fContainer = cont;
-        fTreeName  = tname ? new TString(tname) : NULL;
-        fTreeTitle = ttitle ? new TString(ttitle) : NULL;
     }
 
-        MRootFileTree *GetTree() const { return fTree; }
+    TTree         *GetTree() const      { return fTree; }
     MParContainer *GetContainer() const { return fContainer; }
-    void *GetAddress() { return &fContainer; }
-    TBranch *GetBranch() const          { return fBranch; }
-    const char *GetContName() const     { return fContName  ? (const char*)(*fContName)  : NULL; }
-    const char *GetTreeName() const     { return fTreeName  ? (const char*)(*fTreeName)  : NULL; }
-    const char *GetTreeTitle() const    { return fTreeTitle ? (const char*)(*fTreeTitle) : NULL; }
+    void          *GetAddress()         { return &fContainer; }
+    TBranch       *GetBranch() const    { return fBranch; }
+    const char    *GetContName() const  { return fContName; }
 
     void SetContainer(MParContainer *cont) { fContainer = cont; }
-    void SetTree(MRootFileTree *tree) { fTree = tree; }
+    void SetTree(TTree *tree)              { fTree = tree; }
 
     ClassDef(MRootFileBranch, 0) // Storage container for MWriteRootFile to store TBranch informations
@@ -95,5 +77,4 @@
     ~MWriteRootFile();
 
-    void Print(Option_t *t=NULL);
 
     void AddContainer(const char *cname,
@@ -102,4 +83,7 @@
                       const char *tname=NULL, const char *ttitle=NULL);
 
+
+    void Print(Option_t *t=NULL) const;
+
     ClassDef(MWriteRootFile, 0)	// Class to write one container to a root file
 };
