Hi,
I would like to save (into a TFile) a TCanvas containing a TH1D ...
but ... working in batch!
The second step will be to loop over some histograms and do some fits.
I've tried the simple code below and it seems to work ... but:
- this means that I can simply use a code that works in a non batch
session and add at the top of it gROOT->SetBatch() ? Even if I have to
fit the histos with functions or other histos?
- with this code the canvas is saved but there is also a copy of the
histo ... how can I aviod it?
- is there any example/tutorial about this issue?
Thanks a lot!
void Test()
{
gROOT->SetBatch();
TFile *f = new TFile("Test.root", "RECREATE");
TH1D *h = new TH1D("histo", "Histo", 10, 0., 10.);
h->Fill(5.);
TCanvas *c = new TCanvas("canvas", "Canvas", 0, 0, 400, 400);
f->Add(c); c->cd(); h->Draw(); f->Write();
Bye... Received on Tue Dec 30 2008 - 04:14:18 CET
This archive was generated by hypermail 2.2.0 : Tue Dec 30 2008 - 11:50:02 CET