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
Exaos Lee wrote:
>
> Dear rooter,
> How to move objects to a directory within the same root file?
> For example, I have one root file contains the following objects:
> TFile** n2n_0717_01.root
> TFile* n2n_0717_01.root
> KEY: TChain kmax_event;3
> KEY: TH1F ph0;1 PH spectrum of Detector 0
> KEY: TH1F ph2;1 PH spectrum of Detector 2
> ... ...
> KEY: TH1F psd2;3 PSD spectrum of Detector 2
> KEY: TCutG gcutm;1 Graph
> KEY: TH1F phm;3 PH Spectrum of Monitor
> KEY: TH1F psdm;1 PSD Spectrm of Monitor
> KEY: TH2F phm_psdm;1 PH-PSD Spectrum of Monitor
> Then I make a directory named "monitor":
> ... ...
> TDirectory* monitor Spectra of Monitor
> I want to move the "phm", "psdm", "phm_psdm" and "tofm" to directory
> "monitor". How to do that? The TFile class hasn't any method such as
> TFile::mv(char*,char*).
>
> Regards.
>
> Exaos
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET