Hi,
As far as I understand the “pol1(x)” documentation
pol1(2) is equivalent to [2]+[3]*x
However, this doesn’t seem to work consistently. The following code gives the correct result for the TF1 “upperWidth” ->Draw()
TF1 *dWidth = new TF1(“dWidth”, “pol1(2)”);
dWidth->SetParameter(2, sigmaParameters[0] );
dWidth->SetParameter(3, sigmaParameters[1] );
TF1 *upperWidth = new TF1(“upperWidth”, “dWidth”, 1, 6);
Adding another function to “upperWidth” breaks this functionality. For example, this code does NOT work correctly:
TF1 *mean = new TF1(“mean”, “pol1(0)” );
mean->SetParameters( meanParameters );
TF1 *dWidth = new TF1(“dWidth”, “pol1(2)”);
dWidth->SetParameter(2, sigmaParameters[0] );
dWidth->SetParameter(3, sigmaParameters[1] );
TF1 *upperWidth = new TF1(“upperWidth”, “mean + dWidth”, 1, 6);
Instead, I have to do this:
TF1 *mean = new TF1(“mean”, “pol1(0)” );
mean->SetParameters( meanParameters );
TF1 *dWidth = new TF1(“dWidth”, “pol1(2)”);
dWidth->SetParameter(0, sigmaParameters[0] );
dWidth->SetParameter(1, sigmaParameters[1] );
TF1 *upperWidth = new TF1(“upperWidth”, “mean + dWidth”, 1, 6);
This is completely confusing to me! What is the rule here? Who came up this? How can I ensure that the parameter numbering scheme is not redefined when I use a linear combination of functions?
Kind regards,
Martin