{ // run this script FIRST in gdk version 3.05/7 on win2k TFile *f = new TFile("test30505.root"); TH1F *ph = (TH1F *)f->Get("ph"); ph->Draw(); // no problem here! // // Now, create a new TF1 attached to a new TH1 // TH1F *ph1 = new TH1F("ph1","test1",100,-5.,5.); ph1->FillRandom("gaus",100000); ph1->Fit("gaus"); TFile *f1 = new TFile("test.root","recreate"); ph1->SetDirectory(f1); ph1->Write(); f1->Close(); gApplication->Terminate(); }