34 unsigned n =
t.links().length();
35 if (_det == 0. &&
n == 2) {
36 double x0 =
t.links()[0]->position().x();
37 double y0 =
t.links()[0]->position().y();
38 double x1 =
t.links()[1]->position().x();
39 double y1 =
t.links()[1]->position().y();
41 _a = (y0 - y1) / (x0 - x1);
45 double sum = (double)
n;
46 double sumX = 0., sumY = 0., sumX2 = 0., sumXY = 0., sumY2 = 0.;
47 for (
unsigned i = 0; i <
n; i++) {
58 _det = sum * sumX2 - sumX * sumX;
59#ifdef TRKRECO_DEBUG_DETAIL
60 cout <<
" TLineFitter::fit ... det=" << _det << std::endl;
66 _a = (sumXY * sum - sumX * sumY) / _det;
67 _b = (sumX2 * sumY - sumX * sumXY) / _det;
71 if (
t.objectType() ==
Line)
72 ((
TMLine &)
t).property(_a, _b, _det);