Problem TGraph with a TGraph savedAs macro [was:root macro]

Hi,

I run the root code and draw the graph, then saved the graph by macro format.
But, it shows the error message when I run this macro in the root.
I just save the graph to use macro format, but the graph cannot be reproduced.
How can I fixed it?

In addition, I want to use the x axis range from 0.0 to 1.0.
I tried to use SetRange or SetRangeUser commands in the macro, but they does
not work. Would you tell me how to adjust the x axis range?

Thank you!
test01.C (35.2 KB)

I have fixed the problem in the SVN trunk. The problem appears when several histograms with variable bin width are saved in the same macro.

Rene

Thank you so much, but I don’t know how to use or download the SVN trunk. I am still ROOT beginner. Would you tell me how to use the SVN???
Thank you!

To install from source, do

cd $HOME svn co http://root.cern.ch/svn/root/trunk root cd root ./configure make -k
for more details, see:
root.cern.ch/root/Install.html
root.cern.ch/twiki/bin/view/ROOT/SubversionHowto

Rene

Hi,
Thank you for your reply and I installed new version root 5.2101.
However,

I see the error message:

root [0] .x test01.C
Error in TFormula::TFormula: expression may not be 0 or have 0 length
Error in TF1::TF1: function: pimfit/ has 0 parameters instead of 1
Error in TFormula::TFormula: expression may not be 0 or have 0 length
Error in TF1::TF1: function: pipfit/ has 0 parameters instead of 1
Error in TFormula::TFormula: expression may not be 0 or have 0 length
Error in TF1::TF1: function: kpfit/ has 0 parameters instead of 1
Error in TFormula::TFormula: expression may not be 0 or have 0 length
Error in TF1::TF1: function: kmfit/ has 0 parameters instead of 1
Error in TFormula::TFormula: expression may not be 0 or have 0 length
Error in TF1::TF1: function: profit/ has 0 parameters instead of 1
Error in TFormula::TFormula: expression may not be 0 or have 0 length
Error in TF1::TF1: function: pbfit/ has 0 parameters instead of 1
root [1] .q

Would you check this?
I attached the macro ‘test01.C’ with this message!
test01.C (12.6 KB)

You do things like:

   TF1 *pimfit = new TF1("pimfit","",0,0.6);   

This is not allowed. The second parameter of the TF1 constructor cannot be “”. See:

root.cern.ch/root/html/TF1.html

Thank you for your reply, however, I did not modify the macro. The macro code was generated by the root (ver. 5.2101 which Rene fixed and I downloaded the SVN trunk).
I attached the graph pdf file and the macro code. The macro does not generate the same graph. Would you check this problem?

Sincerely,
test01.C (12.6 KB)
test01.pdf (17.5 KB)

The macro you sent is also a saved macro (see the comment on top). That macro also has the same kind of problem I told you before.
Do you have the original macro ? … may be I missed something.

That is the original macro which ROOT (graph) generated. I did not do any modification for that.

[quote]That is the original macro which ROOT (graph) generated. I did not do any modification for that.[/quote]I am not sure I understand. Where did the data come from? Who originated the information? How did it get from there to your test01.C file?

Philippe.

I run the fitting program code and the code drew the graph.
Then, I saved the graph as a pdf file. It is the test01.pdf file which I posted before. I also saved the graph as a ROOT macros, and it is the test01.C macro file as same time. After that I run the macro, test01.C, and it does not generate same graph as test01.pdf and shows error message as I mentioned before. The fitting graph is not nice, but it shows strange behavior? So, Rene said he fixed the problem and I downloaded the package and I run it under the new version system, but it seems to have the problem which means pdf file graph is different from the macro graph.
This is the point.
Thank you!

[quote]I run the fitting program code and the code drew the graph. [/quote]Can you provide this code so that we can reproduce the problem? If this is not possible, can you save the Graph to .root file and sent it to us?

Thanks,
Philippe.

Hi,

Did you guys (pcanal and couet) receive the code which I send? and could you check them?
Thank you!