[ROOT] RE:

From: Valeri Fine (fine@bnl.gov)
Date: Sun Oct 10 2004 - 13:57:37 MEST


Hello pietro

 Next please provide Subj. field otherwise you risk none would have
replied you at all.

What about your question:

I think the piece of the working code below from "simple Qt "ROOT
histogram browser" project,
http://root.bnl.gov/QtRoot/downloads/qtRootProject.tar.gz 
(see: http://root.bnl.gov/QtRoot/QtRoot.html#designer  also) 
does what you want:

   // Open pre-defined ROOT file
   TKey *key = 0;
   fxDiskFile=new TFile("test.root");
   TIter next(fxDiskFile->GetListOfKeys());
   // Fill the "tree view" with the object info from the file
   while((key = (TKey*) next())) {
      AddItemToListView1(key->ReadObj());
   }


The code reads all objects from the ROOT file via TKey::ReadObj method.
No name is required.
 

Hope this helps.
   Valeri
> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]
> On Behalf Of Pietro Govoni
> Sent: Saturday, October 09, 2004 9:04 PM
> To: root mailing list
> Subject:
> 
> Dear ROOTers,
> 
> I saved a lot of histograms in a TFile and I would like to retrieve
them
> all, in an authomatic way, without inserting their name in the code.
> 
> I made a lot of tries, all efforless.
> I've been trying using TFile::GetList, TFile::GetListOfKeys and all
the
> associated code I found.
> 
> Does anybody have a working piece of code that I could fetch?
> 
> Thank you very much
> 
> pietro



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET