[ROOT] TGraph to file

From: Dimitris Sideris (d.sideris@ic.ac.uk)
Date: Fri May 24 2002 - 14:44:55 MEST


Hi,

when I try to save all root objects to a file, any TGraphs I have created do not appear in the list (see below). I also don't understand how root represents TGraphs internally, e.g. a histogram has a unique name in a string. This name appears as the object identifyer when you ls() a file. How would a tgraph appear?

Dimitris

void SaveAll()
{

// TObject * obj;

// TIter *AllClassesList = new TIter(root.GetListOfClasses());
 CString cstr;

  TList *AllClassesList = gDirectory->GetList();
  
 TObject *obj;
 TH1F *h;

 int k=0;

  printf("listing objects...\n");

 TIter next(AllClassesList);

 int size=AllClassesList->GetSize();
 int i=0;

 while((obj = (TObject*) next())) 
 {
  i++;
//   if (obj->InheritsFrom("TH1") || obj->InheritsFrom("TH2") || obj->InheritsFrom("TTree"))
//   {
    printf("Writing %s (%s)...\n",obj->GetName(), obj->GetTitle());
    obj->Write();
//   }


 
 }
 gDirectory->DeleteAll();
//

}



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:53 MET