LCFIPlus  0.6.5
TreeStorer.h
Go to the documentation of this file.
1 // TreeStorer.h
2 #ifndef TreeStore_h
3 #define TreeStore_h 1
4 
5 #include "TFile.h"
6 #include "TTree.h"
7 
8 using namespace std;
9 
10 namespace lcfiplus {
11 
12 class TreeStorer {
13  public:
14  enum {mode_input, mode_output};
15 
16  TreeStorer(const char* filename, const char* treename, int mode);
17  virtual ~TreeStorer();
18 
19  // both for output and input
20  void Register(const char* name);
21 
22  // for input only: register all branches
23  void RegisterAll();
24 
25  // output function
26  void Fill();
27  void Write();
28 
29  // for input
30  void GetEntry(int n);
31 
32  // for manual operation
33  TTree* GetTree() {
34  return _tree;
35  }
36  int GetEntries()const {
37  return _tree->GetEntries();
38  }
39 
40  private:
41  TFile* _file;
42  TTree* _tree;
43 
44  int _mode;
45 };
46 
47 }
48 
49 #endif
TTree * GetTree()
Definition: TreeStorer.h:33
int GetEntries() const
Definition: TreeStorer.h:36
Definition: TreeStorer.h:12