Numbers as histogram names in CINT

Dear Experts,

This is probably a trivial question:
I have histograms with numbers as titles, and I try to plot them on the command line, but they are seen as numbers and I get this error:

root [2] _file0->ls()
TFile** xbin_64-ybin_83-lines_5.root Line shapes for one bin
 TFile* xbin_64-ybin_83-lines_5.root Line shapes for one bin

KEY: TH1F 120404;1 1.776669
KEY: TH1F 120720;1 1.776669
KEY: TH1F 121645;1 1.776669
KEY: TH1F 126836;1 1.776669
KEY: TH1F 128895;1 1.776669

root [3] 120404->Draw()

**ROOT_prompt_3:1:9:** **error:** **member reference type 'int' is not a pointer**
120404->Draw()
**~~~~~~ ^**

I have for now just renamed the histograms, adding an “h” in the front, which works fine, but for various reasons its quite practical to have the number-only names - can I tell root on the command line that this is not a number but a histogram?

The root file can be found here:

https://cernbox.cern.ch/index.php/s/ZhOEidgdqTcf1VA

Thanks,
Thorsten


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.20.0
Platform: Mac OSX 10.15.6
Compiler: Apple clang version 11.0.3 (clang-1103.0.32.62)


Hi,

You can also do:

auto h120404 = (TH1F*)_file0->Get("120404"); h120404->Draw();

Cheers,
Enric

Hi Enric,

Thanks, yes that works!

Cheers,
Thorsten

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.