TLinearFitter bug or misunderstanding?

Not sure if the following is a bug or me just doing something wrong. Using v5.34/11:

[code]void LFProb()
{
TString fs(“1++x”);
TFormula form1 (“form1”, fs);
TFormula* pform1 = new TFormula (form1);
TFormula* pform2 = new TFormula (“form2”, fs);
TLinearFitter lf1 (pform1, “”);
TLinearFitter lf2 (pform2, “”);

Double_t x = 3.;

cout << “pform1” << endl;
pform1->Print();
lf1.AddPoint (&x, 4);

cout << “pform2” << endl;
pform2->Print();
lf2.AddPoint (&x, 4);
}
[/code]

The only difference between pform1 and pform2 is the first is created using a copy constructor while the second is constructed from a name and a string. Both TFormula::Print calls produce the same output, but the first TLinearFitter::AddPoint gives an error while the second does not:

root [102] .X LFProb.C pform1 form1 : 1++x Ndim= 1, Npar= 2, Noper= 7 fExpr[0] = [0] action = 140 action param = 0 fExpr[1] = 1 action = 141 action param = 0 fExpr[2] = * action = 3 action param = 0 fExpr[3] = [1] action = 140 action param = 1 fExpr[4] = x action = 144 action param = 0 fExpr[5] = * action = 3 action param = 0 fExpr[6] = + action = 1 action param = 0 Optimized expression fExpr[0] = [0],1,* action = 148 action param = 0 fExpr[1] = [1],x,* action = 148 action param = 0 fExpr[2] = + action = 1 action param = 0 Par 0 p0 = 0 Par 1 p1 = 0 Error in <TLinearFitter::AddToDesign>: Function form1 has no linear parts - maybe missing a ++ in the formula expression pform2 form2 : 1++x Ndim= 1, Npar= 2, Noper= 7 fExpr[0] = [0] action = 140 action param = 0 fExpr[1] = 1 action = 141 action param = 0 fExpr[2] = * action = 3 action param = 0 fExpr[3] = [1] action = 140 action param = 1 fExpr[4] = x action = 144 action param = 0 fExpr[5] = * action = 3 action param = 0 fExpr[6] = + action = 1 action param = 0 Optimized expression fExpr[0] = [0],1,* action = 148 action param = 0 fExpr[1] = [1],x,* action = 148 action param = 0 fExpr[2] = + action = 1 action param = 0 Par 0 p0 = 0 Par 1 p1 = 0

Hi,

This problem seems to be due to some issues in the old TFormula copy-tor. Since in ROOT 6.04 we have moved to a completely new TFormula class. Can you please try with the latest ROOT version ?

Lorenzo

Unfortunately upgrading our ROOT version is not practical at this time.