Re: Storing graph objects into a file

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Fri, 10 Oct 2008 09:52:36 -0500


Hi Anil,

Use

    gr2->Write();
Namely:

{
TFile f("graph.root","recreate");
float flux[7]={1.06e6,2.97e5,1.36e5,4.11e4,2.29e4,7.56e3,5.22e3}; float flux_err[7] = {0.92e2, 0.31e3, 0.64e3, 3.33e3, 0.36e3, 0.84e3, 0.28e1}; float rad[7]={4.1, 7.2, 11.1, 23.4, 34.5, 61, 108}; float rad_err[7]={0,0,0,0,0,0,0};
TGraph *gr2 = new TGraphErrors(7,rad, flux,rad_err,flux_err); gr2->Draw("A*");
f.cd();
gr2->Write();
f.Write();
f.Close();
}

Anil Singh wrote:
> Hi,
> I want to create a TGraphError object and then save it in file "graph.root" . Iam trying to do as follows(but no luck):
> ==================
>
> {
> TFile f("graph.root","recreate");
> float flux[7]={1.06e6,2.97e5,1.36e5,4.11e4,2.29e4,7.56e3,5.22e3};
> float flux_err[7] = {0.92e2, 0.31e3, 0.64e3, 3.33e3, 0.36e3, 0.84e3, 0.28e1};
> float rad[7]={4.1, 7.2, 11.1, 23.4, 34.5, 61, 108};
> float rad_err[7]={0,0,0,0,0,0,0};
> TGraph *gr2 = new TGraphErrors(7,rad, flux,rad_err,flux_err);
> gr2->Draw("A*");
> f.cd();
> f.Write();
> f.Close();
> }
> ======================
> Any help would be appreciated
> Anil
>
>
Received on Fri Oct 10 2008 - 16:52:50 CEST

This archive was generated by hypermail 2.2.0 : Fri Oct 10 2008 - 23:50:02 CEST