source: trunk/MagicSoft/Mars/mfileio/MReadTree.h@ 6194

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