Problems with "Save As" from a canvas

Hi,

I have a small example macro (see below) which plots a TF1. The TF1 is defined by a TFormula. After executing the macro and then saving the result as a ROOT macro by choosing “Save As…” from the Canvas menue, only the TF1 is saved but not the TFormula. As a result, executing the macro will fail. What do I nee to do to save also the TFormula?

I am using 4.00/04 on Fedora.

There is an other issue related to the “Save As” dialog box. I would be nice if one wouldn’t need to type the filname extension, but if instead root would add the extension according to the chosen format in the “Files of type” box. This is the behaviour that I know from all other GUI on Linux and Windows.

Thanks,
Jochen

{ gROOT->Reset(); form1 = new TFormula("form1","[0]+[1]*x+[2]*x*x"); TF1 *fun1 = new TF1("fun1","form1",0,4); fun1->SetParameters(0,0,1); fun1->Draw(); }

Hi Jochen,

In the CVS version, functions referencing other functions are now saved correctly.

Concerning the dialog box, I agree with your comment. We will improve the behaviour.

Rene

[quote=“brun”]Hi Jochen,
In the CVS version, functions referencing other functions are now saved correctly.
Concerning the dialog box, I agree with your comment. We will improve the behaviour.

Rene[/quote]

Dear Rene,

With the simple macro I attached to my original posting, the function is saved correctly with the CVS version of ROOT. However, if the function definition contains something like TMath::Log(), the “Save As” still messes up to code, and the saved macro will not be executable by ROOT.

I have attached another macro which demonstrates the effect.

The “Save As” produces this:

   TF1 *fun1 = new TF1("fun1","x+(Double_t TMath::Log(Double_t x)*(x*Double_t TMath::Log(Double_t x)))",20,55);

Things are ok, if log() is used instead of TMath::Log().

Thanks,
Jochen
test2.C (205 Bytes)

Hi Jochen,

I can reproduce the problem.
We will investigate once we will be back from CHEP.

Rene

[quote=“brun”]Hi Jochen,

I can reproduce the problem.
We will investigate once we will be back from CHEP.

Rene[/quote]

Dear Rene,

is there any news on this topic? I just compiled the head version from CVS, but the problem is still there.

Thanks,
Jochen

The code generated by TF1::SavePrimitive is not correct when the TF1
references TMath. The code needs to be improved for this special case.
On our todo list.

Rene