[ROOT] TTree Copy from one root-File to anotherone

From: Andreas Walte (walte@subatech.in2p3.fr)
Date: Wed Jul 12 2000 - 11:16:05 MEST


Hi,

I got a problem copying one TTree from one root-File to another
root-File. My macro for that looks as follows :

" #include "TTree.h"
#include "TFile.h"
void test()
{
gROOT->Reset();
TFile * myfile = new TFile("$GD/data/galice.root");
TTree *TreeR4999 = (TTree*)myfile->Get("TreeR4999");
TreeR4999->Print();
// the TTree contains data
//TBranch *PHOS5GeV = TreeR4999->GetBranch("PHOS.fE");
TFile *myfile2 = new TFile("$GD/data/galice_histogramme.root","CREATE");

TTree * TreeR5GeV = new TTree(*TreeR4999);
TreeR5GeV->Print();
// not empty
myfile2->Write();
myfile2->Close();
myfile->Close() ;
  }
"

I did a .L test.C++ and test() , with test.C the name of the macro. So
everything looked fine but when I try to browse the new file with
TBrowser the file is completely empty.

Regards,
    Andreas



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:29 MET