TCanvas::SaveAs(<fileName>.C saves macro not working

Dear all,
I’m running root 5.28 on Mac OS X ( 10.6.8 ).
I have a macro that saves the final TCanvas as .png and .C.
The saved macro (see attachment MPV_MPP_radComp.C) doesn’t work:

What happens is that the

TH1F *t_MPP1_July_deg0_fl0e151__1

is created (line 29) but then it is passed to a TGraph with the wrong name (line 34, indeed):


This is true for alle the histos.

I attach also my macro (loopMPV.C).

Any input will be really appreciated.

Many thanks in advance,
loopMPV.C (3.93 KB)
MPV_MPP_radComp.C (6.96 KB)

I’ll try your example.
But I have done a recent fix which might help in your case too.
Can you try ?

You case is different to the one I fixed.
I am looking at it now.

Ok, it seems your root version is too old.
The histogram same (set from the graph) now start with Graph_
It i snot the case for you.
Try a more recent version.

Dear Olivier,
it works indeed with v5.30.
Thanks a lot,