Reuse histos from a saved TCanvas

Hi,
after saving a TCanvas containing 3 histos (c1->Print(“br.C”):wink: and reloading it with

root [0] .x br.C

even if the TCanvas is plotted properly, I’m unable to reuse the histos:

root [1] .ls
TROOT* Rint The ROOT of EVERYTHING
OBJ: TH1D hmc MC : 0 at: 0x852ecb8
OBJ: TH1D hdata Data & MC : 0 at: 0x852f838
OBJ: TH1D hratio Data/MC : 0 at: 0x8533338

root [2] hmc()->Draw()
Error: Can’t call TH1::operator()() in current scope (tmpfile):1:
Possible candidates are…
(in TH1)
Error: non class,struct,union object hmc() used with . or -> (tmpfile):1:
*** Interpreter error recovered ***

Could you please help me?

Cheers,
s.

Hi,

Did you try:root [] hmc->Draw();?

Cheers,
Philippe

do u mean hmc()->Draw(); insted of hmc()->Draw() ?

same result:

root [9] hmc()->Draw();
Error: Can’t call TH1::operator()() in current scope (tmpfile):1:
Possible candidates are…
(in TH1)
Error: non class,struct,union object hmc() used with . or -> (tmpfile):1:
*** Interpreter error recovered ***

s.

Hi,

[quote]do u mean hmc()->Draw(); insted of hmc()->Draw() ?
[/quote]
I meant neither (which appear to be the same in your post).
I meant for you to remove the first set of parenthesis!

Cheers,
Philippe.

I’m sorry… don’t know why those parenthesis were there :slight_smile:
s.

btw… is it possible to open the saved canvas inside a macro in order to reuse the histos (something like the root shell .x br.C)?