No idea what you’re talking about: {
// open a new ROOT file
TFile *f = TFile::Open("MyFile.root", "RECREATE");
// create the graph (in memory)
TGraph *g = new TGraph();
for (Int_t i = 0; i < 100; i++) g->SetPoint(g->GetN(), i*i, i*i*i);
f->cd(); // make sure that we will write to this ROOT file
g->Write("MyGraph"); // save the graph as "MyGraph"
f->ls(); // show the contents of the ROOT file
delete f; // close the ROOT file
g->Draw("A*"); // draw the graph (which is still in memory)
// delete g; // delete the graph (from memory)
}
{
// open the ROOT file with the graph
TFile *f = TFile::Open("MyFile.root", "READ");
f->ls(); // show the contents of the ROOT file
TGraph *g;
f->GetObject("MyGraph", g); // retrieve "MyGraph"
delete f; // close the ROOT file
if (g) g->Draw("A*"); // draw the graph (from memory)
// delete g; // delete the graph (from memory)
}