Changeset 994 for trunk


Ignore:
Timestamp:
10/26/01 15:11:45 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MWriteRootFile.h

    r969 r994  
    1313class TBranch;
    1414
    15 class MRootFileTree : public TObject
     15class MRootFileBranch : public TNamed
    1616{
    1717private:
    1818    TTree         *fTree;
    19     Bool_t         fWriteFlag;
    20     ULong_t        fNumEntries;
     19    TBranch       *fBranch;
    2120
    22 public:
    23     MRootFileTree(TTree *tree) : fTree(tree), fWriteFlag(kFALSE), fNumEntries(0) {}
    24     TTree *GetTree() const { return fTree; }
    25     Bool_t HasWriteFlag() const { return fWriteFlag; }
    26     ULong_t GetNumEntries() const { return fNumEntries; }
    27     void operator++(int) { fNumEntries++; }
    28     void SetWriteFlag() { fWriteFlag = kTRUE; }
    29     void DelWriteFlag() { fWriteFlag = kFALSE; }
     21    MParContainer *fContainer;
     22    TString        fContName;
    3023
    31     ClassDef(MRootFileTree, 0)  // Storage container for MWriteRootFile to store Tree informations
    32 };
    33 
    34 class MRootFileBranch : public TObject
    35 {
    36 private:
    37     MRootFileTree *fTree;
    38     TBranch       *fBranch;
    39     MParContainer *fContainer;
    40     TString       *fContName;
    41     TString       *fTreeName;
    42     TString       *fTreeTitle;
     24    void Init(const char *name, const char *title)
     25    {
     26        SetName(name?name:"");
     27        SetTitle(title?title:"");
     28    }
    4329
    4430public:
     
    4632        : fTree(NULL), fBranch(NULL), fContainer(NULL)
    4733    {
    48         fContName  = new TString(cname);
    49         fTreeName  = tname ? new TString(tname) : NULL;
    50         fTreeTitle = ttitle ? new TString(ttitle) : NULL;
     34        Init(tname, ttitle);
     35        fContName = cname;
    5136    }
    5237
    5338    MRootFileBranch(MParContainer *cont, const char *tname=NULL, const char *ttitle=NULL)
    54         : fTree(NULL), fBranch(NULL), fContName(NULL)
     39        : fTree(NULL), fBranch(NULL), fContName("")
    5540    {
     41        Init(tname, ttitle);
    5642        fContainer = cont;
    57         fTreeName  = tname ? new TString(tname) : NULL;
    58         fTreeTitle = ttitle ? new TString(ttitle) : NULL;
    5943    }
    6044
    61         MRootFileTree *GetTree() const { return fTree; }
     45    TTree         *GetTree() const      { return fTree; }
    6246    MParContainer *GetContainer() const { return fContainer; }
    63     void *GetAddress() { return &fContainer; }
    64     TBranch *GetBranch() const          { return fBranch; }
    65     const char *GetContName() const     { return fContName  ? (const char*)(*fContName)  : NULL; }
    66     const char *GetTreeName() const     { return fTreeName  ? (const char*)(*fTreeName)  : NULL; }
    67     const char *GetTreeTitle() const    { return fTreeTitle ? (const char*)(*fTreeTitle) : NULL; }
     47    void          *GetAddress()         { return &fContainer; }
     48    TBranch       *GetBranch() const    { return fBranch; }
     49    const char    *GetContName() const  { return fContName; }
    6850
    6951    void SetContainer(MParContainer *cont) { fContainer = cont; }
    70     void SetTree(MRootFileTree *tree) { fTree = tree; }
     52    void SetTree(TTree *tree)              { fTree = tree; }
    7153
    7254    ClassDef(MRootFileBranch, 0) // Storage container for MWriteRootFile to store TBranch informations
     
    9577    ~MWriteRootFile();
    9678
    97     void Print(Option_t *t=NULL);
    9879
    9980    void AddContainer(const char *cname,
     
    10283                      const char *tname=NULL, const char *ttitle=NULL);
    10384
     85
     86    void Print(Option_t *t=NULL) const;
     87
    10488    ClassDef(MWriteRootFile, 0) // Class to write one container to a root file
    10589};
Note: See TracChangeset for help on using the changeset viewer.