StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TTreeIter.h
1 // Author: Victor Perev 08/04/01
2 
3 
4 #ifndef ROOT_TTreeIter
5 #define ROOT_TTreeIter
6 
7 
9 // //
10 // TTreeIter //
11 // //
12 // //
14 
15 #include "TTree.h"
16 #include "TString.h"
17 class TChain;
18 class TTreeIterMem;
20 {
21  public:
22  TTreeIterCast(Int_t *nerr){fV=0;fN=0;fT=0;fE=nerr;}
23  ~TTreeIterCast(){;}
24  void Set(void* v,Int_t t,const char* name=0);
25 
26  operator const Char_t &(); //type 1
27  operator const Short_t &(); //type 2
28  operator const Int_t &(); //type 3
29  operator const Long_t &(); //type 4
30  operator const Float_t &(); //type 5
31  operator const Double_t &(); //type 8
32  // operator const Double32_t &(); //type 9
33  operator const UChar_t &(); //type 11
34  operator const UShort_t &(); //type 12
35  operator const UInt_t &(); //type 13
36  operator const ULong_t &(); //type 14
37 
38  operator const Char_t* &(); //type 21
39  operator const Short_t* &(); //type 22
40  operator const Int_t* &(); //type 23
41  operator const Long_t* &(); //type 24
42  operator const Float_t* &(); //type 25
43  operator const Double_t* &(); //type 28
44  // operator const Double32_t* &(); //type 29
45  operator const UChar_t* &(); //type 31
46  operator const UShort_t* &(); //type 32
47  operator const UInt_t* &(); //type 33
48  operator const ULong_t* &(); //type 34
49  void *Addr(){return fV;}
50 
51  private:
52  void *Addr(Int_t outType);
53  void *fV;
54  Int_t fT;
55  Int_t *fE;
56  const char *fN;
57 };
58 
59 
60 class TTreeIter : public TNamed{
61 
62  protected:
63  Int_t fEntry;
64  TChain *fTree;
65  TObjArray fMemList;
66  TObjArray fBraList;
67  Int_t fUnits;
68  Int_t fNErr; //|
69  Int_t fCint; //|
70  Int_t fNFiles; //|
71 
72  TTreeIterCast fCast;
73  public:
74 
75  TTreeIter(TTree *tree);
76  TTreeIter(TChain *tree);
77  TTreeIter(const char *treeName="");
78  virtual ~TTreeIter();
79  TChain *Chain() {return fTree;}
80  TTreeIterCast &operator() (const TString varname);
81  void **Void(const TString varname);
82 #ifndef __CINT__
83  TTreeIterCast &operator() (const char *varname);
84  void **Void(const char *varname);
85 #endif
86  Int_t AddFile(const char *file);
87  TBranch *GetBranch(int idx) const;
88  Int_t Next(Int_t ient=-1);
89  virtual void Print(Option_t* option) const;
90  virtual void ls(Option_t* option) const;
91  void Reset(){fEntry=0;}
92  Bool_t Notify();
93  const char *IsCorrupted() const;
94  static const char* TypeName(Int_t ity);
95  static Int_t TypeSize(Int_t ity);
96  static Int_t TypeCode(const char *typeName);
97  static void Print(const TBranch *tb,Int_t lvl=0, Option_t* option="");
98  static void ls(const TTree *tt, Option_t* option="");
99  static void ls(const TObjArray *brList,Int_t lvl,Option_t* option="");
100  static void GetInfo(const TBranch *tb, const char *&tyName,Int_t &units,void *&add,Int_t &brType);
101 
102 
103  private:
104  void Init();
105  void WhichTree(const char *fileName);
106 
107  ClassDef(TTreeIter,0)
108 };
109 #endif //ROOT_TTreeIter
Int_t fNErr
current number of units
Definition: TTreeIter.h:68
TObjArray fMemList
pointer to TTree/TChain object
Definition: TTreeIter.h:65
Int_t fUnits
list of used branches
Definition: TTreeIter.h:67
TObjArray fBraList
list of mem objects
Definition: TTreeIter.h:66
TChain * fTree
current entry number
Definition: TTreeIter.h:64