Linear Fitting (vertcal fit)

Hi there,

I have trouble with fitting vertical lines with ROOT using Minuit.
I think it comes from the fact that, on a vertical track, the slope of the fit line (defined by y = m*x + b) is infinite.
So, I end up with no fit line drawn and a slope which is crazy big (>10000!).
Maybe, I need to mention that I’m trying to fit TGraphs or TGraphErrors.

I tried to look at the Normal Equation method to maybe solve my problem, but I really don’t understand how it works (and, more importantly, if it’ll work in my situation).
In order to try it out, I slightly modified the file $ROOTSYS/tutorials/matrix/solveLinear.C to build a vertical line (ie all Xs = 1.0 in this case) and I ran it.
As expected, the Minuit method didn’t work and the Normal Equation method seems to give me something, but I don’t know what it is.

When I print the TVectorD (using .Print()) returned by the NormalEqn function, I get :

0 0.858824
1 1

The problem is that I’m not sure what those numbers are.

Could someone help me please ?

Thank you very much.

perhaps @moneta or @vcroft can help here?

Thank you,
Oksana.

Hi,

Are your points exactly at the same x values ? In that case you will not be able to fit the data.
If not, you can try fitting them, but maybe try to parametrize the line as y = 1/A * x
However, if you have large error in y you will get a very large parameter on the slope, because it will be very little constraints by the data

Lorenzo

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.