As indicated by Philippe, just do:
TFile f("myfile.root","update");
TTree *T = (TTree*)f.Get("myoldtreename")
T->Write("newname");
Rene Brun
Thomas Bretz wrote:
>
> Hi Philippe,
>
> > It should be possible to just do
> > tree->SetName("newname");
> > file->Write()
> > However the original tree meta-data will still be present on the disk
> > and I am not sure you can safely remove it.
> >
> > An alternative is to create a friend tree.
> > new TTree("newname");
> > tree->AddFriend(oldtree);
> > file->Write();
>
> Thanks. What method would you preffer?
>
> This is my problem: For some automatic reading procedure I need well
> defined tree-names (eg, data tree: Data, corresponding Header-tree:
> DataHeaders) But we have old files which don't follow this convention.
> Now I want to write a small tool which 'converts' the old files such
> that they fit the new scheme...
>
> Thomas.
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET