[ROOT] writing a TGraph to a file

From: Olav Franzen (frano006@mail.uni-mainz.de)
Date: Mon Sep 10 2001 - 20:11:33 MEST


Dear friends,

  why does the following simple program not work?

{

Float_t x[5] = {1, 2, 3, 4, 5};
Float_t y[5] = {3, 3, 3, 3 ,3};
Float_t ex[5] = {1, 1, 1, 1, 1};
Float_t ey[5] = {1, 1, 1, 1 ,1};

TFile f("test.root",  "RECREATE");
TGraph *g = new TGraphErrors(5, x, y, ex, ey);
g->Draw("AP");
g->SetName("hello");
g->Write();
f.Close();

}

When opening the generated test.root file and starting a TBrowser, one
obtains:


root [1] TBrowser b;
root [2] Error in <TBuffer::CheckByteCount>: object of class
TGraphErrors read too few bytes
Warning in <TBuffer::CheckByteCount>: TGraphErrors::Streamer() not in
sync with data on file, fix Streamer()
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1

 *** Break *** segmentation violation
Root >
 *** Break *** segmentation violation
Root >


 Thanks for your patience,

  Olav


PS: I'm using ROOT version 3.00.05 on linux-pc



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