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 TChain;
|
---|
10 | class TChainElement;
|
---|
11 | class TBranch;
|
---|
12 | class TTree;
|
---|
13 | class MTaskList;
|
---|
14 |
|
---|
15 | class MReadTree : public MRead
|
---|
16 | {
|
---|
17 | friend class MReadReports;
|
---|
18 |
|
---|
19 | private:
|
---|
20 | MChain *fChain; // Pointer to tree==fTree (only if fTree inherits from MChain)
|
---|
21 | TTree *fTree; // Pointer to tree
|
---|
22 |
|
---|
23 | UInt_t fNumEntry; // Number of actual entry in chain
|
---|
24 | UInt_t fNumEntries; // Number of Events in chain
|
---|
25 |
|
---|
26 | Bool_t fBranchChoosing; // Flag for branch choosing method
|
---|
27 | Bool_t fAutoEnable; // Flag for auto enabeling scheme
|
---|
28 |
|
---|
29 | TList *fVetoList; //-> List of Branches which are not allowed to get enabled
|
---|
30 | TList *fNotify; //-> List of TObjects to notify when switching files
|
---|
31 |
|
---|
32 | MTaskList *fTaskList; // Tasklist to set StreamId
|
---|
33 | TList fParList;
|
---|
34 |
|
---|
35 | enum { kChainWasChanged = BIT(14) };
|
---|
36 | // MReadReports::kIsRequired = BIT(22)
|
---|
37 | // MReadReports::kIsProcessed = BIT(23)
|
---|
38 |
|
---|
39 | private:
|
---|
40 | void SetBranchStatus(const TList *list, Bool_t status);
|
---|
41 | void SetBranchStatus(TObject *branch, Bool_t status);
|
---|
42 | void SetBranchStatus(const char *name, Bool_t status);
|
---|
43 |
|
---|
44 | Bool_t IsOwned(const TChainElement &e) const;
|
---|
45 |
|
---|
46 | void GetListOfBranches(TList &list) const;
|
---|
47 | MParContainer *FindCreateObj(MParList &plist, const char *cname, const char *name);
|
---|
48 | void *GetParameterPtr(MParList &plist, const TString &bb, const char *parname);
|
---|
49 | Bool_t SetBranchAddress(TBranch &b, void *ptr, const char *prefix, const char *type=0);
|
---|
50 |
|
---|
51 | void DisableSubBranches(TBranch *b);
|
---|
52 | void EnableBranches(MParList *plist);
|
---|
53 | void EnableBranchChoosing();
|
---|
54 |
|
---|
55 | Bool_t CheckBranchSize();
|
---|
56 |
|
---|
57 | virtual void SetReadyToSave(Bool_t flag=kTRUE);
|
---|
58 | virtual void StreamPrimitive(std::ostream &out) const;
|
---|
59 |
|
---|
60 | enum { kIsOwner = BIT(14) };
|
---|
61 | // MReadReports::kIsRequired = BIT(22)
|
---|
62 | // MReadReports::kIsProcessed = BIT(23)
|
---|
63 |
|
---|
64 | public:
|
---|
65 | MReadTree(TTree *tree=0);
|
---|
66 | MReadTree(const char *treename, const char *filename=NULL, const char *name=NULL, const char *title=NULL);
|
---|
67 | ~MReadTree();
|
---|
68 |
|
---|
69 | static Byte_t IsFileValid(const char *name);
|
---|
70 |
|
---|
71 | virtual void SortFiles();
|
---|
72 |
|
---|
73 | void DisableAutoScheme() { fAutoEnable = kFALSE; }
|
---|
74 | void EnableBranch(const char *name);
|
---|
75 | void VetoBranch(const char *name);
|
---|
76 |
|
---|
77 | Bool_t GetEvent();
|
---|
78 |
|
---|
79 | Bool_t DecEventNum(UInt_t dec=1); // decrease number of event (position in tree)
|
---|
80 | Bool_t IncEventNum(UInt_t inc=1); // increase number of event (position in tree)
|
---|
81 | Bool_t SetEventNum(UInt_t nr); // set number of event (position in tree)
|
---|
82 |
|
---|
83 | UInt_t GetNumEntry() const { return fNumEntry; }
|
---|
84 | UInt_t GetEntries();
|
---|
85 |
|
---|
86 | //TString GetFileName() const;
|
---|
87 | TString GetFullFileName() const;
|
---|
88 | Int_t GetFileIndex() const;
|
---|
89 | Int_t GetNumFiles() const;
|
---|
90 |
|
---|
91 | virtual void AddNotify(TObject *obj);
|
---|
92 | virtual void SetOwner(Bool_t flag=kTRUE);
|
---|
93 |
|
---|
94 | virtual Int_t AddFile(const char *fname, Int_t entries=-1);
|
---|
95 | virtual Int_t AddFiles(const MReadTree &read);
|
---|
96 | Int_t AddFiles(MDirIter &dir) { return MRead::AddFiles(dir); }
|
---|
97 | Bool_t AddFriend(TChain &c);
|
---|
98 |
|
---|
99 | Int_t PreProcess(MParList *pList);
|
---|
100 | Int_t Process();
|
---|
101 | Int_t PostProcess();
|
---|
102 |
|
---|
103 | Bool_t Notify();
|
---|
104 | Bool_t Rewind() { SetEventNum(0); return kTRUE; }
|
---|
105 | void Print(Option_t *opt="") const;
|
---|
106 |
|
---|
107 | ClassDef(MReadTree, 1) // Reads a tree from file(s)
|
---|
108 | };
|
---|
109 |
|
---|
110 | #endif
|
---|