Hi Thomas,
I am afraid that you do not provide enough details on your procedure.
Anyhow, let me make a guess!
It is my impression that you do the following:
- file->cd();
- create some histograms (say TH1 *h1, *h2, etc)
- create some graphs (say TGraph *gr1, *gr2, etc)
- file->Write()
At this point, the file will contain all your histograms, but not the graphs.
The reason is that objects like TH1 and TTrees are automatically added to a list
of objects associated with the current directory. file->Write() will then write
all these objects to the file.
To save the TGraph objects to the file, you must have an explicit gr->Write()
for each graph. Note that, by default, TGraph are unnamed objects.
In the above example with gr1 and gr2, you can do:
- gr1->SetName("gr1"); gr1->Write();
gr2->SetName("gr2"); gr2->Write();
or
- gr1->Write("gr1");
gr2->Write("gr2");
Rene Brun
Thomas Feser wrote:
>
> Hi all,
>
> I'm generating a rootfile containing several histograms (in root-batch
> mode), which works fine. I simply generate them after a "file->cd();"
> command, after which I'm able to read them from the file again.
> However, the same does not work with TGraph objects. Do I have to give a
> ->Draw() command first? I don't really have an idea.
> _
> |om
>
> ------------------------------------------------------------------------
> - Thomas Feser -
> - -
> - Institut fuer Physik phone: +49-6131-39-25165 -
> - ETAP/AMANDA fax: +49-6131-39-25169 -
> - Staudingerweg 7 / 04-426 -
> - D-55099 Universitaet Mainz -
> - -
> - Thomas.Feser@uni-mainz.de -
> - http://iphcip1.physik.uni-mainz.de/~tfeser -
> ------------------------------------------------------------------------
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET