ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TFriendElement.h
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Rene Brun 07/04/2001
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 #ifndef ROOT_TFriendElement
12 #define ROOT_TFriendElement
13 
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TFriendElement //
18 // //
19 // A TFriendElement TF describes a TTree object TF in a file. //
20 // When a TFriendElement TF is added to the the list of friends of an //
21 // existing TTree T, any variable from TF can be referenced in a query //
22 // to T. //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 
27 #ifndef ROOT_TNamed
28 #include "TNamed.h"
29 #endif
30 
31 class TFile;
32 class TTree;
33 class TClass;
34 
35 class TFriendElement : public TNamed {
36 
37 protected:
38  TTree *fParentTree; //!pointer to the parent TTree
39  TTree *fTree; //!pointer to the TTree described by this element
40  TFile *fFile; //!pointer to the file containing the friend TTree
41  TString fTreeName; // name of the friend TTree
42  Bool_t fOwnFile; // true if file is managed by this class
43 
46 
47  friend void TFriendElement__SetTree(TTree *tree, TList *frlist);
48 
49 public:
50  enum { kFromChain = BIT(11) };
52  TFriendElement(TTree *tree, const char *treename, const char *filename);
53  TFriendElement(TTree *tree, const char *treename, TFile *file);
54  TFriendElement(TTree *tree, TTree* friendtree, const char *alias);
55  virtual ~TFriendElement();
56  virtual TTree *Connect();
57  virtual TTree *DisConnect();
58  virtual TFile *GetFile();
59  virtual TTree *GetParentTree() const {return fParentTree;}
60  virtual TTree *GetTree();
61  virtual const char *GetTreeName() const {return fTreeName.Data();}
62  virtual void ls(Option_t *option="") const;
63 
64  ClassDef(TFriendElement,2) //A friend element of another TTree
65 };
66 
67 #endif
68 
TTree * fParentTree
TTree * fTree
pointer to the parent TTree
virtual TTree * GetTree()
Return pointer to friend TTree.
const char Option_t
Definition: RtypesCore.h:62
friend void TFriendElement__SetTree(TTree *tree, TList *frlist)
Set the fTree member for all friend elements.
Definition: TTree.cxx:8546
#define BIT(n)
Definition: Rtypes.h:120
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
static const char * filename()
Basic string class.
Definition: TString.h:137
bool Bool_t
Definition: RtypesCore.h:59
const char * Data() const
Definition: TString.h:349
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual const char * GetTreeName() const
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
TString fTreeName
pointer to the file containing the friend TTree
virtual TTree * GetParentTree() const
virtual TTree * Connect()
Connect file and return TTree.
A doubly linked list.
Definition: TList.h:47
TFriendElement & operator=(const TFriendElement &)
Equal operator.
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
tuple tree
Definition: tree.py:24
tuple file
Definition: fildir.py:20
virtual ~TFriendElement()
Destructor. Disconnect from the owning tree if needed.
TFile * fFile
pointer to the TTree described by this element
virtual TTree * DisConnect()
DisConnect file and TTree.
virtual void ls(Option_t *option="") const
List this friend element.
virtual TFile * GetFile()
Return pointer to TFile containing this friend TTree.
A TFriendElement TF describes a TTree object TF in a file.
A TTree object has a header with a name and a title.
Definition: TTree.h:98