OK, I have looked at the actual code of TDirectory, and I see the
default behavior is to specifically look for the "/" character and
interpret that as a directory. There is no way to override the default
behavior, at least in my version of ROOT. This is also the case for the
GetObject* methods.
May I suggest that there should be a way to override this behavior? Surely there are cases where people in HEP would like a histogram called "data/theory" or "xsec_630/1800" for instance. Perhaps a GetStrictName(name) method could be included that does not include the "/" interpretation as a directory, or a SetAutoDirectorySearch(false) method.
Dr. John Krane wrote:
> Hi Rooters,
>
> I have a funny histogram name, resulting from a funny stock ticker.
> The ticker, like IBM, DELL, INTC, etc., has a special character in
> it. The ticker name is "BF/B". So I have histogram names like
> "BF/B_price" that I need to retrieve from file.
>
> I have no trouble creating histograms named "BF/B_price", and I have
> no trouble using the method:
>
> mydir->FindObjectAny("BF/B");
>
> BUT...now I have having the same problem with my code that I first
> complained about here:
>
> http://root.cern.ch/root/roottalk/roottalk06/0740.html
>
> ...for some reason the FindObjectAny method is failing for me, whereas
> the code had *usually* worked in the past. Indeed, the same code
> snippets work in other executables, but not in the one I'm trying to
> use today. (Sigh.)
>
> So I went with the fix described in the link above: use the Get method
> instead of the FindObjectAny method. This works great for all my
> histograms except the special one. I get:
>
> TH1D *t=gDirectory->Get("BF/B_price"); Error in
> <TFile::cd>: Unknown directory BF
>
> So, I am looking for a way to Get this histogram. Is there a wildcard
> or escape character I can use to avoid the interpretation of this
> symbol as a directory? Any other ideas?
>
> - John
>
-- Dr. John Krane http://jkrane.home.comcast.net Quantitative Financial AnalystReceived on Wed Aug 23 2006 - 20:17:18 MEST
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET