Hi Stephen, In version 3.01, we have introduced TTree friends. This is the solution to your problem. Tree friendship is more elegant, safer, faster than modifying a Tree in place and it also provides more functions. See the documentation at: http://root.cern.ch/root/htmldoc/TTree.html#TTree:AddFriend Rene Brun On Fri, 18 May 2001, Stephen Bailey wrote: > > Hi. > > Is there a way to modify entries in an existing TTree, or add > new branches to an already filled TTree without having to clone > the whole thing? If so, great; please let me know how. If not, > please read on. > > Several times recently I have found myself wanting to modify > an existing TTree, either by changing elements in a current > branch or by adding a new branch. From the roottalk discussions > last February (search for "TTree modification"), it appears > that this is technically feasible but opposed by some people, largely > on the basis of "you shouldn't program that way". For many > applications, I agree. But if it is possible to allow TTree > modification, it seems that it should at least be an option which > someone can use at their discretion based upon their application. > I would suggest putting a modification option in the TTree > constructor so that the person who initially creates the TTree > decides whether s/he wants to allow future users/modules/etc. > to be able to modify it. A default option of unmodifiable would > probably be best. But at least having the option to make a > modifiable TTree would be nice. If it would be technically quite > difficult to make modifiable TTrees, then alas, I will have to > live with cloning them... > > Thanks. > > Stephen > >
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:45 MET