What characters cause trouble in object names?

From: Christian Ohm <ohm_at_physto.se>
Date: Mon, 27 Apr 2009 19:05:18 +0200


Hi ROOTers,

I have a script that produces "a million" histograms, and since it's a pain to give them separate names and titles, I have one single descriptive (and unique) TString per object that I use for both purposes. However, when I try to retrieve a histogram containing a slash ('/') in the name, e.g. "dE/dx vs. p (hadronic cells only)", ROOT won't find it:

Writing a histogram:
root [0] TString str = TString("This is a / complicated string, apparently");

root [1] TH1F *testHizzie = new TH1F(str,str,10,0,1)
root [2] TFile *myFile = new TFile("test.root","recreate")
root [3] testHizzie->Write()

Reading it back:
root [0] TFile *testFile = new TFile("test.root"); root [1] TH1F *h = (TH1F*) testFile->Get("This is a / complicated string, apparently")
root [2] h
(class TH1F*)0x0

It shows up in the TBrowser though - no problem - but it doesn't show up when I do gDirectory-ls(). So unless I missed something, there seem to be characters that should be avoided in object names - is there a list of them somewhere? Or is there a way to 'escape' the slash if it's causing trouble when ROOT parses the string? I skimmed some relevant parts in the manual but couldn't find any info - if it's not there, maybe it could be added?

Thanks,
Christian Received on Mon Apr 27 2009 - 23:33:30 CEST

This archive was generated by hypermail 2.2.0 : Wed Apr 29 2009 - 23:50:02 CEST