To see the list of objects (with name and title) in the current directory, do: gDirectory->ls() this iterates on the list of Tkeys and for each TKey shows the name and title. Rene Brun On Wed, 30 Jun 2004 WLavrijsen@lbl.gov wrote: > Topher, > > > How do I gracefully check for a null TObject pointer in pyroot? > > Use a boolean predicate, or if you want to turn it into a boolean value, use > the 'not not' trick. That is, from your example: > > >>> this = tdir.Get("h400") > >>> print not not this > 1 > >>> that = tdir.Get("h401") > >>> print not not that > 0 > >>> if that: > ... that.GetName() > ... > >>> # <- nothing, as 'that' evaluates to False > > The assertion will be removed. You are quite right that an exception would > be far more appropriate. But that'll be for a later release. > > > How can I get the name (and title) of an object in a file without reading > > the whole thing into memory? > > Isn't that a general ROOT question? I'll have a look into it later, but I need > to warn you that I know next to nothing of using ROOT, so I may not find an > answer. > > HTH, > Wim >
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET