Re: want to mydir->Get("BF/B")

From: Dr. John Krane <jkrane_at_netzero.com>
Date: Wed, 23 Aug 2006 14:40:46 -0500


Hi,

No. I do not define the stock ticker name, so I cannot stop using it just because a problem has surfaced in ROOT. The ticker name comes from the U.S. financial industry. I do not control it. It is not wise for me to build code to handle a special case for it either, because the convention in this name is pretty common.

In my opinion, we need to design methods intelligently, so that we do not needlessly create reserved characters. In this case, it truly is needless. There are many simple ways to navigate directories in ROOT without resorting to special treatment of "/" in the Get() method.

I do all of my work in Linux, so I am familliar with the special nature of "/" in Unix/Linux, but we are talking about ROOT! I am not talking about file names, I am talking about histogram names. Thank you,

Maurizio Panniello wrote:

>Hi, could i advice you to don't use any reserved character for a
>filename (not only in root files)... please: you (and your users) could
>have problems of portability with this code!
>
>http://en.wikipedia.org/wiki/Filename
>
>Dr. John Krane wrote:
>
>
>>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.
>>
>> - John
>>
>>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 Analyst
Received on Wed Aug 23 2006 - 21:40:58 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET