First comment: In my installation I found loopdir.C at $ROOTSYS/tutorials/loopdir.C
I am using 5.13/02.
Second comment: I have a root file with a subdirectory which has many histograms which can be seen in TBrowser. I find that when I use the keys method I only get the key for the subdirectory. The keys to the histograms are never returned. It would seem that I need to set my directory to the subdirectory and then fetch the keys. I tried this with this code:
Key 1
Classname TDirectory
Title classic_t0_fitter
However, there are 100’s of histrograms in the “classic_t0_fitter” subdirectory which I am not getting the keys for. What do I need to do differently to get them?
I thought that the GetListofKeys() would retrieve the keys of the subdirectory. However, I only get the list of keys in the highest directory level of the file, which in my case is just one subdirectory.
[code]{
TFile *f = new TFile(“test.root”);
TFileIter readObj(f);
// the number of the object available directly from “MyDataSet.root"
Int_t size = readObj.TotalKeys();
printf(” The total number of the objects: %d\n",size);
//------------------------------------------------------
// Loop over all objects, read them in to memory one by one
printf(" – > Loop over all objects < – \n");
// Attention: ROOTForum corrupted the following C++ “for” statement !!!
// See the link above for the correct text !!!
for( readObj = 0; int(readObj) GetName()
,nextObject->IsA()->GetName()
,(const char *)readObj
);
delete nextObject;
}[/code]
Two remarks
-That is not what the user wants. He needs to navigate in sub-directories too.
-when posting code as you do, check the button “Disable html in post”
[quote=“brun”]Two remarks
-That is not what the user wants. He needs to navigate in sub-directories too.[/quote]OO Yes I have to fix this immidiately . My solution was narrowed by local needs
[quote=“brun”]-when posting code as you do, check the button “Disable html in post”[/quote]Thank you Rene, May be this should be default. I believe (I do know) many people have had the same problem and none thought it can be fixed and even worth to complain.