When I am trying to copy a file to a different file, I end up getting an error that looks like this :
Error in <TFile::ReadBuffer>: error reading all requested bytes from file newFile.root, got 0 of 28863
Error in <TFile::ReadBuffer>: error reading all requested bytes from file newFile.root, got 0 of 28863
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
My attempt at copying a tree to a different file
TFile *if = new TFile("somefile.root");
TTree *tr = (TTree*)inf->Get("QCDAna/tree2");
TFile *of = new TFile("newFile.root", "recreate");
of->cd();
tr->Write("blah");
of->Close();
if->Close();