Parameter names in new TF1/TFormula

The new TFormula introduced in ROOT 6.03/04 changes the default names of parameters. For example in ROOT5 for the expression “[0]+[1]*x” there were two parameters “p0” and “p1”, with the ROOT development release they are now known as only “0” and “1” (so just the content of the squared brackets). This also extents to expressions like “pol2(0)+gaus(3)”. Is this intentional, or will this still be changed for the final release?

Combined with ROOT-7281 this makes it virtually impossible to use the same code with ROOT5 and the upcoming release of ROOT.

Hi,

This problem has been fixed in the current master version. Now the parameter names are by default p0, p1,…pN.

Thank you for reporting this issue

Lorenzo

Hi Lorenzo,

thank you very much for the various fixes.

There is one more difference between the new and old TF1/TFormula, which I am not sure whether it is intentional or not.

Previously the function “[0] + [2]*x” had three parameters (one of them unused), so to set the two parameters one had to use ‘SetParameter(0, 1.2)’ and ‘SetParameter(2, 2.3)’. With the new TFormula this expression only has two parameters and (using the parameter indices) one has to use ‘SetParameter(0, 1.2)’ and ‘SetParameter(1, 2.3)’ for the same effect.

Best regards, Sebastian

Hi,

Yes, I know about this difference, but I don’t think I want to support this case. The TFormula is now much more general in defining the parameter names, you could do also "[a]+[b]*x"
This looks to me more an error in the user side in defining the parameters. Or do you have a valid use case for defining “[0]+[2]*x” ?

Lorenzo

Hi,

in particular after you fixed the variable names to be the same in ROOT5 and the new TFormula I am not aware of any situation where it might still be required to set parameters for functions with holes via the parameter index (for me), as setting a parameter via the parameter name is working in any case.

Best regards, Sebastian