00001
00002
00003
00004 #ifndef ROOT_TTreeIter
00005 #define ROOT_TTreeIter
00006
00007
00009
00010
00011
00012
00014
00015 #include "TTree.h"
00016 #include "TString.h"
00017 class TChain;
00018 class TTreeIterMem;
00019 class TTreeIterCast
00020 {
00021 public:
00022 TTreeIterCast(Int_t *nerr){fV=0;fN=0;fT=0;fE=nerr;}
00023 ~TTreeIterCast(){;}
00024 void Set(void* v,Int_t t,const char* name=0);
00025
00026 operator const Char_t &();
00027 operator const Short_t &();
00028 operator const Int_t &();
00029 operator const Long_t &();
00030 operator const Float_t &();
00031 operator const Double_t &();
00032
00033 operator const UChar_t &();
00034 operator const UShort_t &();
00035 operator const UInt_t &();
00036 operator const ULong_t &();
00037
00038 operator const Char_t* &();
00039 operator const Short_t* &();
00040 operator const Int_t* &();
00041 operator const Long_t* &();
00042 operator const Float_t* &();
00043 operator const Double_t* &();
00044 operator const UChar_t* &();
00045 operator const UShort_t* &();
00046 operator const UInt_t* &();
00047 operator const ULong_t* &();
00048 void *Addr(){return fV;}
00049
00050 private:
00051 void *Addr(Int_t outType);
00052 void *fV;
00053 Int_t fT;
00054 Int_t *fE;
00055 const char *fN;
00056 };
00057
00058
00059 class TTreeIter : public TNamed{
00060
00061 protected:
00062 Int_t fEntry;
00063 TChain *fTree;
00064 TObjArray fMemList;
00065 TObjArray fBraList;
00066 Int_t fUnits;
00067 Int_t fNErr;
00068 Int_t fCint;
00069 Int_t fNFiles;
00070
00071 TTreeIterCast fCast;
00072 public:
00073
00074 TTreeIter(TTree *tree);
00075 TTreeIter(const char *treeName="");
00076 virtual ~TTreeIter();
00077 TChain *Chain() {return fTree;}
00078 TTreeIterCast &operator() (const TString varname);
00079 void **Void(const TString varname);
00080 #ifndef __CINT__
00081 TTreeIterCast &operator() (const char *varname);
00082 void **Void(const char *varname);
00083 #endif
00084 Int_t AddFile(const char *file);
00085 TBranch *GetBranch(int idx) const;
00086 Int_t Next(Int_t ient=-1);
00087 virtual void Print(Option_t* option) const;
00088 virtual void ls(Option_t* option) const;
00089 void Reset(){fEntry=0;}
00090 Bool_t Notify();
00091 const char *IsCorrupted() const;
00092 static const char* TypeName(Int_t ity);
00093 static Int_t TypeSize(Int_t ity);
00094 static Int_t TypeCode(const char *typeName);
00095 static void Print(const TBranch *tb,Int_t lvl=0, Option_t* option="");
00096 static void ls(const TTree *tt, Option_t* option="");
00097 static void ls(const TObjArray *brList,Int_t lvl,Option_t* option="");
00098 static void GetInfo(const TBranch *tb, const char *&tyName,Int_t &units,void *&add,Int_t &brType);
00099
00100
00101 private:
00102 void Init();
00103 void WhichTree(const char *fileName);
00104
00105 ClassDef(TTreeIter,0)
00106 };
00107 #endif //ROOT_TTreeIter