I’m retrieving some histograms (TH1F) from a root file (hist-scale.root) by simply doing:
The problem is that some of the histos have special characters and white space in the name, so for example if the name of the histo is “cut_flow_central” it works while if it is “cut_flow_name=‘nominal’ combine=‘none’ nominal id=‘0’” it doesn’t work.
I know that it’s not the best thing to have such names but I was wondering wheter it is possible to retrieve them avoiding to change by hand the names (histograms are the output of a previous program so it is a bit more complicated).
Thanks a lot!
Maybe it’s a stupid question, but does it have to be as complicated as shown in the link?
I just tested “Get” and it worked just fine. So what (if anything) is wrong with the following?
root  auto f = unique_ptr<TFile>(TFile::Open("/tmp/x.root", "recreate"))
(std::unique_ptr<TFile, default_delete<TFile> > &) @0x7fc277f85060
root  TH1F("cut_flow_name='nominal' combine='none' nominal id='0'", "Title Test", 100, 0, 100).Write()
root  .q
$ root -l /tmp/x.root
Attaching file /tmp/x.root as _file0...
(TFile *) 0x526e1c0
root  auto h = dynamic_cast<TH1*>(_file0->Get("cut_flow_name='nominal' combine='none' nominal id='0'"))
(TH1 *) 0x53a3aa0
root  h->GetTitle()
(const char *) "Title Test"
root  .q
The link shows the extreme case where some characters cannot be even typed.