Hello,
I am trying to do the following, but can't seem to figure it out. I have two files (file1 and file2) and each has a tree of the same name ("results"). I would like to make a new file (file3) which has two trees in it, each with different names, but which are just copies of the trees in file1 and file2. Essentially I want to merge file1 and file2 into a new file with two trees. Here's what I tried:
TFile* outputFile = TFile::Open("allData.root", "RECREATE" ); TFile* inputFile1 = TFile::Open("file1.root","READ"); TTree *t1 = (TTree*)inputFile1->Get("results"); TFile* inputFile2 = TFile::Open("file2.root","READ"); TTree *t2 = (TTree*)inputFile2->Get("results"); outputFile->WriteObject(t1,"newTreeName1"); outputFile->WriteObject(t2,"newTreeName2");
When I do this and look at the output file in a TBrowser it appears to
have worked, however when I then try to draw any of the variables in
either tree I get errors like these:
Error in <TFile::ReadBuffer>: error reading all requested bytes from
file allData.root, got 0 of 10716
Can anyone explain the proper way to merge these trees into one file? Thanks,
-Dan Received on Fri May 20 2011 - 04:04:21 CEST
This archive was generated by hypermail 2.2.0 : Sat May 21 2011 - 17:50:01 CEST