[ROOT] Equivalent of TFile::Get to get a TDirectory pointer

From: Pierre-Luc Drouin (pldrouin@physics.carleton.ca)
Date: Sat May 31 2003 - 19:00:42 MEST


Hello,

I've a class that holds a TDirectory pointer but that ignores if the
directory structure of the TDirectory instance is entirely loaded in
memory or not (the instance can be a TFile instance).

In a member function of this class, I want to get a pointer to a
subdirectory of the TDirectory instance. Suppose this
subdirectory is
called "MySubDir". I want to get a pointer to "MySubDir" and we
don't know if "MySubDir" is in memory or not. I wanted to use
TDirectory::Get(), but the ROOT reference guide says that we must not use
TDirectory::Get() when the namecycle is a TDirectory namecycle.

So what should I do? Should I cd() to "MySubDir" to load it in memory in
the case it was not and use after FindObject("MySubDir") from the parent
directory to get the pointer?

I've noticed that FindObjectAny("MySubDir") loads "MySubDir" in memory and
returns a pointer to the instance. However, I don't want to look for
"MySubDir" in the subdirectories.

Is there a nicer way to do what I want?

Thank you

Pierre-Luc Drouin



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET