On Sat, 28 Oct 2000, Stephen Bailey wrote: Hi Stephen, you have to Append the object to gROOT, gROOT->Append(f2); be careful: before deleting it you should remove it first, by gROOT->GetList()->Remove(f2); delete f2; Cheers Otto > > Hi Rooters. > > Is there a way to get a pointer to an object whose name > was set with TNamed::SetName()? I was expecting to be > able to use TROOT::FindObject() but that apparently doesn't > work. e.g. > > root [0] TF1* f1 = new TF1("f1", "gaus(0)/25.07/[2]", -5, 5); > root [1] TF1* f2 = (TF1*) f1->Clone(); > root [2] f2->SetName("f2"); gROOT->Append(f2); > root [3] f1->GetName() > (const char* 0x86c1fcc)"f1" > root [4] gROOT->FindObject("f1") > (const class TObject*)0x86c1ed8 > root [5] f2->GetName() > (const char* 0x86ec094)"f2" > root [6] gROOT->FindObject("f2") > (const class TObject*)0x0 > > Thanks. > > Stephen > > Otto Schaile Sektion Physik, LMU Muenchen Phone: +49 89 289 14070 Am Coulombwall 1, D-85748 Garching, Germany GSM: +49 171 4312031 FAX: +49 89 289 14072 EMail: Otto.Schaile@Physik.Uni-Muenchen.DE
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET