Changing the name of a tree

Is there a command in root to change the name of a tree?

You can change the name of any ROOT object deriving from TNamed (case
of a TTree) via the function SetName
tree.SetName(“newname”);
Note that this will change the name of the Tree for the object in memory.
If you want to change the name for an object stored in a file, do something
like

TFile f("myfile.root","update"); TTree *T = (TTree*)f.Get("oldname"); T->SetName("newname"); T->Write();
Rene