Axel, In the development version coming very soon, I have added a few essential comments in the header of TTree::CloneTree. These comments are also valid for your version. Please try and let me know: TTree *TTree::CloneTree(Int_t nevents) { // Create a clone of this tree and copy nevents // By default copy all events // // IMPORTANT: Before invoking this function, the branch addresses // of this TTree must have been set. // For examples of CloneTree, see tutorials // -copytree: // Example of Root macro to copy a subset of a Tree to a new Tree // The input file has been generated by the program in $ROOTSYS/test/Event // with Event 1000 1 1 1 // -copytree2: // Example of Root macro to copy a subset of a Tree to a new Tree // One branch of the new Tree is written to a separate file // The input file has been generated by the program in $ROOTSYS/test/Event // with Event 1000 1 1 1 Rene Brun On Wed, 26 Aug 1998, Axel Schwank wrote: > Dear ROOT developers, > I wanted to provide you with an example Tree to show problmes in the limit > estimation of TTree::Draw(). Therefore, I wanted to copy the Tree, but > only some branches of it. But I wasn't even able to clone the Tree. > I did > > TFile *f = new TFile("SomeFile.root"); // contains a Tree named "T" > TTree *T = (TTree*)f->Get("T"); > TTree *T2 = new TTree("T2","Limit estimation test"); > T2 = T->CloneTree(); > > **** Break **** Segmentation fault ****** > > Is this correct in principle? > I tried with and without loading my shared lib. > > Well, anyway, how do I best copy only selected Branches of a Tree? > I thought > 1) Connecting a file and retrieving the Tree > 2) control the active brances with TTree::SetBranchStatus() > 3) clone the Tree to another one > > Does TTree::Clone() respect the list of active branches? > > I could provide you with the full Tree, but the size is 34MB. > But if I made no error in the above commands, it looks like that's the > only way. Then you could also have a look why the Tree doesn't want to be > cloned. > > Thank you in advance, > Axel > > ******************************** > > Axel Schwank > > DESY H1-F22 > Notkestrasse 85 > D-22607 Hamburg > > Rm. 1b/269 > Tel (+49 40) 8998-3560 > Fax (+49 40) 8998-4385 > > e-mail schwank@mail.desy.de > Quix 0165-6-2705109 > > ******************************** > >
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:37 MET