Re: [ROOT] Writing a TF2

From: Otto.Schaile@Physik.uni-muenchen.de
Date: Thu Jul 19 2001 - 14:14:10 MEST


On Thu, 19 Jul 2001, Jan Olzem wrote:

> I would like to write a TF2 to a root file, but the Write() method uses to
> fail. However, from a former root talk message I know how to save the TF2
> histograms, but is there any possibility to stream the TF2 object itself
> to a file?

Hi Jan,
writing TF2 works( what are your error messages?):
take this little macro:
{
   TF2 *f2 = new TF2("f2","x**2 + y**2 - x**3 -8*x*y**4",-1,1.2,-1.5,1.5);
   TFile outf("test_tf2.root","RECREATE");
   f2->Write();
   outf.Close();
   delete f2;
//  now read it back
   TFile outf("test_tf2.root");
   outf.ls();
   f2 = (TF2*)outf->Get("f2");
   f2->Draw("lego");
}
Cheers
Otto

Otto Schaile            Sektion Physik, LMU Muenchen
Phone: +49 89 289 14070     Am Coulombwall 1, D-85748 Garching, Germany
GSM:   +49 160 1553598
FAX:   +49 89 289 14072     EMail: Otto.Schaile@Physik.Uni-Muenchen.DE



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:52 MET