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 | class TTree;
|
---|
11 | class MTaskList;
|
---|
12 |
|
---|
13 | class MReadTree : public MRead
|
---|
14 | {
|
---|
15 | friend class MReadReports;
|
---|
16 |
|
---|
17 | private:
|
---|
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 | // MReadReports::kIsRequired = BIT(22)
|
---|
34 | // MReadReports::kIsProcessed = BIT(23)
|
---|
35 |
|
---|
36 | private:
|
---|
37 | void SetBranchStatus(const TList *list, Bool_t status);
|
---|
38 | void SetBranchStatus(TObject *branch, Bool_t status);
|
---|
39 | void SetBranchStatus(const char *name, Bool_t status);
|
---|
40 |
|
---|
41 | void DisableSubBranches(TBranch *b);
|
---|
42 | void EnableBranches(MParList *plist);
|
---|
43 | void EnableBranchChoosing();
|
---|
44 |
|
---|
45 | Bool_t CheckBranchSize();
|
---|
46 |
|
---|
47 | virtual void SetReadyToSave(Bool_t flag=kTRUE);
|
---|
48 | virtual void StreamPrimitive(ostream &out) const;
|
---|
49 |
|
---|
50 | enum { kIsOwner = BIT(14) };
|
---|
51 | // MReadReports::kIsRequired = BIT(22)
|
---|
52 | // MReadReports::kIsProcessed = BIT(23)
|
---|
53 |
|
---|
54 | public:
|
---|
55 | MReadTree(TTree *tree=0);
|
---|
56 | MReadTree(const char *treename, const char *filename=NULL, const char *name=NULL, const char *title=NULL);
|
---|
57 | ~MReadTree();
|
---|
58 |
|
---|
59 | static Byte_t IsFileValid(const char *name);
|
---|
60 |
|
---|
61 | virtual void SortFiles();
|
---|
62 |
|
---|
63 | void DisableAutoScheme() { fAutoEnable = kFALSE; }
|
---|
64 | void EnableBranch(const char *name);
|
---|
65 | void VetoBranch(const char *name);
|
---|
66 |
|
---|
67 | Bool_t GetEvent();
|
---|
68 |
|
---|
69 | Bool_t DecEventNum(UInt_t dec=1); // decrease number of event (position in tree)
|
---|
70 | Bool_t IncEventNum(UInt_t inc=1); // increase number of event (position in tree)
|
---|
71 | Bool_t SetEventNum(UInt_t nr); // set number of event (position in tree)
|
---|
72 |
|
---|
73 | UInt_t GetNumEntry() const { return fNumEntry; }
|
---|
74 | UInt_t GetEntries();
|
---|
75 |
|
---|
76 | //TString GetFileName() const;
|
---|
77 | TString GetFullFileName() const;
|
---|
78 | Int_t GetFileIndex() const;
|
---|
79 |
|
---|
80 | virtual void AddNotify(TObject *obj);
|
---|
81 | virtual void SetOwner(Bool_t flag=kTRUE);
|
---|
82 |
|
---|
83 | virtual Int_t AddFile(const char *fname, Int_t entries=-1);
|
---|
84 | virtual Int_t AddFiles(const MReadTree &read);
|
---|
85 | Int_t AddFiles(MDirIter &dir) { return MRead::AddFiles(dir); }
|
---|
86 |
|
---|
87 | Int_t PreProcess(MParList *pList);
|
---|
88 | Int_t Process();
|
---|
89 | Int_t PostProcess();
|
---|
90 |
|
---|
91 | Bool_t Notify();
|
---|
92 | Bool_t Rewind() { SetEventNum(0); return kTRUE; }
|
---|
93 | void Print(Option_t *opt="") const;
|
---|
94 |
|
---|
95 | ClassDef(MReadTree, 1) // Reads a tree from file(s)
|
---|
96 | };
|
---|
97 |
|
---|
98 | #endif
|
---|
99 |
|
---|