10 #include "Math/SMatrix.h"
11 #include "Math/SVector.h"
33 const value_t dxr = fidpointvec[3].x() - fidpointvec[2].x();
34 const value_t dyr = fidpointvec[3].y() - fidpointvec[2].y();
35 const value_t gammar = atan(dyr / dxr);
36 const value_t dxl = fidpointvec[1].x() - fidpointvec[0].x();
37 const value_t dyl = fidpointvec[1].y() - fidpointvec[0].y();
38 const value_t gammal = atan(dyl / dxl);
44 std::cout <<
"gamma: " <<
gamma <<
" gamma left: " << gammal <<
" gamma right: " << gammar << std::endl;
48 std::cout <<
"&fidpointvec: " << std::endl;
49 for (
count_t i = 0;
i != fidpointvec.size();
i++)
50 std::cout <<
i <<
": " << fidpointvec[
i] << std::endl;
51 std::cout <<
"&fidpoints_: " << std::endl;
57 ROOT::Math::SMatrix<value_t, nMsrmts, nLcD>
A;
60 A(0, 2) = +fidpointvec[0].x();
61 A(0, 3) = +fidpointvec[0].y();
64 A(1, 2) = +fidpointvec[0].y();
65 A(1, 3) = -fidpointvec[0].x();
68 A(2, 2) = +fidpointvec[1].x();
69 A(2, 3) = +fidpointvec[1].y();
72 A(3, 2) = +fidpointvec[1].y();
73 A(3, 3) = -fidpointvec[1].x();
76 A(4, 2) = +fidpointvec[2].x();
77 A(4, 3) = +fidpointvec[2].y();
80 A(5, 2) = +fidpointvec[2].y();
81 A(5, 3) = -fidpointvec[2].x();
84 A(6, 2) = +fidpointvec[3].x();
85 A(6, 3) = +fidpointvec[3].y();
88 A(7, 2) = +fidpointvec[3].y();
89 A(7, 3) = -fidpointvec[3].x();
95 ROOT::Math::SMatrix<value_t, nMsrmts, nMsrmts> W;
99 W(0, 0) = sigma_x2inv;
100 W(1, 1) = sigma_y2inv;
101 W(2, 2) = sigma_x2inv;
102 W(3, 3) = sigma_y2inv;
103 W(4, 4) = sigma_x2inv;
104 W(5, 5) = sigma_y2inv;
105 W(6, 6) = sigma_x2inv;
106 W(7, 7) = sigma_y2inv;
112 ROOT::Math::SMatrix<value_t, nLcD, nLcD> ATWA;
113 ATWA = ROOT::Math::Transpose(
A) * W *
A;
116 ROOT::Math::SMatrix<value_t, nLcD, nLcD> ATWAi;
118 ATWAi = ATWA.Inverse(ifail);
120 std::cout <<
"Problem singular - fit impossible." << std::endl;
125 std::cout <<
"ATWA-1: \n" << ATWAi << ifail << std::endl;
129 ROOT::Math::SVector<value_t, nMsrmts>
y;
143 ROOT::Math::SVector<value_t, nLcD>
a;
144 a = ATWAi * ROOT::Math::Transpose(
A) * W *
y;
145 chi2_ = ROOT::Math::Dot(
y, W *
y) - ROOT::Math::Dot(
a, ROOT::Math::Transpose(
A) * W *
y);
147 std::cout <<
"a: " <<
a <<
" S= " <<
sqrt(
a[2] *
a[2] +
a[3] *
a[3]) <<
" phi= " << atan(
a[3] /
a[2])
148 <<
" chi2= " <<
chi2_ << std::endl;
151 a_.assign(
a.begin(),
a.end());
233 ROOT::Math::SVector<value_t, 4> mod1, mod2;
246 ROOT::Math::SMatrix<value_t, 4, 4> M1, M2;
283 ROOT::Math::SVector<value_t, 4> mod_tr1, mod_tr2;
290 fidpointvec.push_back(
coord_t(mod_tr1(0), mod_tr1(1)));
291 fidpointvec.push_back(
coord_t(mod_tr1(2), mod_tr1(3)));
292 fidpointvec.push_back(
coord_t(mod_tr2(0), mod_tr2(1)));
293 fidpointvec.push_back(
coord_t(mod_tr2(2), mod_tr2(3)));
300 throw std::logic_error(
301 "SurveyPxbImageLocalFit::getLocalParameters(): Fit is not valid. Call doFit(...) before calling this "
308 throw std::logic_error(
309 "SurveyPxbImageLocalFit::getChi2(): Fit is not valid. Call doFit(...) before calling this function.");
315 throw std::range_error(
"SurveyPxbImageLocalFit::setLocalDerivsToZero(j): j out of range.");
322 throw std::range_error(
"SurveyPxbImageLocalFit::setLocalDerivsToZero(j): j out of range.");