How to replace a small subset of data in a rootfile?

Hi

I have a root-file containing about 20 trees, and each tree consists of two branches with some branchelements in. Something like this

Tree1 — Branch1
— Branch2 – branchelement1
– branchelement2
Tree2 —
and so on.

I would like to change the data in branchelement1 in each tree, and my question is how this could be done in the best way? Should i rewrite the entire file to a new one, and then in the process updating the data in branchelement1? Or can I do it smarter, and retrieve that data and replace it somehow?

thanks

[quote]Should i rewrite the entire file to a new one, and then in the process updating the data in branchelement1?[/quote]This is an option (see copytree.C, copytree2.C and copytree3.C for some example and how to do so easily.
Alternatively you can create new tree with just the new information and use them in conjunction with the original trees by making them friend of one another (see TTree::AddFriend).

Cheers,
Philippe