Hi Ivan, Do: TFile *flMC_file = new TFile("mc.root"); TFile* file = TFile::Open("data.root", "RECREATE"); // my output file TH1D* h1dMC_NN = (TH1D*)flMC_file->Get("h1dNN"); .... flMC_file->GetList()Write(); //write in memory objects of 1st file to the current file Rene Brun Ivan Glushkov wrote: > > Hello, > > So, what I want to do is to take some histogram, saved in a root file, > and use it in my program, and save it in the new output file from my > program. Looks easy. Here is my code: > > int main(int argc, char* argv[]) > { > TFile *flMC_file = new TFile("mc.root"); //the file in which I already > have my histogram (h1dNN) stored > TFile* file = TFile::Open("data.root", "RECREATE"); // my output file > TH1D* h1dMC_NN = (TH1D*)flMC_file->Get("h1dNN"); > .... > file->Write(); > file->Close(); > > And the histogram is not in the file (but all other histograms created > later are there) > > Do you have an idea what is the problem? > > Cheers, Ivan
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET