Re: [ROOT] TFile::mv(obj1,"dir/obj2")?

From: Exaos Lee (schlie@iris.ciae.ac.cn)
Date: Mon Jul 21 2003 - 07:47:35 MEST


Thank you, Rene.
Why not add such a method "mv(,)" to TFile? Just like the unix command 
"mv", we can use such a method to rename, move any TKey within a ROOT file.

Regards.

Exaos

Rene Brun ??:
> Hi Exaos,
> 
> We do not have a TDirectory::mv function.
> In your case you can emulate it in the following way.
> For each histogram that you want to move, eg "phm", to
>   file->cd()
>   TH1 *h = (TH1*)file->Get("phm"); //get phm in memory
>   file->Delete("phm;1");           //delete the disk copy
>   monitor->cd();
>   h->SetDirectory(monitor);
>   h->Write();                      //write to monitor
> 
> Rene Brun



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET