[ROOT] how to copy a subdir of a root file to another

From: Meiwen (Wen.Mei@lnf.infn.it)
Date: Thu May 29 2003 - 10:13:30 MEST


Dear rooters,
         I want to copy some sub directories from different root files in one root file. But I got always the  " *****break segment violation*****". Maybe I did it in a wrong way. Could you please give me a hand?
The system is AIX4.3.3, the root version is v3.01-6 and the code is as following:
 
 TFile f(calmonbha_in);
  TTree *oldtree = (TTree*) f.Get("h10005");
    TFile *fout = new TFile(current_out, "recreate");
    //TTree *newtree = oldtree->CloneTree(); neither Clone tree works
   TTree *newtree = oldtree->CopyTree("h10005");
    newtree->Write();
    fout->Write();

Here in the code I got one histogram only for test. I need to copy whole directory named "GENERAL;1". "h10005" is only one of the histograms inside the directory. I have also attempted to use TDirectory::Get() but fail too.

Best                                                     Wen Mei 



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