Hi Mark, When you do something like: TFile f("afile.root","recreate"); TTree *T = new TTree("T","example"); T->Branch(... T is automatically associated to the current directory (here f). When filling the Tree, you do not have to cd to the corresponding directory. This will be automatically done by TTree::Fill and the actual current directory restored. For more details, see the chapter about Object Ownership in the Users Guide. Rene Brun On Thu, 12 Jun 2003 mark.winkler@philips.com wrote: > Hello Rooters, > > Could someone spell out the relationship between TFile and TTree classes? > My motivation in asking is a desire to read from an existing tree, process > some data, write results to a separate (previously non-existent) tree, and > then go back to reading from tree 1 in order to repeat -- thus several > trees would be open at the same time -- all of which "belong" to different > files. > > I am a little unclear how a tree gets "linked" to a given file. Reading > seems fairly intuitive: open a file, then "Get" part of that file with > the name of the tree. However, writing seems like a bit of a mystery to > me: declare a file, and then the first tree declared after it is "its" > tree? > > I know the forum desires specific problems with code/etc.-- my apologies > in advance to any offended! > > Thanks! > Mark > >
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET