00001 // @(#)root/tree:$Id: TFriendElement.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Rene Brun 07/04/2001 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 #ifndef ROOT_TFriendElement 00012 #define ROOT_TFriendElement 00013 00014 00015 ////////////////////////////////////////////////////////////////////////// 00016 // // 00017 // TFriendElement // 00018 // // 00019 // A TFriendElement TF describes a TTree object TF in a file. // 00020 // When a TFriendElement TF is added to the the list of friends of an // 00021 // existing TTree T, any variable from TF can be referenced in a query // 00022 // to T. // 00023 // // 00024 ////////////////////////////////////////////////////////////////////////// 00025 00026 00027 #ifndef ROOT_TNamed 00028 #include "TNamed.h" 00029 #endif 00030 00031 class TFile; 00032 class TTree; 00033 class TClass; 00034 00035 class TFriendElement : public TNamed { 00036 00037 protected: 00038 TTree *fParentTree; //!pointer to the parent TTree 00039 TTree *fTree; //!pointer to the TTree described by this element 00040 TFile *fFile; //!pointer to the file containing the friend TTree 00041 TString fTreeName; // name of the friend TTree 00042 Bool_t fOwnFile; // true if file is managed by this class 00043 00044 TFriendElement(const TFriendElement&); 00045 TFriendElement& operator=(const TFriendElement&); 00046 00047 public: 00048 enum { kFromChain = BIT(11) }; 00049 TFriendElement(); 00050 TFriendElement(TTree *tree, const char *treename, const char *filename); 00051 TFriendElement(TTree *tree, const char *treename, TFile *file); 00052 TFriendElement(TTree *tree, TTree* friendtree, const char *alias); 00053 virtual ~TFriendElement(); 00054 virtual TTree *Connect(); 00055 virtual TTree *DisConnect(); 00056 virtual TFile *GetFile(); 00057 virtual TTree *GetParentTree() const {return fParentTree;} 00058 virtual TTree *GetTree(); 00059 virtual const char *GetTreeName() const {return fTreeName.Data();} 00060 virtual void ls(Option_t *option="") const; 00061 00062 ClassDef(TFriendElement,2) //A friend element of another TTree 00063 }; 00064 00065 #endif 00066