00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TTree
00013 #define ROOT_TTree
00014
00015
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00029
00030 #ifndef ROOT_TNamed
00031 #include "TNamed.h"
00032 #endif
00033
00034 #ifndef ROOT_TObjArray
00035 #include "TObjArray.h"
00036 #endif
00037
00038 #ifndef ROOT_TClonesArray
00039 #include "TClonesArray.h"
00040 #endif
00041
00042 #ifndef ROOT_TAttLine
00043 #include "TAttLine.h"
00044 #endif
00045
00046 #ifndef ROOT_TAttFill
00047 #include "TAttFill.h"
00048 #endif
00049
00050 #ifndef ROOT_TAttMarker
00051 #include "TAttMarker.h"
00052 #endif
00053
00054 #ifndef ROOT_TBranch
00055 #include "TBranch.h"
00056 #endif
00057
00058 #ifndef ROOT_TArrayD
00059 #include "TArrayD.h"
00060 #endif
00061
00062 #ifndef ROOT_TArrayI
00063 #include "TArrayI.h"
00064 #endif
00065
00066 #ifndef ROOT_TVirtualTreePlayer
00067 #include "TVirtualTreePlayer.h"
00068 #endif
00069
00070 class TBrowser;
00071 class TFile;
00072 class TDirectory;
00073 class TLeaf;
00074 class TH1;
00075 class TTreeFormula;
00076 class TPolyMarker;
00077 class TEventList;
00078 class TSQLResult;
00079 class TSelector;
00080 class TPrincipal;
00081 class TFriendElement;
00082 class TCut;
00083
00084
00085 class TTree : public TNamed, public TAttLine, public TAttFill, public TAttMarker {
00086
00087 protected:
00088 Double_t fEntries;
00089 Double_t fTotBytes;
00090 Double_t fZipBytes;
00091 Double_t fSavedBytes;
00092 Double_t fWeight;
00093 Int_t fTimerInterval;
00094 Int_t fScanField;
00095 Int_t fUpdate;
00096 Int_t fMaxEntryLoop;
00097 Int_t fMaxVirtualSize;
00098 Int_t fAutoSave;
00099 Int_t fEstimate;
00100 Int_t fChainOffset;
00101 Int_t fReadEntry;
00102 Int_t fTotalBuffers;
00103 Int_t fPacketSize;
00104 Int_t fNfill;
00105 Int_t fDebug;
00106 Int_t fDebugMin;
00107 Int_t fDebugMax;
00108 Int_t fMakeClass;
00109 Int_t fFileNumber;
00110 TObject *fNotify;
00111 TDirectory *fDirectory;
00112 TObjArray fBranches;
00113 TObjArray fLeaves;
00114 TList *fAliases;
00115 TEventList *fEventList;
00116 TArrayD fIndexValues;
00117 TArrayI fIndex;
00118 TList *fFriends;
00119 TVirtualTreePlayer *fPlayer;
00120 static Int_t fgBranchStyle;
00121 static Int_t fgMaxTreeSize;
00122
00123 protected:
00124 const char *GetNameByIndex(TString &varexp, Int_t *index,Int_t colindex) const;
00125 virtual void MakeIndex(TString &varexp, Int_t *index);
00126 virtual TFile *ChangeFile(TFile *file);
00127
00128 public:
00129
00130 enum {
00131 kForceRead = BIT(11)
00132 };
00133
00134 TTree();
00135 TTree(const char *name, const char *title, Int_t splitlevel=99);
00136 virtual ~TTree();
00137
00138 virtual TFriendElement *AddFriend(const char *treename, const char *filename="");
00139 virtual TFriendElement *AddFriend(const char *treename, TFile *file);
00140 virtual TFriendElement *AddFriend(TTree *tree, const char* alias="", Bool_t warn = kFALSE);
00141 virtual void AddTotBytes(Int_t tot) {fTotBytes += tot;}
00142 virtual void AddZipBytes(Int_t zip) {fZipBytes += zip;}
00143 virtual void AutoSave();
00144 virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="");
00145 virtual Int_t Branch(TList *list, Int_t bufsize=32000, Int_t splitlevel=99);
00146 virtual Int_t Branch(const char *folder, Int_t bufsize=32000, Int_t splitlevel=99);
00147 virtual TBranch *Branch(const char *name, void *address, const char *leaflist, Int_t bufsize=32000);
00148 virtual TBranch *Branch(const char *name, void *clonesaddress, Int_t bufsize=32000, Int_t splitlevel=1);
00149 virtual TBranch *Branch(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99);
00150 virtual TBranch *Bronch(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99);
00151 virtual TBranch *BranchOld(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=1);
00152 virtual void Browse(TBrowser *b);
00153 virtual void BuildIndex(const char *majorname, const char *minorname);
00154 TStreamerInfo *BuildStreamerInfo(TClass *cl, void *pointer=0);
00155 virtual TTree *CloneTree(Int_t nentries=-1, Option_t *option="");
00156 virtual void CopyAddresses(TTree *tree);
00157 virtual Int_t CopyEntries(TTree *tree, Int_t nentries=-1);
00158 virtual TTree *CopyTree(const char *selection, Option_t *option=""
00159 ,Int_t nentries=1000000000, Int_t firstentry=0);
00160 Int_t Debug() const {return fDebug;}
00161 virtual void Delete(Option_t *option="");
00162 virtual void Draw(Option_t *opt);
00163 virtual Int_t Draw(const char *varexp, const TCut &selection, Option_t *option=""
00164 ,Int_t nentries=1000000000, Int_t firstentry=0);
00165 virtual Int_t Draw(const char *varexp, const char *selection, Option_t *option=""
00166 ,Int_t nentries=1000000000, Int_t firstentry=0);
00167 virtual void DropBuffers(Int_t nbytes);
00168 virtual Int_t Fill();
00169 virtual TBranch *FindBranch(const char *name);
00170 virtual TLeaf *FindLeaf(const char *name);
00171 virtual Int_t Fit(const char *funcname ,const char *varexp, const char *selection="",Option_t *option="" ,Option_t *goption=""
00172 ,Int_t nentries=1000000000, Int_t firstentry=0);
00173
00174 virtual const char *GetAlias(const char *aliasName) const;
00175 virtual TBranch *GetBranch(const char *name);
00176 virtual Bool_t GetBranchStatus(const char *branchname) const;
00177 static Int_t GetBranchStyle();
00178 virtual Int_t GetChainEntryNumber(Int_t entry) const {return entry;}
00179 virtual Int_t GetChainOffset() const { return fChainOffset; }
00180 TFile *GetCurrentFile() const;
00181 Int_t GetDebugMax() const {return fDebugMax;}
00182 Int_t GetDebugMin() const {return fDebugMin;}
00183 TDirectory *GetDirectory() const {return fDirectory;}
00184 virtual Double_t GetEntries() const {return fEntries;}
00185 virtual Double_t GetEntriesFast() const {return fEntries;}
00186 virtual Double_t GetEntriesFriend() const;
00187 virtual Int_t GetEstimate() const { return fEstimate; }
00188 virtual Int_t GetEntry(Int_t entry=0, Int_t getall=0);
00189 Int_t GetEvent(Int_t entry=0, Int_t getall=0) {return GetEntry(entry,getall);}
00190 virtual Int_t GetEntryWithIndex(Int_t major, Int_t minor);
00191 virtual Int_t GetEntryNumberWithBestIndex(Int_t major, Int_t minor) const;
00192 virtual Int_t GetEntryNumberWithIndex(Int_t major, Int_t minor) const;
00193 TEventList *GetEventList() const {return fEventList;}
00194 virtual Int_t GetEntryNumber(Int_t entry) const;
00195 virtual Int_t GetFileNumber() const {return fFileNumber;}
00196 virtual const char *GetFriendAlias(TTree *) const;
00197 TH1 *GetHistogram() {return GetPlayer()->GetHistogram();}
00198 virtual Int_t *GetIndex() {return &fIndex.fArray[0];}
00199 virtual Double_t *GetIndexValues() {return &fIndexValues.fArray[0];}
00200 virtual TIterator*GetIteratorOnAllLeaves(Bool_t dir = kIterForward);
00201 virtual TLeaf *GetLeaf(const char *name);
00202 virtual TObjArray *GetListOfBranches() {return &fBranches;}
00203 virtual TObjArray *GetListOfLeaves() {return &fLeaves;}
00204 virtual TList *GetListOfFriends() const {return fFriends;}
00205 virtual TSeqCollection *GetListOfAliases() const {return fAliases;}
00206 virtual Int_t GetMakeClass() const {return fMakeClass;}
00207 virtual Int_t GetMaxEntryLoop() const {return fMaxEntryLoop;}
00208 virtual Double_t GetMaximum(const char *columname);
00209 static Int_t GetMaxTreeSize();
00210 virtual Int_t GetMaxVirtualSize() const {return fMaxVirtualSize;}
00211 virtual Double_t GetMinimum(const char *columname);
00212 virtual Int_t GetNbranches() {return fBranches.GetEntriesFast();}
00213 TObject *GetNotify() const {return fNotify;}
00214 TVirtualTreePlayer *GetPlayer();
00215 virtual Int_t GetPacketSize() const {return fPacketSize;}
00216 virtual Int_t GetReadEntry() const {return fReadEntry;}
00217 virtual Int_t GetReadEvent() const {return fReadEntry;}
00218 virtual Int_t GetScanField() const {return fScanField;}
00219 TTreeFormula *GetSelect() {return GetPlayer()->GetSelect();}
00220 virtual Int_t GetSelectedRows() {return GetPlayer()->GetSelectedRows();}
00221 virtual Int_t GetTimerInterval() const {return fTimerInterval;}
00222 virtual Double_t GetTotBytes() const {return fTotBytes;}
00223 virtual TTree *GetTree() const {return (TTree*)this;}
00224 virtual Int_t GetTreeNumber() const {return 0;}
00225 virtual Int_t GetUpdate() const {return fUpdate;}
00226 TTreeFormula *GetVar1() {return GetPlayer()->GetVar1();}
00227 TTreeFormula *GetVar2() {return GetPlayer()->GetVar2();}
00228 TTreeFormula *GetVar3() {return GetPlayer()->GetVar3();}
00229 TTreeFormula *GetVar4() {return GetPlayer()->GetVar4();}
00230 virtual Double_t *GetV1() {return GetPlayer()->GetV1();}
00231 virtual Double_t *GetV2() {return GetPlayer()->GetV2();}
00232 virtual Double_t *GetV3() {return GetPlayer()->GetV3();}
00233 virtual Double_t *GetW() {return GetPlayer()->GetW();}
00234 virtual Double_t GetWeight() const {return fWeight;}
00235 virtual Stat_t GetZipBytes() const {return fZipBytes;}
00236 virtual void IncrementTotalBuffers(Int_t nbytes) {fTotalBuffers += nbytes;}
00237 Bool_t IsFolder() const {return kTRUE;}
00238 virtual Int_t LoadTree(Int_t entry);
00239 virtual Int_t MakeClass(const char *classname=0,Option_t *option="");
00240 virtual Int_t MakeCode(const char *filename=0);
00241 virtual Int_t MakeSelector(const char *selector=0);
00242 Bool_t MemoryFull(Int_t nbytes);
00243 virtual Bool_t Notify();
00244 TPrincipal *Principal(const char *varexp="", const char *selection="", Option_t *option="np"
00245 ,Int_t nentries=1000000000, Int_t firstentry=0);
00246 virtual void Print(Option_t *option="") const;
00247 virtual Int_t Process(const char *filename,Option_t *option="", Int_t nentries=1000000000, Int_t firstentry=0);
00248 virtual Int_t Process(TSelector *selector, Option_t *option="", Int_t nentries=1000000000, Int_t firstentry=0);
00249 virtual Int_t Project(const char *hname, const char *varexp, const char *selection="", Option_t *option=""
00250 ,Int_t nentries=1000000000, Int_t firstentry=0);
00251 virtual TSQLResult *Query(const char *varexp="", const char *selection="", Option_t *option=""
00252 ,Int_t nentries=1000000000, Int_t firstentry=0);
00253 virtual void RemoveFriend(TTree*);
00254 virtual void Reset(Option_t *option="");
00255 virtual Int_t Scan(const char *varexp="", const char *selection="", Option_t *option=""
00256 ,Int_t nentries=1000000000, Int_t firstentry=0);
00257 virtual Bool_t SetAlias(const char *aliasName, const char *aliasFormula);
00258 virtual void SetAutoSave(Int_t autos=10000000) {fAutoSave=autos;}
00259 virtual void SetBasketSize(const char *bname,Int_t buffsize=16000);
00260 virtual void SetBranchAddress(const char *bname,void *add);
00261 virtual void SetBranchStatus(const char *bname,Bool_t status=1);
00262 static void SetBranchStyle(Int_t style=1);
00263 virtual void SetChainOffset(Int_t offset=0) {fChainOffset=offset;}
00264 virtual void SetDebug(Int_t level=1, Int_t min=0, Int_t max=9999999);
00265 virtual void SetDirectory(TDirectory *dir);
00266 virtual void SetEstimate(Int_t nentries=10000);
00267 virtual void SetEventList(TEventList *list) {fEventList = list;}
00268 virtual void SetMakeClass(Int_t make) {fMakeClass = make;}
00269 virtual void SetMaxEntryLoop(Int_t maxev=1000000000) {fMaxEntryLoop = maxev;}
00270 static void SetMaxTreeSize(Int_t maxsize=1900000000);
00271 virtual void SetMaxVirtualSize(Int_t size=0) {fMaxVirtualSize = size;}
00272 virtual void SetName(const char *name);
00273 virtual void SetNotify(TObject *obj) {fNotify = obj;}
00274 virtual void SetObject(const char *name, const char *title);
00275 virtual void SetScanField(Int_t n=50) {fScanField = n;}
00276 virtual void SetTimerInterval(Int_t msec=333) {fTimerInterval=msec;}
00277 virtual void SetWeight(Double_t w=1, Option_t *option="");
00278 virtual void SetUpdate(Int_t freq=0) {fUpdate = freq;}
00279 virtual void Show(Int_t entry=-1);
00280 virtual void StartViewer();
00281 virtual Int_t UnbinnedFit(const char *funcname ,const char *varexp, const char *selection="",Option_t *option=""
00282 ,Int_t nentries=1000000000, Int_t firstentry=0);
00283 void UseCurrentStyle();
00284
00285 ClassDef(TTree,10)
00286 };
00287
00289
00290
00291
00292
00293
00295
00296 class TTreeFriendLeafIter : public TIterator {
00297
00298 protected:
00299 TTree *fTree;
00300 TIterator *fLeafIter;
00301 TIterator *fTreeIter;
00302 Bool_t fDirection;
00303
00304 TTreeFriendLeafIter() : fTree(0), fLeafIter(0), fTreeIter(0),
00305 fDirection(0) {}
00306
00307 public:
00308 TTreeFriendLeafIter(const TTree *t, Bool_t dir = kIterForward);
00309 TTreeFriendLeafIter(const TTreeFriendLeafIter &iter);
00310 ~TTreeFriendLeafIter() { SafeDelete(fLeafIter); SafeDelete(fTreeIter); }
00311 TIterator &operator=(const TIterator &rhs);
00312 TTreeFriendLeafIter &operator=(const TTreeFriendLeafIter &rhs);
00313
00314 const TCollection *GetCollection() const { return 0; }
00315 Option_t *GetOption() const;
00316 TObject *Next();
00317 void Reset() { SafeDelete(fLeafIter); SafeDelete(fTreeIter); }
00318
00319 ClassDef(TTreeFriendLeafIter,0)
00320 };
00321
00322
00323 inline void TTree::Draw(Option_t *opt)
00324 { Draw(opt, "", "", 1000000000, 0); }
00325
00326 #endif