Re: [ROOT] how to copy a histogram from 1 root file to another?

From: Roland Kuhn (rkuhn@e18.physik.tu-muenchen.de)
Date: Wed Oct 20 2004 - 16:51:49 MEST


Hi Ivan!

On Oct 20, 2004, at 3:51 PM, 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");

h1dMC_NN->Write();

> ....
> 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
>
>

Ciao,
					Roland

--
TU Muenchen, Physik-Department E18, James-Franck-Str. 85747 Garching
Telefon 089/289-12592; Telefax 089/289-12570
--
A mouse is a device used to point at
the xterm you want to type in.
Kim Alm on a.s.r.





This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET