24 (
const std::string&
t,
const std::string&
n,
const IInterface*
p)
36 declareInterface<IUpdator>(
this );
37 declareInterface<IPatternParametersUpdator>(
this );
57 msg(MSG::INFO) <<
"initialize() successful in " <<
name() <<
endmsg;
59 if( m_cov0.size()!=5) {
61 m_cov0.erase(m_cov0.begin(),m_cov0.end());
62 m_cov0.push_back( 10.);
63 m_cov0.push_back( 10.);
64 m_cov0.push_back( .025);
65 m_cov0.push_back( .025);
66 m_cov0.push_back(.0001);
68 return StatusCode::SUCCESS;
77 return StatusCode::SUCCESS;
115 return updateOneDimension(T,
P,
E, 1,
false,Ta,
x2);
233 return updateOneDimension(T,
P,
E, 1,
true,Ta,Q);
293 int n = Ep.cols();
if(
n==0 ||
n>5)
return nullptr;
302 mv[ 1]=Ep(1,0); mv[ 2]=Ep(1,1);
306 mv[ 3]=Ep(2,0); mv[ 4]=Ep(2,1); mv[ 5]=Ep(2,2);
310 mv[ 6]=Ep(3,0); mv[ 7]=Ep(3,1); mv[ 8]=Ep(3,2); mv[ 9]=Ep(3,3);
314 mv[10]=Ep(4,0); mv[11]=Ep(4,1); mv[12]=Ep(4,2); mv[13]=Ep(4,3); mv[14]=Ep(4,4);
319 double p [ 5] = {T(0),T(1),T(2),T(3),T(4)};
320 double pv[15] = {Et(0,0),
322 Et(2,0),Et(2,1),Et(2,2),
323 Et(3,0),Et(3,1),Et(3,2),Et(3,3),
324 Et(4,0),Et(4,1),Et(4,2),Et(4,3),Et(4,4)};
332 else if(
n==1 && K==1) {
340 if(!
update)
return nullptr;
352 return new std::pair<AmgVector(5),AmgSymMatrix(5)>(std::make_pair(nT,
nEt));
402 double MV[15];
if(!trackParametersToUpdator(T1,M,MV))
return nullptr;
404 double PV[15];
if(!trackParametersToUpdator(T2,
P,PV))
return nullptr;
406 double x2;
double*
m;
double* mv;
double*
p;
double*
pv;
407 if(MV[14] > PV[14]) {
m = &M[0]; mv = &MV[0];
p = &
P[0];
pv = &PV[0];}
408 else {
m = &
P[0]; mv = &PV[0];
p = &M[0];
pv = &MV[0];}
410 if(updateWithFiveDim(
false,
m,mv,
p,
pv,
x2)) {
411 testAngles(
p,
pv);
return updatorToTrackParameters(T1,
p,
pv);
424 double MV[15];
bool q1 = trackParametersToUpdator(T1,M,MV);
426 double PV[15];
bool q2 = trackParametersToUpdator(T2,
P,PV);
430 double x2;
double*
m;
double* mv;
double*
p;
double*
pv;
431 if(MV[14] > PV[14]) {
m = &M[0]; mv = &MV[0];
p = &
P[0];
pv = &PV[0];}
432 else {
m = &
P[0]; mv = &PV[0];
p = &M[0];
pv = &MV[0];}
434 if(updateWithFiveDim(
false,
m,mv,
p,
pv,
x2)) {
441 if(q1) {T3=T1;
return true;}
442 if(q2) {T3=T2;
return true;}
456 double MV[15];
if(!trackParametersToUpdator(T1,M,MV))
return nullptr;
458 double PV[15];
if(!trackParametersToUpdator(T2,
P,PV))
return nullptr;
460 double x2;
double*
m;
double* mv;
double*
p;
double*
pv;
461 if(MV[14] > PV[14]) {
m = &M[0]; mv = &MV[0];
p = &
P[0];
pv = &PV[0];}
462 else {
m = &
P[0]; mv = &PV[0];
p = &M[0];
pv = &MV[0];}
464 if(updateWithFiveDim(
true,
m,mv,
p,
pv,
x2)) {
466 testAngles(
p,
pv);
return updatorToTrackParameters(T1,
p,
pv);
481 double MV[15];
bool q1 = trackParametersToUpdator(T1,M,MV);
483 double PV[15];
bool q2 = trackParametersToUpdator(T2,
P,PV);
487 double*
m;
double* mv;
double*
p;
double*
pv;
488 if(MV[14] > PV[14]) {
m = &M[0]; mv = &MV[0];
p = &
P[0];
pv = &PV[0];}
489 else {
m = &
P[0]; mv = &PV[0];
p = &M[0];
pv = &MV[0];}
491 if(updateWithFiveDim(
true,
m,mv,
p,
pv,Q)) {
498 if(q1) {T3=T1; Q=0;
return true;}
499 if(q2) {T3=T2; Q=0;
return true;}
516 double t[5] = {T.parameters()[0],T.parameters()[1],
517 (*v)(0,0),(*
v)(1,0),(*
v)(1,1)};
520 if(predictedStateFitQuality(
t,
P,
E,
N,
x2))
return {
x2,
N};
533 if(!T.iscovariance()) {
N = 0;
return false;}
538 double t[5] = {
p[0],
p[1],
541 return predictedStateFitQuality(
t,
P,
E,
N,X2);
557 double pv[15];
if(!trackParametersToUpdator(T,
p,
pv))
return {};
564 double mv[15];
if(!localParametersToUpdator(
P,
E,
n,
k,
m,mv))
return {};
569 double w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.};
574 bool q=
true;
if(
n!=1)
q=invert(
n,
w,
w);
else w[0]=1./
w[0];
577 differenceParLoc(
k,
m,
p,
r);
578 return {Xi2(
n,
r,
w),
n};
595 double pv[15];
if(!trackParametersToUpdator(T,
p,
pv))
return false;
602 double mv[15];
if(!localParametersToUpdator(
P,
E,
n,
k,
m,mv))
return false;
607 double w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.};
612 bool q=
true;
if(
n!=1)
q=invert(
n,
w,
w);
else w[0]=1./
w[0];
614 if(
q) {differenceParLoc(
k,
m,
p,
r); X2 = Xi2(
n,
r,
w);
return true ;}
631 double t[5] = {T.parameters()[0],T.parameters()[1],
632 (*v)(0,0),(*
v)(1,0),(*
v)(1,1)};
635 if(fullStateFitQuality(
t,
P,
E,
N,
x2))
return {
x2,
N};
648 if(!T.iscovariance()) {
N = 0;
return false;}
653 double t[5] = {
p[0],
p[1],
656 return fullStateFitQuality(
t,
P,
E,
N,X2);
671 double pv[15];
if(!trackParametersToUpdator(T,
p,
pv))
return {};
677 double mv[15];
if(!localParametersToUpdator(
P,
E,
n,
k,
m,mv))
return {};
682 double w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.};
687 bool q=
true;
if(
n!=1)
q=invert(
n,
w,
w);
else w[0]=1./
w[0];
690 differenceParLoc(
k,
m,
p,
r);
691 return {Xi2(
n,
r,
w),
n};
709 double pv[15];
if(!trackParametersToUpdator(T,
p,
pv))
return false;
715 double mv[15];
if(!localParametersToUpdator(
P,
E,
N,
k,
m,mv))
return false;
725 bool q=
true;
if(
N!=1)
q=invert(
N,
w,
w);
else w[0]=1./
w[0];
727 if(
q) {differenceParLoc(
k,
m,
p,
r); X2 = Xi2(
N,
r,
w);
return true ;}
742 double mv[15];
if(!trackParametersToUpdator(T1,
m,mv))
return {};
744 double pv[15];
if(!trackParametersToUpdator(T2,
p,
pv))
return {};
745 double r[5] = {
m [ 0]-
p [ 0],
756 double w[15]= {mv[ 0]+
pv[ 0],
772 if(invert(5,
w,
w))
return {Xi2(5,
r,
w),5};
786 double mv[15];
if(!trackParametersToUpdator(T1,
m,mv))
return 0;
788 double pv[15];
if(!trackParametersToUpdator(T2,
p,
pv))
return 0;
789 double r[5] = {
m [ 0]-
p [ 0],
800 double w[15]= {mv[ 0]+
pv[ 0],
816 if(invert(5,
w,
w)) {X2 = Xi2(5,
r,
w);
return true;}
827 std::vector<double>
errors(5);
829 errors[0] = sqrt(m_cov0[0]);
830 errors[1] = sqrt(m_cov0[1]);
831 errors[2] = sqrt(m_cov0[2]);
832 errors[3] = sqrt(m_cov0[3]);
833 errors[4] = sqrt(m_cov0[4]);
858 int n =
E.rows();
if(
n<=0)
return nullptr;
870 double pv[15];
bool measured = trackParametersToUpdator(T,
p,
pv);
884 testAngles(
p,
pv);
return updatorToTrackParameters(T,
p,
pv);
891 if(O<0)
return nullptr;
894 update = updateNoMeasuredWithOneDim(
m,mv,
p,
pv);
898 update = updateNoMeasuredWithTwoDim(
m,mv,
p,
pv);
902 if(
update)
return updatorToTrackParameters(T,
p,
pv);
922 N =
E.rows();
if(
N<=0)
return false;
934 double pv[15];
bool measured = trackParametersToUpdator(T,
p,
pv);
940 else if(
N==1)
update = updateWithOneDim(O,
X,
m,mv,
p,
pv,Q);
950 if(O<0)
return false;
952 if (
N==1)
update = updateNoMeasuredWithOneDim(
m,mv,
p,
pv);
953 else if(
N==2)
update = updateNoMeasuredWithTwoDim(
m,mv,
p,
pv);
975 int N =
E.rows();
if(
N!=2 )
return false;
985 double pv[15];
bool measured = trackParametersToUpdator(T,
p,
pv);
990 if(fabs(mv[1]) < 1.
e-30) {
991 update = updateWithOneDimWithBoundary(O,
X,
m,mv,
p,
pv,Q);
994 update = updateWithTwoDimWithBoundary(O,
X,
m,mv,
p,
pv,Q);
1005 if(O<0)
return false;
1007 update = updateNoMeasuredWithTwoDim(
m,mv,
p,
pv);
1031 double mv[15];
if(!localParametersToUpdator(
P,
E,
n,
k,
m,mv))
return nullptr;
1036 double pv[15];
bool measured = trackParametersToUpdator(T,
p,
pv);
1046 else if(
n==1 &&
k==1) {
1054 if(
update) {testAngles(
p,
pv);
return updatorToTrackParameters(T,
p,
pv);}
1060 if(O<0)
return nullptr;
1062 update = updateNoMeasuredWithOneDim(
m,mv,
p,
pv);
1065 else if(
n==2 &&
k==3) {
1066 update = updateNoMeasuredWithTwoDim(
m,mv,
p,
pv);
1073 if(
update)
return updatorToTrackParameters(T,
p,
pv);
1093 double mv[15];
if(!localParametersToUpdator(
P,
E,
N,
k,
m,mv))
return false;
1098 double pv[15];
bool measured = trackParametersToUpdator(T,
p,
pv);
1103 if (
N==2 &&
k==3)
update = updateWithTwoDim(O,
X,
m,mv,
p,
pv,Q);
1104 else if(
N==1 &&
k==1)
update = updateWithOneDim(O,
X,
m,mv,
p,
pv,Q);
1115 if(O<0)
return false;
1117 if (
N==1 &&
k==1)
update = updateNoMeasuredWithOneDim(
m,mv,
p,
pv);
1118 else if(
N==2 &&
k==3)
update = updateNoMeasuredWithTwoDim(
m,mv,
p,
pv);
1119 else update = updateNoMeasuredWithAnyDim(
m,mv,
p,
pv,
k);
1138 double mv[3]; X2 = 0.;
1139 N =
E.rows();
if(
N<=0)
return false;
1141 mv[0] =
E(0,0)+T[2];
1144 if(mv[0]>0.) X2 =
m[0]*
m[0]/mv[0];
1149 mv[1] =
E(1,0)+T[3];
1150 mv[2] =
E(1,1)+T[4];
1151 double d = mv[0]*mv[2]-mv[1]*mv[1];
1152 if(
d>0.) X2 = (
m[0]*
m[0]*mv[2]+
m[1]*
m[1]*mv[0]-2.*
m[0]*
m[1]*mv[1])/
d;
1172 double mv[3]; X2 = 0.;
1173 N =
E.rows();
if(
N<=0)
return false;
1175 mv[0] =
E(0,0)-T[2];
1178 if(mv[0]>0.) X2 =
m[0]*
m[0]/mv[0];
1183 mv[1] =
E(1,0)-T[3];
1184 mv[2] =
E(1,1)-T[4];
1185 double d = mv[0]*mv[2]-mv[1]*mv[1];
1186 if(
d>0.) X2 = (
m[0]*
m[0]*mv[2]+
m[1]*
m[1]*mv[0]-2.*
m[0]*
m[1]*mv[1])/
d;
1199 (
const double* M,
const double* MV,
double*
P,
double* PV)
const
1227 (
const double* M,
const double* MV,
double*
P,
double* PV)
const
1258 (
const double* M,
const double* MV,
double*
P,
double* PV,
int K)
const
1263 while(K) {
if(K&1)
P[
i]=M[j++]; K>>=1; ++
i;}
if(
i==0)
return false;
1281 int ne = m_key[K+1];
i=0;
1282 for(
int n = m_key[K];
n!=ne; ++
n) {PV[m_map[
n]] = MV[
i++];}
1293 (
int O,
bool X,
const double* M,
const double* MV,
double*
P,
double* PV,
double& xi2)
1296 if(O>0) {
v0 = MV[0]+PV[0];}
1297 else {
v0 = MV[0]-PV[0];}
1299 if(
v0<=0.)
return false;
1301 double r0 = M[0]-
P[0];
1305 double k0 = PV[ 0]*w0;
1306 double k1 = PV[ 1]*w0;
1307 double k2 = PV[ 3]*w0;
1308 double k3 = PV[ 6]*w0;
1309 double k4 = PV[10]*w0;
1311 if(O<0) {
k0=-
k0; k1=-k1; k2=-k2; k3=-k3; k4=-k4;}
1323 if((PV[14]-= (k4*PV[10]))<=0.)
return false;
1324 PV[13]-= (k4*PV[ 6]);
1325 PV[12]-= (k4*PV[ 3]);
1326 PV[11]-= (k4*PV[ 1]);
1327 PV[10]-= (k4*PV[ 0]);
1328 if((PV[ 9]-= (k3*PV[ 6]))<=0.)
return false;
1329 PV[ 8]-= (k3*PV[ 3]);
1330 PV[ 7]-= (k3*PV[ 1]);
1331 PV[ 6]-= (k3*PV[ 0]);
1332 if((PV[ 5]-= (k2*PV[ 3]))<=0.)
return false;
1333 PV[ 4]-= (k2*PV[ 1]);
1334 PV[ 3]-= (k2*PV[ 0]);
1335 if((PV[ 2]-= (k1*PV[ 1]))<=0.)
return false;
1336 PV[ 1]-= (k1*PV[ 0]);
1337 if((PV[ 0]-= (
k0*PV[ 0]))<=0.)
return false;
1339 if(
X) xi2 = r0*r0*w0;
1351 (
int O,
bool X,
double* M,
double* MV,
double*
P,
double* PV,
double& xi2)
const
1354 if(O>0) {
v0 = MV[0]+PV[0];}
1355 else {
v0 = MV[0]-PV[0];}
1357 if(
v0<=0.)
return false;
1359 double r0 = M[0]-
P[0];
1363 double k0 = PV[ 0]*w0;
1364 double k1 = PV[ 1]*w0;
1365 double k2 = PV[ 3]*w0;
1366 double k3 = PV[ 6]*w0;
1367 double k4 = PV[10]*w0;
1369 if(O<0) {
k0=-
k0; k1=-k1; k2=-k2; k3=-k3; k4=-k4;}
1373 double P1 =
P[1]+k1*r0 ;
1374 double dP = P1-M[1] ;
1375 double W = sqrt(MV[2])*1.732051;
1384 if(
X) xi2 = r0*r0*w0;
1388 dP >
W ? M[1]+=
W : M[1]-=
W; MV[2] = m_covBoundary;
1389 if(!updateWithTwoDimParameters(O,
true,M,MV,
P,PV,xi2))
return false;
1394 if((PV[14]-= (k4*PV[10]))<=0.)
return false;
1395 PV[13]-= (k4*PV[ 6]);
1396 PV[12]-= (k4*PV[ 3]);
1397 PV[11]-= (k4*PV[ 1]);
1398 PV[10]-= (k4*PV[ 0]);
1399 if((PV[ 9]-= (k3*PV[ 6]))<=0.)
return false;
1400 PV[ 8]-= (k3*PV[ 3]);
1401 PV[ 7]-= (k3*PV[ 1]);
1402 PV[ 6]-= (k3*PV[ 0]);
1403 if((PV[ 5]-= (k2*PV[ 3]))<=0.)
return false;
1404 PV[ 4]-= (k2*PV[ 1]);
1405 PV[ 3]-= (k2*PV[ 0]);
1406 if((PV[ 2]-= (k1*PV[ 1]))<=0.)
return false;
1407 PV[ 1]-= (k1*PV[ 0]);
1408 return (PV[ 0]-= (
k0*PV[ 0])) > 0.;
1418 (
int O,
bool X,
const double* M,
const double* MV,
double*
P,
double* PV,
double& xi2)
1423 if(O>0) {
v0 = MV[0]+PV[0]; v1 = MV[1]+PV[1];
v2 = MV[2]+PV[2];}
1424 else {
v0 = MV[0]-PV[0]; v1 = MV[1]-PV[1];
v2 = MV[2]-PV[2];}
1426 double d =
v0*
v2-v1*v1;
if(
d<=0.)
return false;
d=1./
d;
1430 double r0 = M[0]-
P[0];
1431 double r1 = M[1]-
P[1];
1435 double k0 = PV[ 0]*w0+PV[ 1]*w1;
1436 double k1 = PV[ 0]*w1+PV[ 1]*w2;
1437 double k2 = PV[ 1]*w0+PV[ 2]*w1;
1438 double k3 = PV[ 1]*w1+PV[ 2]*w2;
1439 double k4 = PV[ 3]*w0+PV[ 4]*w1;
1440 double k5 = PV[ 3]*w1+PV[ 4]*w2;
1441 double k6 = PV[ 6]*w0+PV[ 7]*w1;
1442 double k7 = PV[ 6]*w1+PV[ 7]*w2;
1443 double k8 = PV[10]*w0+PV[11]*w1;
1444 double k9 = PV[10]*w1+PV[11]*w2;
1447 k0=-
k0; k1=-k1; k2=-k2; k3=-k3; k4=-k4;
1448 k5=-k5; k6=-k6; k7=-k7; k8=-k8; k9=-k9;
1453 P[0]+=(
k0*r0+k1*r1);
1454 P[1]+=(k2*r0+k3*r1);
1455 P[2]+=(k4*r0+k5*r1);
1456 P[3]+=(k6*r0+k7*r1);
1457 P[4]+=(k8*r0+k9*r1);
1461 if((PV[14]-= (k8*PV[10]+k9*PV[11]))<=0.)
return false;
1462 PV[13]-= (k8*PV[ 6]+k9*PV[ 7]);
1463 PV[12]-= (k8*PV[ 3]+k9*PV[ 4]);
1464 PV[11]-= (k8*PV[ 1]+k9*PV[ 2]);
1465 PV[10]-= (k8*PV[ 0]+k9*PV[ 1]);
1466 if((PV[ 9]-= (k6*PV[ 6]+k7*PV[ 7]))<=0.)
return false;
1467 PV[ 8]-= (k6*PV[ 3]+k7*PV[ 4]);
1468 PV[ 7]-= (k6*PV[ 1]+k7*PV[ 2]);
1469 PV[ 6]-= (k6*PV[ 0]+k7*PV[ 1]);
1470 if((PV[ 5]-= (k4*PV[ 3]+k5*PV[ 4]))<=0.)
return false;
1471 PV[ 4]-= (k4*PV[ 1]+k5*PV[ 2]);
1472 PV[ 3]-= (k4*PV[ 0]+k5*PV[ 1]);
1473 if((PV[ 2]-= (k3*PV[ 2]+k2*PV[ 1]))<=0.)
return false;
1474 double c1 = (1.-k3)*PV[ 1]-k2*PV[ 0];
1475 if((PV[ 0]-= (
k0*PV[ 0]+k1*PV[ 1]))<=0.)
return false;
1478 if(
X) xi2 = (r0*r0*w0+r1*r1*w2+2.*r0*r1*w1);
1490 (
int O,
bool X,
const double* M,
const double* MV,
double*
P,
const double* PV,
double& xi2)
1495 if(O>0) {
v0 = MV[0]+PV[0]; v1 = MV[1]+PV[1];
v2 = MV[2]+PV[2];}
1496 else {
v0 = MV[0]-PV[0]; v1 = MV[1]-PV[1];
v2 = MV[2]-PV[2];}
1498 double d =
v0*
v2-v1*v1;
if(
d<=0.)
return false;
d=1./
d;
1502 double r0 = M[0]-
P[0];
1503 double r1 = M[1]-
P[1];
1507 double k0 = PV[ 0]*w0+PV[ 1]*w1;
1508 double k1 = PV[ 0]*w1+PV[ 1]*w2;
1509 double k2 = PV[ 1]*w0+PV[ 2]*w1;
1510 double k3 = PV[ 1]*w1+PV[ 2]*w2;
1511 double k4 = PV[ 3]*w0+PV[ 4]*w1;
1512 double k5 = PV[ 3]*w1+PV[ 4]*w2;
1513 double k6 = PV[ 6]*w0+PV[ 7]*w1;
1514 double k7 = PV[ 6]*w1+PV[ 7]*w2;
1515 double k8 = PV[10]*w0+PV[11]*w1;
1516 double k9 = PV[10]*w1+PV[11]*w2;
1519 k0=-
k0; k1=-k1; k2=-k2; k3=-k3; k4=-k4;
1520 k5=-k5; k6=-k6; k7=-k7; k8=-k8; k9=-k9;
1525 P[0]+=(
k0*r0+k1*r1);
1526 P[1]+=(k2*r0+k3*r1);
1527 P[2]+=(k4*r0+k5*r1);
1528 P[3]+=(k6*r0+k7*r1);
1529 P[4]+=(k8*r0+k9*r1);
1530 if(
X) xi2 = (r0*r0*w0+r1*r1*w2+2.*r0*r1*w1);
1542 (
int O,
bool X,
double* M,
double* MV,
double*
P,
double* PV,
double& xi2)
const
1546 double sa = MV[0]+MV[2] ;
1547 double d = MV[0]*MV[2]-MV[1]*MV[1];
1549 double V0 =
ds*(1.+
ds/sa) ;
1551 double dV = 1./(V0-V1) ;
1552 double sc = MV[1]*dV ;
1553 double al = (MV[0]-MV[2])*dV ;
1554 double s2 = .5*(1.-al) ;
1556 double c = sqrt(
c2) ;
1561 double M0 =
c*M[0]+
s*M[1];
1562 M [ 1] =
c*M[1]-
s*M[0];
1571 P [ 0] =
c*P0 +
s*
P[1] ;
1572 P [ 1] =
c*
P[1]-
s*P0 ;
1573 double B = 2.*
sc*PV[ 1] ;
1574 double PV0 = PV[ 0] ;
1575 double PV3 = PV[ 3] ;
1576 double PV6 = PV[ 6] ;
1577 double PV10= PV[10] ;
1578 PV[ 0] =
c2*PV0+
s2*PV[ 2]+B ;
1579 PV[ 1] =
sc*(PV[ 2]-PV0)+PV[ 1]*al;
1580 PV[ 2] =
s2*PV0+
c2*PV[ 2]-B ;
1581 PV[ 3] =
c*PV3 +
s*PV[ 4] ;
1582 PV[ 4] =
c*PV[ 4]-
s*PV3 ;
1583 PV[ 6] =
c*PV6 +
s*PV[ 7] ;
1584 PV[ 7] =
c*PV[ 7]-
s*PV6 ;
1585 PV[10] =
c*PV10 +
s*PV[11] ;
1586 PV[11] =
c*PV[11]-
s*PV10 ;
1588 if(!updateWithOneDimWithBoundary(O,
X,M,MV,
P,PV,xi2))
return false;
1595 P [ 0] =
c*P0 +
s*
P[1] ;
1596 P [ 1] =
c*
P[1]-
s*P0 ;
1602 PV[ 0] =
c2*PV0+
s2*PV[ 2]+B ;
1603 PV[ 1] =
sc*(PV[ 2]-PV0)+PV[ 1]*al;
1604 PV[ 2] =
s2*PV0+
c2*PV[ 2]-B ;
1605 PV[ 3] =
c*PV3 +
s*PV[ 4] ;
1606 PV[ 4] =
c*PV[ 4]-
s*PV3 ;
1607 PV[ 6] =
c*PV6 +
s*PV[ 7] ;
1608 PV[ 7] =
c*PV[ 7]-
s*PV6 ;
1609 PV[10] =
c*PV10 +
s*PV[11] ;
1610 PV[11] =
c*PV[11]-
s*PV10 ;
1621 (
bool X,
double* M,
double* MV,
double*
P,
double* PV,
double& xi2)
1626 double w[15]={MV[ 0]+PV[ 0],MV[ 1]+PV[ 1],MV[ 2]+PV[ 2],
1627 MV[ 3]+PV[ 3],MV[ 4]+PV[ 4],MV[ 5]+PV[ 5],
1628 MV[ 6]+PV[ 6],MV[ 7]+PV[ 7],MV[ 8]+PV[ 8],
1629 MV[ 9]+PV[ 9],MV[10]+PV[10],MV[11]+PV[11],
1630 MV[12]+PV[12],MV[13]+PV[13],MV[14]+PV[14]};
1632 if(!invert5(
w,
w))
return false;
1634 double k00 =(PV[ 0]*
w[ 0]+PV[ 1]*
w[ 1]+PV[ 3]*
w[ 3])+(PV[ 6]*
w[ 6]+PV[10]*
w[10]);
1635 double k01 =(PV[ 0]*
w[ 1]+PV[ 1]*
w[ 2]+PV[ 3]*
w[ 4])+(PV[ 6]*
w[ 7]+PV[10]*
w[11]);
1636 double k02 =(PV[ 0]*
w[ 3]+PV[ 1]*
w[ 4]+PV[ 3]*
w[ 5])+(PV[ 6]*
w[ 8]+PV[10]*
w[12]);
1637 double k03 =(PV[ 0]*
w[ 6]+PV[ 1]*
w[ 7]+PV[ 3]*
w[ 8])+(PV[ 6]*
w[ 9]+PV[10]*
w[13]);
1638 double k04 =(PV[ 0]*
w[10]+PV[ 1]*
w[11]+PV[ 3]*
w[12])+(PV[ 6]*
w[13]+PV[10]*
w[14]);
1639 double k10 =(PV[ 1]*
w[ 0]+PV[ 2]*
w[ 1]+PV[ 4]*
w[ 3])+(PV[ 7]*
w[ 6]+PV[11]*
w[10]);
1640 double k11 =(PV[ 1]*
w[ 1]+PV[ 2]*
w[ 2]+PV[ 4]*
w[ 4])+(PV[ 7]*
w[ 7]+PV[11]*
w[11]);
1641 double k12 =(PV[ 1]*
w[ 3]+PV[ 2]*
w[ 4]+PV[ 4]*
w[ 5])+(PV[ 7]*
w[ 8]+PV[11]*
w[12]);
1642 double k13 =(PV[ 1]*
w[ 6]+PV[ 2]*
w[ 7]+PV[ 4]*
w[ 8])+(PV[ 7]*
w[ 9]+PV[11]*
w[13]);
1643 double k14 =(PV[ 1]*
w[10]+PV[ 2]*
w[11]+PV[ 4]*
w[12])+(PV[ 7]*
w[13]+PV[11]*
w[14]);
1644 double k20 =(PV[ 3]*
w[ 0]+PV[ 4]*
w[ 1]+PV[ 5]*
w[ 3])+(PV[ 8]*
w[ 6]+PV[12]*
w[10]);
1645 double k21 =(PV[ 3]*
w[ 1]+PV[ 4]*
w[ 2]+PV[ 5]*
w[ 4])+(PV[ 8]*
w[ 7]+PV[12]*
w[11]);
1646 double k22 =(PV[ 3]*
w[ 3]+PV[ 4]*
w[ 4]+PV[ 5]*
w[ 5])+(PV[ 8]*
w[ 8]+PV[12]*
w[12]);
1647 double k23 =(PV[ 3]*
w[ 6]+PV[ 4]*
w[ 7]+PV[ 5]*
w[ 8])+(PV[ 8]*
w[ 9]+PV[12]*
w[13]);
1648 double k24 =(PV[ 3]*
w[10]+PV[ 4]*
w[11]+PV[ 5]*
w[12])+(PV[ 8]*
w[13]+PV[12]*
w[14]);
1649 double k30 =(PV[ 6]*
w[ 0]+PV[ 7]*
w[ 1]+PV[ 8]*
w[ 3])+(PV[ 9]*
w[ 6]+PV[13]*
w[10]);
1650 double k31 =(PV[ 6]*
w[ 1]+PV[ 7]*
w[ 2]+PV[ 8]*
w[ 4])+(PV[ 9]*
w[ 7]+PV[13]*
w[11]);
1651 double k32 =(PV[ 6]*
w[ 3]+PV[ 7]*
w[ 4]+PV[ 8]*
w[ 5])+(PV[ 9]*
w[ 8]+PV[13]*
w[12]);
1652 double k33 =(PV[ 6]*
w[ 6]+PV[ 7]*
w[ 7]+PV[ 8]*
w[ 8])+(PV[ 9]*
w[ 9]+PV[13]*
w[13]);
1653 double k34 =(PV[ 6]*
w[10]+PV[ 7]*
w[11]+PV[ 8]*
w[12])+(PV[ 9]*
w[13]+PV[13]*
w[14]);
1654 double k40 =(PV[10]*
w[ 0]+PV[11]*
w[ 1]+PV[12]*
w[ 3])+(PV[13]*
w[ 6]+PV[14]*
w[10]);
1655 double k41 =(PV[10]*
w[ 1]+PV[11]*
w[ 2]+PV[12]*
w[ 4])+(PV[13]*
w[ 7]+PV[14]*
w[11]);
1656 double k42 =(PV[10]*
w[ 3]+PV[11]*
w[ 4]+PV[12]*
w[ 5])+(PV[13]*
w[ 8]+PV[14]*
w[12]);
1657 double k43 =(PV[10]*
w[ 6]+PV[11]*
w[ 7]+PV[12]*
w[ 8])+(PV[13]*
w[ 9]+PV[14]*
w[13]);
1658 double k44 =(PV[10]*
w[10]+PV[11]*
w[11]+PV[12]*
w[12])+(PV[13]*
w[13]+PV[14]*
w[14]);
1662 double r[5]={M[0]-
P[0],M[1]-
P[1],M[2]-
P[2],M[3]-
P[3],M[4]-
P[4]};
1673 double p0 =(k00*
r[0]+k01*
r[1]+k02*
r[2])+(k03*
r[3]+k04*
r[4]);
P[0]+=
p0;
1674 double p1 =(k10*
r[0]+k11*
r[1]+k12*
r[2])+(k13*
r[3]+k14*
r[4]);
P[1]+=
p1;
1675 double p2 =(k20*
r[0]+k21*
r[1]+k22*
r[2])+(k23*
r[3]+k24*
r[4]);
P[2]+=
p2;
1676 double p3 =(k30*
r[0]+k31*
r[1]+k32*
r[2])+(k33*
r[3]+k34*
r[4]);
P[3]+=
p3;
1677 double p4 =(k40*
r[0]+k41*
r[1]+k42*
r[2])+(k43*
r[3]+k44*
r[4]);
P[4]+=p4;
1681 double v0 =(k00*PV[ 0]+k01*PV[ 1]+k02*PV[ 3])+(k03*PV[ 6]+k04*PV[10]);
1682 double v1 =(k10*PV[ 0]+k11*PV[ 1]+k12*PV[ 3])+(k13*PV[ 6]+k14*PV[10]);
1683 double v2 =(k10*PV[ 1]+k11*PV[ 2]+k12*PV[ 4])+(k13*PV[ 7]+k14*PV[11]);
1684 double v3 =(k20*PV[ 0]+k21*PV[ 1]+k22*PV[ 3])+(k23*PV[ 6]+k24*PV[10]);
1685 double v4 =(k20*PV[ 1]+k21*PV[ 2]+k22*PV[ 4])+(k23*PV[ 7]+k24*PV[11]);
1686 double v5 =(k20*PV[ 3]+k21*PV[ 4]+k22*PV[ 5])+(k23*PV[ 8]+k24*PV[12]);
1687 double v6 =(k30*PV[ 0]+k31*PV[ 1]+k32*PV[ 3])+(k33*PV[ 6]+k34*PV[10]);
1688 double v7 =(k30*PV[ 1]+k31*PV[ 2]+k32*PV[ 4])+(k33*PV[ 7]+k34*PV[11]);
1689 double v8 =(k30*PV[ 3]+k31*PV[ 4]+k32*PV[ 5])+(k33*PV[ 8]+k34*PV[12]);
1690 double v9 =(k30*PV[ 6]+k31*PV[ 7]+k32*PV[ 8])+(k33*PV[ 9]+k34*PV[13]);
1691 double v10 =(k40*PV[ 0]+k41*PV[ 1]+k42*PV[ 3])+(k43*PV[ 6]+k44*PV[10]);
1692 double v11 =(k40*PV[ 1]+k41*PV[ 2]+k42*PV[ 4])+(k43*PV[ 7]+k44*PV[11]);
1693 double v12 =(k40*PV[ 3]+k41*PV[ 4]+k42*PV[ 5])+(k43*PV[ 8]+k44*PV[12]);
1694 double v13 =(k40*PV[ 6]+k41*PV[ 7]+k42*PV[ 8])+(k43*PV[ 9]+k44*PV[13]);
1695 double v14 =(k40*PV[10]+k41*PV[11]+k42*PV[12])+(k43*PV[13]+k44*PV[14]);
1697 if((PV[ 0]-=
v0 )<=0.)
return false;
1699 if((PV[ 2]-=
v2 )<=0.)
return false;
1702 if((PV[ 5]-=v5 )<=0.)
return false;
1706 if((PV[ 9]-=v9 )<=0.)
return false;
1711 if((PV[14]-=v14)<=0.)
return false;
1713 if(
X) xi2 = Xi2(5,
r,
w);
1724 (
int O,
bool X,
double* M,
const double* MV,
double*
P,
double* PV,
double& xi2,
1728 double w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.};
1732 if(O>0) {
s= 1.;
for(
int i=
ib;
i!=
ie; ++
i) {
w[
i-
ib] = MV[
i-
ib]+PV[m_map[
i]];}}
1735 if(
N==1)
w[0] = 1./
w[0];
else if(!invert(
N,
w,
w))
return false;
1736 double v[15]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
1739 double k00 =((PV[ 0]*
v[ 0]+PV[ 1]*
v[ 1]+PV[ 3]*
v[ 3])+(PV[ 6]*
v[ 6]+PV[10]*
v[10]))*
s;
1740 double k01 =((PV[ 0]*
v[ 1]+PV[ 1]*
v[ 2]+PV[ 3]*
v[ 4])+(PV[ 6]*
v[ 7]+PV[10]*
v[11]))*
s;
1741 double k02 =((PV[ 0]*
v[ 3]+PV[ 1]*
v[ 4]+PV[ 3]*
v[ 5])+(PV[ 6]*
v[ 8]+PV[10]*
v[12]))*
s;
1742 double k03 =((PV[ 0]*
v[ 6]+PV[ 1]*
v[ 7]+PV[ 3]*
v[ 8])+(PV[ 6]*
v[ 9]+PV[10]*
v[13]))*
s;
1743 double k04 =((PV[ 0]*
v[10]+PV[ 1]*
v[11]+PV[ 3]*
v[12])+(PV[ 6]*
v[13]+PV[10]*
v[14]))*
s;
1744 double k10 =((PV[ 1]*
v[ 0]+PV[ 2]*
v[ 1]+PV[ 4]*
v[ 3])+(PV[ 7]*
v[ 6]+PV[11]*
v[10]))*
s;
1745 double k11 =((PV[ 1]*
v[ 1]+PV[ 2]*
v[ 2]+PV[ 4]*
v[ 4])+(PV[ 7]*
v[ 7]+PV[11]*
v[11]))*
s;
1746 double k12 =((PV[ 1]*
v[ 3]+PV[ 2]*
v[ 4]+PV[ 4]*
v[ 5])+(PV[ 7]*
v[ 8]+PV[11]*
v[12]))*
s;
1747 double k13 =((PV[ 1]*
v[ 6]+PV[ 2]*
v[ 7]+PV[ 4]*
v[ 8])+(PV[ 7]*
v[ 9]+PV[11]*
v[13]))*
s;
1748 double k14 =((PV[ 1]*
v[10]+PV[ 2]*
v[11]+PV[ 4]*
v[12])+(PV[ 7]*
v[13]+PV[11]*
v[14]))*
s;
1749 double k20 =((PV[ 3]*
v[ 0]+PV[ 4]*
v[ 1]+PV[ 5]*
v[ 3])+(PV[ 8]*
v[ 6]+PV[12]*
v[10]))*
s;
1750 double k21 =((PV[ 3]*
v[ 1]+PV[ 4]*
v[ 2]+PV[ 5]*
v[ 4])+(PV[ 8]*
v[ 7]+PV[12]*
v[11]))*
s;
1751 double k22 =((PV[ 3]*
v[ 3]+PV[ 4]*
v[ 4]+PV[ 5]*
v[ 5])+(PV[ 8]*
v[ 8]+PV[12]*
v[12]))*
s;
1752 double k23 =((PV[ 3]*
v[ 6]+PV[ 4]*
v[ 7]+PV[ 5]*
v[ 8])+(PV[ 8]*
v[ 9]+PV[12]*
v[13]))*
s;
1753 double k24 =((PV[ 3]*
v[10]+PV[ 4]*
v[11]+PV[ 5]*
v[12])+(PV[ 8]*
v[13]+PV[12]*
v[14]))*
s;
1754 double k30 =((PV[ 6]*
v[ 0]+PV[ 7]*
v[ 1]+PV[ 8]*
v[ 3])+(PV[ 9]*
v[ 6]+PV[13]*
v[10]))*
s;
1755 double k31 =((PV[ 6]*
v[ 1]+PV[ 7]*
v[ 2]+PV[ 8]*
v[ 4])+(PV[ 9]*
v[ 7]+PV[13]*
v[11]))*
s;
1756 double k32 =((PV[ 6]*
v[ 3]+PV[ 7]*
v[ 4]+PV[ 8]*
v[ 5])+(PV[ 9]*
v[ 8]+PV[13]*
v[12]))*
s;
1757 double k33 =((PV[ 6]*
v[ 6]+PV[ 7]*
v[ 7]+PV[ 8]*
v[ 8])+(PV[ 9]*
v[ 9]+PV[13]*
v[13]))*
s;
1758 double k34 =((PV[ 6]*
v[10]+PV[ 7]*
v[11]+PV[ 8]*
v[12])+(PV[ 9]*
v[13]+PV[13]*
v[14]))*
s;
1759 double k40 =((PV[10]*
v[ 0]+PV[11]*
v[ 1]+PV[12]*
v[ 3])+(PV[13]*
v[ 6]+PV[14]*
v[10]))*
s;
1760 double k41 =((PV[10]*
v[ 1]+PV[11]*
v[ 2]+PV[12]*
v[ 4])+(PV[13]*
v[ 7]+PV[14]*
v[11]))*
s;
1761 double k42 =((PV[10]*
v[ 3]+PV[11]*
v[ 4]+PV[12]*
v[ 5])+(PV[13]*
v[ 8]+PV[14]*
v[12]))*
s;
1762 double k43 =((PV[10]*
v[ 6]+PV[11]*
v[ 7]+PV[12]*
v[ 8])+(PV[13]*
v[ 9]+PV[14]*
v[13]))*
s;
1763 double k44 =((PV[10]*
v[10]+PV[11]*
v[11]+PV[12]*
v[12])+(PV[13]*
v[13]+PV[14]*
v[14]))*
s;
1767 double r[5]; differenceLocPar(K,M,
P,
r);
1771 double p0 =(k00*
r[0]+k01*
r[1]+k02*
r[2])+(k03*
r[3]+k04*
r[4]);
P[0]+=
p0;
1772 double p1 =(k10*
r[0]+k11*
r[1]+k12*
r[2])+(k13*
r[3]+k14*
r[4]);
P[1]+=
p1;
1773 double p2 =(k20*
r[0]+k21*
r[1]+k22*
r[2])+(k23*
r[3]+k24*
r[4]);
P[2]+=
p2;
1774 double p3 =(k30*
r[0]+k31*
r[1]+k32*
r[2])+(k33*
r[3]+k34*
r[4]);
P[3]+=
p3;
1775 double p4 =(k40*
r[0]+k41*
r[1]+k42*
r[2])+(k43*
r[3]+k44*
r[4]);
P[4]+=p4;
1779 double v0 =(k00*PV[ 0]+k01*PV[ 1]+k02*PV[ 3])+(k03*PV[ 6]+k04*PV[10]);
1780 double v1 =(k10*PV[ 0]+k11*PV[ 1]+k12*PV[ 3])+(k13*PV[ 6]+k14*PV[10]);
1781 double v2 =(k10*PV[ 1]+k11*PV[ 2]+k12*PV[ 4])+(k13*PV[ 7]+k14*PV[11]);
1782 double v3 =(k20*PV[ 0]+k21*PV[ 1]+k22*PV[ 3])+(k23*PV[ 6]+k24*PV[10]);
1783 double v4 =(k20*PV[ 1]+k21*PV[ 2]+k22*PV[ 4])+(k23*PV[ 7]+k24*PV[11]);
1784 double v5 =(k20*PV[ 3]+k21*PV[ 4]+k22*PV[ 5])+(k23*PV[ 8]+k24*PV[12]);
1785 double v6 =(k30*PV[ 0]+k31*PV[ 1]+k32*PV[ 3])+(k33*PV[ 6]+k34*PV[10]);
1786 double v7 =(k30*PV[ 1]+k31*PV[ 2]+k32*PV[ 4])+(k33*PV[ 7]+k34*PV[11]);
1787 double v8 =(k30*PV[ 3]+k31*PV[ 4]+k32*PV[ 5])+(k33*PV[ 8]+k34*PV[12]);
1788 double v9 =(k30*PV[ 6]+k31*PV[ 7]+k32*PV[ 8])+(k33*PV[ 9]+k34*PV[13]);
1789 double v10 =(k40*PV[ 0]+k41*PV[ 1]+k42*PV[ 3])+(k43*PV[ 6]+k44*PV[10]);
1790 double v11 =(k40*PV[ 1]+k41*PV[ 2]+k42*PV[ 4])+(k43*PV[ 7]+k44*PV[11]);
1791 double v12 =(k40*PV[ 3]+k41*PV[ 4]+k42*PV[ 5])+(k43*PV[ 8]+k44*PV[12]);
1792 double v13 =(k40*PV[ 6]+k41*PV[ 7]+k42*PV[ 8])+(k43*PV[ 9]+k44*PV[13]);
1793 double v14 =(k40*PV[10]+k41*PV[11]+k42*PV[12])+(k43*PV[13]+k44*PV[14]);
1795 PV[ 1]-=v1 ; PV[ 2]-=
v2 ;
1796 PV[ 3]-=v3 ; PV[ 4]-=v4 ; PV[ 5]-=v5 ;
1797 PV[ 6]-=v6 ; PV[ 7]-=v7 ; PV[ 8]-=v8 ; PV[ 9]-=v9 ;
1798 PV[10]-=v10; PV[11]-=v11; PV[12]-=v12; PV[13]-=v13; PV[14]-=v14;
1800 if(PV[0]<=0.||PV[2]<=0.||PV[5]<=0.||PV[9]<=0.||PV[14]<=0.)
return false;
1802 if(
X) xi2 = Xi2(5,
r,
v);
1814 P[0] = T.parameters()[0];
1815 P[1] = T.parameters()[1];
1816 P[2] = T.parameters()[2];
1817 P[3] = T.parameters()[3];
1818 P[4] = T.parameters()[4];
1822 if(!
v)
return false;
1859 if(!T.iscovariance())
return false;
1889 int&
N,
int& K,
double*
P,
double* V)
1892 N = C.rows();
if(
N==0 ||
N>5 || L.
dimension()!=
N)
return false;
1902 V[ 1]=C(1,0); V[ 2]=C(1,1);
1906 V[ 3]=C(2,0); V[ 4]=C(2,1); V[ 5]=C(2,2);
1910 V[ 6]=C(3,0); V[ 7]=C(3,1); V[ 8]=C(3,2); V[ 9]=C(3,3);
1914 V[10]=C(4,0); V[11]=C(4,1); V[12]=C(4,2); V[13]=C(4,3); V[14]=C(4,4);
1927 e<< V[ 0],V[ 1],V[ 3],V[ 6],V[10],
1928 V[ 1],V[ 2],V[ 4],V[ 7],V[11],
1929 V[ 3],V[ 4],V[ 5],V[ 8],V[12],
1930 V[ 6],V[ 7],V[ 8],V[ 9],V[13],
1931 V[10],V[11],V[12],V[13],V[14];
1932 return T.associatedSurface().createUniqueTrackParameters(
P[0],
P[1],
P[2],
P[3],
P[4],std::move(
e));
1946 if(
n==2)
return invert2(
a,
b);
1947 if(
n==3)
return invert3(
a,
b);
1948 if(
n==4)
return invert4(
a,
b);
1949 if(
n==5)
return invert5(
a,
b);
1965 double d =
a[0]*
a[2]-
a[1]*
a[1];
if(
d<=0.)
return false;
d=1./
d;
1986 double b0 = (
a[2]*
a[5]-
a[4]*
a[4]);
1987 double b1 =-(
a[1]*
a[5]-
a[3]*
a[4]);
1988 double b2 = (
a[0]*
a[5]-
a[3]*
a[3]);
1989 double b3 = (
a[1]*
a[4]-
a[2]*
a[3]);
1990 double b4 =-(
a[0]*
a[4]-
a[1]*
a[3]);
1991 double b5 = (
a[0]*
a[2]-
a[1]*
a[1]);
1992 double d =
a[0]*b0+
a[1]*b1+
a[3]*b3;
if(
d<=0.)
return false;
2016 double d00 =
a[1]*
a[4]-
a[2]*
a[3];
2017 double d01 =
a[1]*
a[5]-
a[4]*
a[3];
2018 double d02 =
a[2]*
a[5]-
a[4]*
a[4];
2019 double d03 =
a[1]*
a[7]-
a[2]*
a[6];
2020 double d04 =
a[1]*
a[8]-
a[4]*
a[6];
2021 double d05 =
a[1]*
a[9]-
a[7]*
a[6];
2022 double d06 =
a[2]*
a[8]-
a[4]*
a[7];
2023 double d07 =
a[2]*
a[9]-
a[7]*
a[7];
2024 double d08 =
a[3]*
a[7]-
a[4]*
a[6];
2025 double d09 =
a[3]*
a[8]-
a[5]*
a[6];
2026 double d10 =
a[3]*
a[9]-
a[8]*
a[6];
2027 double d11 =
a[4]*
a[8]-
a[5]*
a[7];
2028 double d12 =
a[4]*
a[9]-
a[8]*
a[7];
2029 double d13 =
a[5]*
a[9]-
a[8]*
a[8];
2033 double c0 =
a[2]*d13-
a[4]*d12+
a[7]*d11;
2034 double c1 =
a[1]*d13-
a[4]*d10+
a[7]*d09;
2035 double c2 =
a[1]*d12-
a[2]*d10+
a[7]*d08;
2036 double c3 =
a[1]*d11-
a[2]*d09+
a[4]*d08;
2039 if (
det <= 0.)
return false;
2042 b[2] = (
a[0]*d13-
a[3]*d10+
a[6]*d09)*
det;
2043 b[4] = -(
a[0]*d12-
a[1]*d10+
a[6]*d08)*
det;
2044 b[5] = (
a[0]*d07-
a[1]*d05+
a[6]*d03)*
det;
2045 b[7] = (
a[0]*d11-
a[1]*d09+
a[3]*d08)*
det;
2046 b[8] = -(
a[0]*d06-
a[1]*d04+
a[3]*d03)*
det;
2047 b[9] = (
a[0]*d02-
a[1]*d01+
a[3]*d00)*
det;
2071 if(
a[ 0] <=0.)
return false;
2072 double x1 = 1./
a[ 0];
2073 double x2 =-
a[ 1]*
x1;
2074 double x3 =-
a[ 3]*
x1;
2075 double x4 =-
a[ 6]*
x1;
2076 double x5 =-
a[10]*
x1;
2077 double b0 =
a[ 2]+
a[ 1]*
x2;
if(b0<=0.)
return false;
2078 double b1 =
a[ 4]+
a[ 3]*
x2;
2079 double b2 =
a[ 5]+
a[ 3]*x3;
2080 double b3 =
a[ 7]+
a[ 6]*
x2;
2081 double b4 =
a[ 8]+
a[ 6]*x3;
2082 double b5 =
a[ 9]+
a[ 6]*x4;
2083 double b6 =
a[11]+
a[10]*
x2;
2084 double b7 =
a[12]+
a[10]*x3;
2085 double b8 =
a[13]+
a[10]*x4;
2086 double b9 =
a[14]+
a[10]*x5;
2093 if((b0 = b2+b1*
y2) <=0.)
return false;
2108 if((b0 = b2+b1*
x2) <=0.)
return false;
2123 if((b0 = b2+b1*
y2) <=0.)
return false;
2138 b[ 0] = b2+b1*
b[10];
2139 b[ 1] = b4+b3*
b[10];
2140 b[ 2] = b5+b3*
b[11];
2141 b[ 3] = b7+b6*
b[10];
2142 b[ 4] = b8+b6*
b[11];
2143 b[ 5] = b9+b6*
b[12];
2144 b[ 6] = y3+
y2*
b[10];
2145 b[ 7] = y4+
y2*
b[11];
2146 b[ 8] = y5+
y2*
b[12];
2158 if(
N==1)
return Xi2for1(R,
W);
2159 if(
N==2)
return Xi2for2(R,
W);
2160 if(
N==3)
return Xi2for3(R,
W);
2161 if(
N==4)
return Xi2for4(R,
W);
2162 if(
N==5)
return Xi2for5(R,
W);
2173 double Xi2 = R[0]*
W[0]*R[0];
2185 (R[0]*
W[ 0]+R[1]*
W[ 1])*R[0]+
2186 (R[0]*
W[ 1]+R[1]*
W[ 2])*R[1];
2198 (R[0]*
W[ 0]+R[1]*
W[ 1]+R[2]*
W[ 3])*R[0]+
2199 (R[0]*
W[ 1]+R[1]*
W[ 2]+R[2]*
W[ 4])*R[1]+
2200 (R[0]*
W[ 3]+R[1]*
W[ 4]+R[2]*
W[ 5])*R[2];
2212 ((R[0]*
W[ 0]+R[1]*
W[ 1])+(R[2]*
W[ 3]+R[3]*
W[ 6]))*R[0]+
2213 ((R[0]*
W[ 1]+R[1]*
W[ 2])+(R[2]*
W[ 4]+R[3]*
W[ 7]))*R[1]+
2214 ((R[0]*
W[ 3]+R[1]*
W[ 4])+(R[2]*
W[ 5]+R[3]*
W[ 8]))*R[2]+
2215 ((R[0]*
W[ 6]+R[1]*
W[ 7])+(R[2]*
W[ 8]+R[3]*
W[ 9]))*R[3];
2227 ((R[0]*
W[ 0]+R[1]*
W[ 1]+R[2]*
W[ 3])+(R[3]*
W[ 6]+R[4]*
W[10]))*R[0]+
2228 ((R[0]*
W[ 1]+R[1]*
W[ 2]+R[2]*
W[ 4])+(R[3]*
W[ 7]+R[4]*
W[11]))*R[1]+
2229 ((R[0]*
W[ 3]+R[1]*
W[ 4]+R[2]*
W[ 5])+(R[3]*
W[ 8]+R[4]*
W[12]))*R[2]+
2230 ((R[0]*
W[ 6]+R[1]*
W[ 7]+R[2]*
W[ 8])+(R[3]*
W[ 9]+R[4]*
W[13]))*R[3]+
2231 ((R[0]*
W[10]+R[1]*
W[11]+R[2]*
W[12])+(R[3]*
W[13]+R[4]*
W[14]))*R[4];
2241 (
int K,
const double* L,
const double* T,
double* R)
2247 if(K & 1) {R[
i]=L[
i]-T[0]; ++
i;}
2248 if(K & 2) {R[
i]=L[
i]-T[1]; ++
i;}
2261 if(K & 16) {R[
i]=L[
i]-T[4]; ++
i;}
2271 (
int K,
const double* L,
const double* T,
double* R)
2276 R[0]=0.;
if(K & 1) R[0]=L[
i++]-T[0];
2277 R[1]=0.;
if(K & 2) R[1]=L[
i++]-T[1];
2278 R[2]=0.;
if(K & 4) {
2280 if (R[2] >
pi) R[2] = fmod(R[2]+
pi,
pi2)-
pi;
2281 else if(R[2] <-
pi) R[2] = fmod(R[2]-
pi,
pi2)+
pi;
2285 if (R[3] >
pi) R[3] = fmod(R[3]+
pi,
pi2)-
pi;
2286 else if(R[3] <-
pi) R[3] = fmod(R[3]-
pi,
pi2)+
pi;
2288 R[4]=0.;
if(K & 16) R[4]=L[
i++]-T[4];
2297 int n=0; m_key[0]=m_key[1]=0;
2299 for(
int K=1; K!= 32; ++K) {
2301 unsigned int I[5]={0,0,0,0,0};
2303 for(
int i=0;
i!=5; ++
i) {
if((K>>
i)&1)
I[
i]=1;}
2305 for(
int i=0;
i!=5; ++
i) {
2306 for(
int j=0; j<=
i; ++j) {
if(
I[
i] &&
I[j]) {m_map[
n++] =
m;} ++
m;}