| 1 | #ifndef MARS_MReadTree | 
|---|
| 2 | #define MARS_MReadTree | 
|---|
| 3 |  | 
|---|
| 4 | #ifndef MARS_MRead | 
|---|
| 5 | #include "MRead.h" | 
|---|
| 6 | #endif | 
|---|
| 7 |  | 
|---|
| 8 | class MChain; | 
|---|
| 9 | class TBranch; | 
|---|
| 10 |  | 
|---|
| 11 | class MReadTree : public MRead | 
|---|
| 12 | { | 
|---|
| 13 | friend class MReadReports; | 
|---|
| 14 |  | 
|---|
| 15 | private: | 
|---|
| 16 | MChain *fChain;            // Pointer to tree | 
|---|
| 17 |  | 
|---|
| 18 | UInt_t  fNumEntry;         // Number of actual entry in chain | 
|---|
| 19 | UInt_t  fNumEntries;       // Number of Events in chain | 
|---|
| 20 |  | 
|---|
| 21 | Bool_t  fBranchChoosing;   // Flag for branch choosing method | 
|---|
| 22 | Bool_t  fAutoEnable;       // Flag for auto enabeling scheme | 
|---|
| 23 |  | 
|---|
| 24 | TList  *fVetoList;         // List of Branches which are not allowed to get enabled | 
|---|
| 25 | TList  *fNotify;           // List of TObjects to notify when switching files | 
|---|
| 26 |  | 
|---|
| 27 | enum { kChainWasChanged = BIT(14) }; | 
|---|
| 28 |  | 
|---|
| 29 | private: | 
|---|
| 30 | void SetBranchStatus(const TList *list, Bool_t status); | 
|---|
| 31 | void SetBranchStatus(TObject *branch, Bool_t status); | 
|---|
| 32 | void SetBranchStatus(const char *name, Bool_t status); | 
|---|
| 33 |  | 
|---|
| 34 | void DisableSubBranches(TBranch *b); | 
|---|
| 35 | void EnableBranches(MParList *plist); | 
|---|
| 36 | void EnableBranchChoosing(); | 
|---|
| 37 |  | 
|---|
| 38 | Bool_t CheckBranchSize(); | 
|---|
| 39 |  | 
|---|
| 40 | virtual void SetReadyToSave(Bool_t flag=kTRUE); | 
|---|
| 41 | virtual void StreamPrimitive(ofstream &out) const; | 
|---|
| 42 |  | 
|---|
| 43 | enum { kIsOwner = BIT(14) }; | 
|---|
| 44 |  | 
|---|
| 45 | public: | 
|---|
| 46 | MReadTree(); | 
|---|
| 47 | MReadTree(const char *treename, const char *filename=NULL, const char *name=NULL, const char *title=NULL); | 
|---|
| 48 | ~MReadTree(); | 
|---|
| 49 |  | 
|---|
| 50 | virtual void SortFiles(); | 
|---|
| 51 |  | 
|---|
| 52 | void   DisableAutoScheme() { fAutoEnable = kFALSE; } | 
|---|
| 53 | void   EnableBranch(const char *name); | 
|---|
| 54 | void   VetoBranch(const char *name); | 
|---|
| 55 |  | 
|---|
| 56 | Bool_t GetEvent(); | 
|---|
| 57 |  | 
|---|
| 58 | Bool_t DecEventNum(UInt_t dec=1); // decrease number of event (position in tree) | 
|---|
| 59 | Bool_t IncEventNum(UInt_t inc=1); // increase number of event (position in tree) | 
|---|
| 60 | Bool_t SetEventNum(UInt_t nr);    // set number of event (position in tree) | 
|---|
| 61 |  | 
|---|
| 62 | UInt_t GetNumEntry() const { return fNumEntry; } | 
|---|
| 63 | UInt_t GetEntries(); | 
|---|
| 64 |  | 
|---|
| 65 | TString GetFileName() const; | 
|---|
| 66 | Int_t   GetFileIndex() const; | 
|---|
| 67 |  | 
|---|
| 68 | virtual void AddNotify(TObject *obj); | 
|---|
| 69 | virtual void SetOwner(Bool_t flag=kTRUE); | 
|---|
| 70 |  | 
|---|
| 71 | virtual Int_t AddFile(const char *fname, Int_t entries=-1); | 
|---|
| 72 | virtual Int_t AddFiles(const MReadTree &read); | 
|---|
| 73 |  | 
|---|
| 74 | Int_t PreProcess(MParList *pList); | 
|---|
| 75 | Int_t Process(); | 
|---|
| 76 | Int_t PostProcess(); | 
|---|
| 77 |  | 
|---|
| 78 | Bool_t Notify(); | 
|---|
| 79 | Bool_t Rewind() { SetEventNum(0); return kTRUE; } | 
|---|
| 80 | void   Print(Option_t *opt="") const; | 
|---|
| 81 |  | 
|---|
| 82 | ClassDef(MReadTree, 1)      // Reads a tree from file(s) | 
|---|
| 83 | }; | 
|---|
| 84 |  | 
|---|
| 85 | #endif | 
|---|