72 vec4 Pmult1_2 = {
P[3],
P[4],
P[5],
P[42]};
73 vec2 Pmult3 = {
P[43],
P[44]};
75 vec4 dXdL0_dYdL0_dZdL0_dAxdL0;
76 vload(dXdL0_dYdL0_dZdL0_dAxdL0, &
P[7]);
78 vload(dAydL0_dAzdL0, &
P[11]);
79 dXdL0_dYdL0_dZdL0_dAxdL0 -=
s0 * Pmult1_2;
80 dAydL0_dAzdL0 -=
s0 * Pmult3;
81 vstore(&
P[7], dXdL0_dYdL0_dZdL0_dAxdL0);
84 vec4 dXdL1_dYdL1_dZdL1_dAxdL1;
85 vload(dXdL1_dYdL1_dZdL1_dAxdL1, &
P[14]);
87 vload(dAydL1_dAzdL1, &
P[18]);
88 dXdL1_dYdL1_dZdL1_dAxdL1 -=
s1 * Pmult1_2;
89 dAydL1_dAzdL1 -=
s1 * Pmult3;
90 vstore(&
P[14], dXdL1_dYdL1_dZdL1_dAxdL1);
93 vec4 dXdPhi_dYdPhi_dZdPhi_dAxdPhi;
94 vload(dXdPhi_dYdPhi_dZdPhi_dAxdPhi, &
P[21]);
96 vload(dAydPhi_dAzdPhi, &
P[25]);
97 dXdPhi_dYdPhi_dZdPhi_dAxdPhi -=
s2 * Pmult1_2;
98 dAydPhi_dAzdPhi -=
s2 * Pmult3;
99 vstore(&
P[21], dXdPhi_dYdPhi_dZdPhi_dAxdPhi);
100 vstore(&
P[25], dAydPhi_dAzdPhi);
102 vec4 dXdTheta_dYdTheta_dZdTheta_dAxdTheta;
103 vload(dXdTheta_dYdTheta_dZdTheta_dAxdTheta, &
P[28]);
104 vec2 dAydTheta_dAzdTheta;
105 vload(dAydTheta_dAzdTheta, &
P[32]);
106 dXdTheta_dYdTheta_dZdTheta_dAxdTheta -=
s3 * Pmult1_2;
107 dAydTheta_dAzdTheta -=
s3 * Pmult3;
108 vstore(&
P[28], dXdTheta_dYdTheta_dZdTheta_dAxdTheta);
109 vstore(&
P[32], dAydTheta_dAzdTheta);
111 vec4 dXdCM_dYdCM_dZdCM_dAxdCM;
112 vload(dXdCM_dYdCM_dZdCM_dAxdCM, &
P[35]);
114 vload(AydCM_dAzdCM, &
P[39]);
115 dXdCM_dYdCM_dZdCM_dAxdCM -=
s4 * Pmult1_2;
116 AydCM_dAzdCM -=
s4 * Pmult3;
117 vstore(&
P[35], dXdCM_dYdCM_dZdCM_dAxdCM);
166 vec4 P0 = {
P[0],
P[7],
P[14],
P[21] };
167 vec4
res = V[0] * P0;
169 vec4 P1 = {
P[1],
P[8],
P[15],
P[22] };
172 vec4 P2 = {
P[2],
P[9],
P[16],
P[23] };
178 Jac[4] = V[0] *
P[28] + V[1] *
P[29] + V[2] *
P[30];
188 const double* Ax =
T.matrix().col(0).data();
189 const double* Ay =
T.matrix().col(1).data();
191 const double d[3] = {
P[0] -
T(0, 3),
P[1] -
T(1, 3),
P[2] -
T(2, 3) };
193 par[0] =
d[0] * Ax[0] +
d[1] * Ax[1] +
d[2] * Ax[2];
194 par[1] =
d[0] * Ay[0] +
d[1] * Ay[1] +
d[2] * Ay[2];
201 double S[3] = {
T(0, 2),
T(1, 2),
T(2, 2) };
203 double A =
P[3] *
S[0] +
P[4] *
S[1] +
P[5] *
S[2];
211 mult3x5Helper(
s,
S, &
P[7]);
212 globalToLocalVecHelper(
P,
s[0],
s[1],
s[2],
s[3],
s[4]);
214 mult3x5Helper(&Jac[0], Ax, &
P[7]);
215 mult3x5Helper(&Jac[5], Ay, &
P[7]);
229 const double* Ax =
T.matrix().col(0).data();
230 const double* Ay =
T.matrix().col(1).data();
232 const double d[3] = {
P[0] -
T(0, 3),
P[1] -
T(1, 3),
P[2] -
T(2, 3) };
234 const double RC =
d[0] * Ax[0] +
d[1] * Ax[1] +
d[2] * Ax[2];
235 const double RS =
d[0] * Ay[0] +
d[1] * Ay[1] +
d[2] * Ay[2];
236 const double R2 = RC * RC + RS * RS;
237 par[0] = std::sqrt(R2);
238 par[1] = atan2(RS, RC);
245 double S[3] = {
T(0, 2),
T(1, 2),
T(2, 2) };
247 double A =
P[3] *
S[0] +
P[4] *
S[1] +
P[5] *
S[2];
255 mult3x5Helper(
s,
S, &
P[7]);
256 globalToLocalVecHelper(
P,
s[0],
s[1],
s[2],
s[3],
s[4]);
259 double Ri = 1. /
par[0];
261 const double Av[3] = { (RC * Ax[0] + RS * Ay[0]) * Ri,
262 (RC * Ax[1] + RS * Ay[1]) * Ri,
263 (RC * Ax[2] + RS * Ay[2]) * Ri };
264 const double Bv[3] = { (RC * Ay[0] - RS * Ax[0]) * (Ri = 1. / R2),
265 (RC * Ay[1] - RS * Ax[1]) * Ri,
266 (RC * Ay[2] - RS * Ax[2]) * Ri };
268 mult3x5Helper(&Jac[0], Av, &
P[7]);
269 mult3x5Helper(&Jac[5], Bv, &
P[7]);
283 const double* Ax =
T.matrix().col(0).data();
284 const double* Ay =
T.matrix().col(1).data();
285 const double* Az =
T.matrix().col(2).data();
287 double x =
P[0] -
T(0, 3);
288 double y =
P[1] -
T(1, 3);
289 double z =
P[2] -
T(2, 3);
290 double RC =
x * Ax[0] +
y * Ax[1] +
z * Ax[2];
291 double RS =
x * Ay[0] +
y * Ay[1] +
z * Ay[2];
292 par[0] = atan2(RS, RC) *
R;
293 par[1] =
x * Az[0] +
y * Az[1] +
z * Az[2];
301 double C =
P[3] * Az[0] +
P[4] * Az[1] +
P[5] * Az[2];
302 const double ax =
P[3] - Az[0] *
C;
304 const double ay =
P[4] - Az[1] *
C;
306 const double az =
P[5] - Az[2] *
C;
308 double A = (
ax *
x +
ay *
y + az *
z);
315 const double S[3] = {
x,
y,
z };
317 mult3x5Helper(
s,
S, &
P[7]);
318 globalToLocalVecHelper(
P,
s[0],
s[1],
s[2],
s[3],
s[4]);
321 const double Av[3] = { (RC * Ay[0] - RS * Ax[0]) * (
R = 1. /
R),
322 (RC * Ay[1] - RS * Ax[1]) *
R,
323 (RC * Ay[2] - RS * Ax[2]) *
R };
325 mult3x5Helper(&Jac[0], Av, &
P[7]);
326 mult3x5Helper(&Jac[5], Az, &
P[7]);
340 const double* Az =
T.matrix().col(2).data();
341 double Bx = Az[1] *
P[5] - Az[2] *
P[4];
342 double By = Az[2] *
P[3] - Az[0] *
P[5];
343 double Bz = Az[0] *
P[4] - Az[1] *
P[3];
344 const double B2 = Bx * Bx + By * By + Bz * Bz;
345 const double x =
P[0] -
T(0, 3);
346 const double y =
P[1] -
T(1, 3);
347 const double z =
P[2] -
T(2, 3);
349 const double Bn = 1. / std::sqrt(B2);
353 par[0] =
x * Bx +
y * By +
z * Bz;
361 / (Az[0] * Az[0] + Az[1] * Az[1] + Az[2] * Az[2]));
363 par[1] =
x * Az[0] +
y * Az[1] +
z * Az[2];
371 const double d =
P[3] * Az[0] +
P[4] * Az[1] +
P[5] * Az[2];
372 double a = (1. -
d) * (1. +
d);
376 const double X =
d * Az[0] -
P[3];
377 const double Y =
d * Az[1] -
P[4];
378 const double Z =
d * Az[2] -
P[5];
381 mult3x5Helper(D, Az, &
P[10]);
383 (((
P[7] *
X +
P[8] *
Y +
P[9] *
Z) +
x * (D[0] * Az[0] -
P[10])) +
384 (
y * (D[0] * Az[1] -
P[11]) +
z * (D[0] * Az[2] -
P[12]))) *
387 (((
P[14] *
X +
P[15] *
Y +
P[16] *
Z) +
x * (D[1] * Az[0] -
P[17])) +
388 (
y * (D[1] * Az[1] -
P[18]) +
z * (D[1] * Az[2] -
P[19]))) *
391 (((
P[21] *
X +
P[22] *
Y +
P[23] *
Z) +
x * (D[2] * Az[0] -
P[24])) +
392 (
y * (D[2] * Az[1] -
P[25]) +
z * (D[2] * Az[2] -
P[26]))) *
395 (((
P[28] *
X +
P[29] *
Y +
P[30] *
Z) +
x * (D[3] * Az[0] -
P[31])) +
396 (
y * (D[3] * Az[1] -
P[32]) +
z * (D[3] * Az[2] -
P[33]))) *
399 (((
P[35] *
X +
P[36] *
Y +
P[37] *
Z) +
x * (D[4] * Az[0] -
P[38])) +
400 (
y * (D[4] * Az[1] -
P[39]) +
z * (D[4] * Az[2] -
P[40]))) *
404 globalToLocalVecHelper(
P, -1. * s0, -1. *
s1, -1. *
s2, -1. *
s3, -1. *
s4);
406 const double B[3] = { Bx, By, Bz };
407 mult3x5Helper(&Jac[0],
B, &
P[7]);
408 mult3x5Helper(&Jac[5], Az, &
P[7]);
423 const double* Ax =
T.matrix().col(0).data();
424 const double* Ay =
T.matrix().col(1).data();
425 const double* Az =
T.matrix().col(2).data();
427 const double x =
P[0] -
T(0, 3);
428 const double y =
P[1] -
T(1, 3);
429 const double z =
P[2] -
T(2, 3);
430 const double RC =
x * Ax[0] +
y * Ax[1] +
z * Ax[2];
431 const double RS =
x * Ay[0] +
y * Ay[1] +
z * Ay[2];
432 par[1] =
x * Az[0] +
y * Az[1] +
z * Az[2];
433 par[0] = atan2(RS, RC) * (
par[1] * tA);
455 transformPlaneToGlobal(
bool useJac,
460 const double* Ax =
T.matrix().col(0).data();
461 const double* Ay =
T.matrix().col(1).data();
463 P[0] =
p[0] * Ax[0] +
p[1] * Ay[0] +
T(0, 3);
464 P[1] =
p[0] * Ax[1] +
p[1] * Ay[1] +
T(1, 3);
465 P[2] =
p[0] * Ax[2] +
p[1] * Ay[2] +
T(2, 3);
490 transformDiscToGlobal(
bool useJac,
495 const double* Ax =
T.matrix().col(0).data();
496 const double* Ay =
T.matrix().col(1).data();
501 const double d0 = Cf * Ax[0] + Sf * Ay[0];
502 const double d1 = Cf * Ax[1] + Sf * Ay[1];
503 const double d2 = Cf * Ax[2] + Sf * Ay[2];
504 P[0] =
p[0] *
d0 +
T(0, 3);
505 P[1] =
p[0] *
d1 +
T(1, 3);
506 P[2] =
p[0] *
d2 +
T(2, 3);
513 P[14] =
p[0] * (Cf * Ay[0] - Sf * Ax[0]);
517 P[15] =
p[0] * (Cf * Ay[1] - Sf * Ax[1]);
521 P[16] =
p[0] * (Cf * Ay[2] - Sf * Ax[2]);
531 transformCylinderToGlobal(
bool useJac,
537 const double* Ax =
T.matrix().col(0).data();
538 const double* Ay =
T.matrix().col(1).data();
539 const double* Az =
T.matrix().col(2).data();
541 const double fr =
p[0] /
R;
545 P[0] =
R * (Cf * Ax[0] + Sf * Ay[0]) +
p[1] * Az[0] +
T(0, 3);
546 P[1] =
R * (Cf * Ax[1] + Sf * Ay[1]) +
p[1] * Az[1] +
T(1, 3);
547 P[2] =
R * (Cf * Ax[2] + Sf * Ay[2]) +
p[1] * Az[2] +
T(2, 3);
553 P[7] = Cf * Ay[0] - Sf * Ax[0];
557 P[8] = Cf * Ay[1] - Sf * Ax[1];
561 P[9] = Cf * Ay[2] - Sf * Ax[2];
572 transformLineToGlobal(
bool useJac,
577 const double* Az =
T.matrix().col(2).data();
579 double Bx = Az[1] *
P[5] - Az[2] *
P[4];
580 double By = Az[2] *
P[3] - Az[0] *
P[5];
581 double Bz = Az[0] *
P[4] - Az[1] *
P[3];
582 const double tmp_B2 = Bx * Bx + By * By + Bz * Bz;
583 constexpr
double epsilon2 = 1
e-14;
587 const double Bn = ( tmp_B2 > epsilon2 ? 1. / std::sqrt(tmp_B2) : 0. );
591 P[0] =
p[1] * Az[0] + Bx *
p[0] +
T(0, 3);
592 P[1] =
p[1] * Az[1] + By *
p[0] +
T(1, 3);
593 P[2] =
p[1] * Az[2] + Bz *
p[0] +
T(2, 3);
598 double Bx2 = -Az[2] *
P[25];
599 double Bx3 = Az[1] *
P[33] - Az[2] *
P[32];
600 double By2 = Az[2] *
P[24];
601 double By3 = Az[2] *
P[31] - Az[0] *
P[33];
602 double Bz2 = Az[0] *
P[25] - Az[1] *
P[24];
603 double Bz3 = Az[0] *
P[32] - Az[1] *
P[31];
604 const double B2 = Bx * Bx2 + By * By2 + Bz * Bz2;
605 const double B3 = Bx * Bx3 + By * By3 + Bz * Bz3;
606 Bx2 = (Bx2 - Bx * B2) * Bn;
607 Bx3 = (Bx3 - Bx * B3) * Bn;
608 By2 = (By2 - By * B2) * Bn;
609 By3 = (By3 - By * B3) * Bn;
610 Bz2 = (Bz2 - Bz * B2) * Bn;
611 Bz3 = (Bz3 - Bz * B3) * Bn;
636 const double* At = &
P[4];
639 const double* Ax = &
P[13];
640 const double* Ay = &
P[16];
643 double A = At[0] *
S[0] + At[1] *
S[1] + At[2] *
S[2];
650 const double s1 = Au[0] *
S[0] + Au[1] *
S[1];
651 const double s2 = Av[0] *
S[0] + Av[1] *
S[1] + Av[2] *
S[2];
653 Au[0] -= (
s1 * At[0]);
654 Au[1] -= (
s1 * At[1]);
655 Au[2] -= (
s1 * At[2]);
656 Av[0] -= (
s2 * At[0]);
657 Av[1] -= (
s2 * At[1]);
658 Av[2] -= (
s2 * At[2]);
660 Jac[0] = Ax[0] * Au[0] + Ax[1] * Au[1] + Ax[2] * Au[2];
661 Jac[1] = Ax[0] * Av[0] + Ax[1] * Av[1] + Ax[2] * Av[2];
664 Jac[5] = Ay[0] * Au[0] + Ay[1] * Au[1] + Ay[2] * Au[2];
665 Jac[6] = Ay[0] * Av[0] + Ay[1] * Av[1] + Ay[2] * Av[2];
678 const double*
p = &
P[0];
679 const double* At = &
P[4];
682 const double* Ax = &
P[13];
683 const double* Ay = &
P[16];
688 double A = At[0] *
S[0] + At[1] *
S[1] + At[2] *
S[2];
695 const double s1 = Au[0] *
S[0] + Au[1] *
S[1];
696 const double s2 = Av[0] *
S[0] + Av[1] *
S[1] + Av[2] *
S[2];
698 Au[0] -= (
s1 * At[0]);
699 Au[1] -= (
s1 * At[1]);
700 Au[2] -= (
s1 * At[2]);
701 Av[0] -= (
s2 * At[0]);
702 Av[1] -= (
s2 * At[1]);
703 Av[2] -= (
s2 * At[2]);
710 const double Ri = 1. /
p[0];
711 const double A0 = (Cf * Ax[0] + Sf * Ay[0]);
712 const double A1 = (Cf * Ax[1] + Sf * Ay[1]);
713 const double A2 = (Cf * Ax[2] + Sf * Ay[2]);
714 const double B0 = (Cf * Ay[0] - Sf * Ax[0]) * Ri;
715 const double B1 = (Cf * Ay[1] - Sf * Ax[1]) * Ri;
716 const double B2 = (Cf * Ay[2] - Sf * Ax[2]) * Ri;
718 Jac[0] = A0 * Au[0] + A1 * Au[1] + A2 * Au[2];
719 Jac[1] = A0 * Av[0] + A1 * Av[1] + A2 * Av[2];
722 Jac[5] = B0 * Au[0] + B1 * Au[1] + B2 * Au[2];
723 Jac[6] = B0 * Av[0] + B1 * Av[1] + B2 * Av[2];
733 jacobianTransformCurvilinearToCylinder(
double*
ATH_RESTRICT P,
736 const double*
p = &
P[0];
737 const double* At = &
P[4];
740 const double* Ax = &
P[13];
741 const double* Ay = &
P[16];
742 const double* Az = &
P[19];
743 const double R =
P[22];
745 const double fr =
p[0] /
R;
749 const double x = Cf * Ax[0] + Sf * Ay[0];
750 const double y = Cf * Ax[1] + Sf * Ay[1];
751 const double z = Cf * Ax[2] + Sf * Ay[2];
755 const double C = At[0] * Az[0] + At[1] * Az[1] + At[2] * Az[2];
756 const double ax = At[0] - Az[0] *
C;
757 const double ay = At[1] - Az[1] *
C;
758 const double az = At[2] - Az[2] *
C;
759 double A = (
ax *
x +
ay *
y + az *
z);
763 const double s1 = (Au[0] *
x + Au[1] *
y) *
A;
764 const double s2 = (Av[0] *
x + Av[1] *
y + Av[2] *
z) *
A;
766 Au[0] -= (
s1 * At[0]);
767 Au[1] -= (
s1 * At[1]);
768 Au[2] -= (
s1 * At[2]);
769 Av[0] -= (
s2 * At[0]);
770 Av[1] -= (
s2 * At[1]);
771 Av[2] -= (
s2 * At[2]);
775 const double A0 = (Cf * Ay[0] - Sf * Ax[0]);
776 const double A1 = (Cf * Ay[1] - Sf * Ax[1]);
777 const double A2 = (Cf * Ay[2] - Sf * Ax[2]);
779 Jac[0] = A0 * Au[0] + A1 * Au[1] + A2 * Au[2];
780 Jac[1] = A0 * Av[0] + A1 * Av[1] + A2 * Av[2];
783 Jac[5] = Az[0] * Au[0] + Az[1] * Au[1] + Az[2] * Au[2];
784 Jac[6] = Az[0] * Av[0] + Az[1] * Av[1] + Az[2] * Av[2];
795 jacobianTransformCurvilinearToStraightLine(
const double*
ATH_RESTRICT P,
798 const double*
p = &
P[0];
799 const double* At = &
P[4];
800 const double* Au = &
P[7];
801 const double* Av = &
P[10];
802 const double*
A = &
P[19];
804 double Bx =
A[1] * At[2] -
A[2] * At[1];
805 double By =
A[2] * At[0] -
A[0] * At[2];
806 double Bz =
A[0] * At[1] -
A[1] * At[0];
807 const double Bn = 1. / std::sqrt(Bx * Bx + By * By + Bz * Bz);
814 const double d = At[0] *
A[0] + At[1] *
A[1] + At[2] *
A[2];
815 double a = (1. -
d) * (1. +
d);
818 const double X =
d *
A[0] - At[0],
Y =
d *
A[1] - At[1],
Z =
d *
A[2] - At[2];
820 const double s1 = (Au[0] *
X + Au[1] *
Y) *
a;
821 const double s2 = (Av[0] *
X + Av[1] *
Y + Av[2] *
Z) *
a;
822 const double s3 =
p[0] * (Bx * At[1] - By * At[0]) *
a;
823 const double s4 =
p[0] * (Bx * Av[0] + By * Av[1] + Bz * Av[2]) *
a;
827 Jac[0] = Bx * Au[0] + By * Au[1];
828 Jac[1] = Bx * Av[0] + By * Av[1] + Bz * Av[2];
831 Jac[5] =
A[0] * Au[0] +
A[1] * Au[1] +
s1 *
d;
832 Jac[6] = (
A[0] * Av[0] +
A[1] * Av[1] +
A[2] * Av[2]) +
s2 *
d;
845 const double*
r = &
P[0];
846 const double*
a = &
P[3];
848 const double A =
a[0] *
S[0] +
a[1] *
S[1] +
a[2] *
S[2];
853 const double D = (
S[3] -
r[0] *
S[0]) - (
r[1] *
S[1] +
r[2] *
S[2]);
866 const double*
r = &
P[0];
867 const double*
a = &
P[3];
869 double dx =
r[0] -
S[0];
870 double dy =
r[1] -
S[1];
871 double dz =
r[2] -
S[2];
872 double B =
dx *
S[3] +
dy *
S[4] + dz *
S[5];
873 double C =
a[0] *
S[3] +
a[1] *
S[4] +
a[2] *
S[5];
874 const double ax =
a[0] -
S[3] *
C;
876 const double ay =
a[1] -
S[4] *
C;
878 const double az =
a[2] -
S[5] *
C;
880 double A = 2. * (
ax *
ax +
ay *
ay + az * az);
886 double g =
dx +
dy + dz;
887 C = (
g -
S[6]) * (
g +
S[6]) - 2. * (
dx * (
dy + dz) +
dy * dz);
888 double Sq =
B *
B - 2. *
A *
C;
890 double Smin = -
B /
A, Smax = Smin;
894 Sq = std::sqrt(Sq) /
A;
903 if (std::fabs(Smax) < .1) {
910 const double inside = Smin * Smax;
953 const double*
r = &
P[0];
954 const double*
a = &
P[3];
956 double D =
a[0] *
S[3] +
a[1] *
S[4] +
a[2] *
S[5];
957 const double A = (1. - D) * (1. + D);
962 D = (
r[0] -
S[0]) * (D *
S[3] -
a[0]) + (
r[1] -
S[1]) * (D *
S[4] -
a[1]) +
963 (
r[2] -
S[2]) * (D *
S[5] -
a[2]);
976 const double*
r = &
P[0];
977 const double*
a = &
P[3];
979 const double dx =
r[0] -
S[0];
980 const double dy =
r[1] -
S[1];
981 const double dz =
r[2] -
S[2];
982 const double A =
dx *
S[3] +
dy *
S[4] + dz *
S[5];
983 const double B =
a[0] *
S[3] +
a[1] *
S[4] +
a[2] *
S[5];
984 const double C =
a[0] *
dx +
a[1] *
dy +
a[2] * dz;
985 const double k =
S[6];
987 const double KB = 1. -
k *
B *
B;
988 const double KABC =
k *
A *
B -
C;
995 double Sq = KABC * KABC + (
k *
A *
A -
dx *
dx -
dy *
dy - dz * dz) * KB;
997 Sq = std::sqrt(Sq) / KB;
1006 if (
A +
B * Smin < 0.) {
1010 if (
A +
B * Smax < 0.) {
1024 Smin = (
dx *
dx +
dy *
dy + dz * dz -
k *
A *
A) / (2. * KABC);
1026 if (
A +
B * Smin < 0.) {
1033 const double inside = Smin * Smax;
1122 par[2] = atan2(
P[4],
P[3]);
1123 par[3] = acos(
P[5]);
1134 par[2] = atan2(
P[4],
P[3]);
1135 par[3] = acos(
P[5]);
1142 transformGlobalToPlane(
T, useJac,
P,
par, Jac);
1148 transformGlobalToLine(
T, useJac,
P,
par, Jac);
1152 transformGlobalToCylinder(
1162 transformGlobalToDisc(
T, useJac,
P,
par, Jac);
1166 transformGlobalToCone(
1183 double P3, P4,
C =
P[3] *
P[3] +
P[4] *
P[4];
1195 Jac[10] = P3 *
P[11] - P4 *
P[10];
1196 Jac[11] = P3 *
P[18] - P4 *
P[17];
1197 Jac[12] = P3 *
P[25] - P4 *
P[24];
1198 Jac[13] = P3 *
P[32] - P4 *
P[31];
1199 Jac[14] = P3 *
P[39] - P4 *
P[38];
1200 Jac[15] =
C *
P[12];
1201 Jac[16] =
C *
P[19];
1202 Jac[17] =
C *
P[26];
1203 Jac[18] =
C *
P[33];
1204 Jac[19] =
C *
P[40];
1220 return stepEstimatorToStraightLine(Su,
P, Q);
1223 return stepEstimatorToPlane(Su,
P, Q);
1226 return stepEstimatorToCylinder(Su,
P, Q);
1229 return stepEstimatorToCone(Su,
P, Q);
1245 return stepEstimatorToPlane(Su,
P, Q);
1248 return stepEstimatorToCylinder(Su,
P, Q);
1253 return stepEstimatorToStraightLine(Su,
P, Q);
1257 return stepEstimatorToCone(Su,
P, Q);
1260 return stepEstimatorToPlane(Su,
P, Q);
1282 std::pair<double, int>
1284 std::vector<std::pair<const Trk::Surface*, Trk::BoundaryCheck>>& SU,
1285 std::multimap<double, int>& DN,
1296 const double D[3] = { Pout[0] - Pinp[0], Pout[1] - Pinp[1], Pout[2] - Pinp[2] };
1297 double Smax = std::sqrt(D[0] * D[0] + D[1] * D[1] + D[2] * D[2]);
1298 double Sign = D[0] * Pinp[3] + D[1] * Pinp[4] + D[2] * Pinp[5];
1301 if (Smax < DBL_EPSILON) {
1303 return std::make_pair(0., -1);
1305 Eigen::Map<const Amg::Vector3D>
pos(&Pinp[0],3,1);
1308 double Smin = 2. * Smax;
1310 std::vector<std::pair<double, int>> LD;
1313 for (;
i !=
ie; ++
i) {
1315 if ((*i).first >
W + Smin)
1318 int j = (*i).second;
1320 SU[j].first->straightLineDistanceEstimate(
pos,
dir, SU[j].
second);
1321 LD.emplace_back(
ds.currentDistance(
false) +
W, j);
1323 const int n =
ds.numberOfSolutions();
1327 for (
int i = 0;
i !=
n; ++
i) {
1329 i == 0 ?
s =
ds.first() :
s =
ds.second();
1330 if (s < 0. || s > Smin || (j == Nv &&
s < So))
1339 DN.erase(DN.begin(),
i);
1340 std::vector<std::pair<double, int>>
::iterator l = LD.begin(), le = LD.end();
1341 for (;
l != le; ++
l)
1347 return std::make_pair(0., -1);
1354 if (Smin < So || (Smax - Smin) > 2. * So)
1355 return std::make_pair(Sm,
N);
1357 Eigen::Map<const Amg::Vector3D> posn(&Pout[0], 3, 1);
1358 Eigen::Map<const Amg::Vector3D> dirn(&Pout[3], 3, 1);
1361 SU[
N].first->straightLineDistanceEstimate(posn, dirn, SU[
N].
second);
1362 const int n =
ds.numberOfSolutions();
1364 return std::make_pair(Sm,
N);
1367 for (
int i = 0;
i !=
n; ++
i) {
1370 i == 0 ?
s =
ds.first() :
s =
ds.second();
1373 if (
s * Sign < 0.) {
1376 return std::make_pair(
s,
N);
1383 return std::make_pair(Sm,
N);
1398 Eigen::Map<
const AmgVector(5)> JacMap0(&J[0], 5, 1);
1400 m(0, 0) = a1.dot(JacMap0);
1402 Eigen::Map<
const AmgVector(5)> JacMap5(&J[5]);
1404 m(1, 0) = a2.dot(JacMap0);
1405 m(1, 1) = a2.dot(JacMap5);
1408 Eigen::Map<
const AmgVector(5)> JacMap10(&J[10], 5, 1);
1410 m(2, 0) = a3.dot(JacMap0);
1411 m(2, 1) = a3.dot(JacMap5);
1412 m(2, 2) = a3.dot(JacMap10);
1416 Eigen::Map<
const AmgVector(5)> JacMap15(&J[15], 5, 1);
1418 m(3, 0) = a4.dot(JacMap0);
1419 m(3, 1) = a4.dot(JacMap5);
1420 m(3, 2) = a4.dot(JacMap10);
1421 m(3, 3) = a4.dot(JacMap15);
1426 const AmgVector(5) a5 = M.row(4) * J[20];
1427 m(4, 0) = a5.dot(JacMap0);
1428 m(4, 1) = a5.dot(JacMap5);
1429 m(4, 2) = a5.dot(JacMap10);
1430 m(4, 3) = a5.dot(JacMap15);
1431 m(4, 4) = a5[4] * J[20];
1453 double Sf, Cf, Ce, Se;
1461 if (std::fabs(
P[6]) < .000000000000001) {
1462 P[6] < 0. ?
P[6] = -.000000000000001 :
P[6] = .000000000000001;
1500 transformPlaneToGlobal(useJac,
T,
p,
P);
1505 transformLineToGlobal(useJac,
T,
p,
P);
1509 transformCylinderToGlobal(
1518 transformDiscToGlobal(useJac,
T,
p,
P);
1543 const double An = std::sqrt(
P[3] *
P[3] +
P[4] *
P[4]);
1555 const double Ay[3] = { -Ax[1] *
P[5], Ax[0] *
P[5], An };
1556 double S[3] = {
P[3],
P[4],
P[5] };
1558 double A =
P[3] *
S[0] +
P[4] *
S[1] +
P[5] *
S[2];
1566 mult3x5Helper(
s,
S, &
P[7]);
1567 globalToLocalVecHelper(
P,
s[0],
s[1],
s[2],
s[3],
s[4]);
1569 double P3, P4,
C =
P[3] *
P[3] +
P[4] *
P[4];
1583 Jac[0] = Ax[0] *
P[7] + Ax[1] *
P[8];
1584 Jac[1] = Ax[0] *
P[14] + Ax[1] *
P[15];
1585 Jac[2] = Ax[0] *
P[21] + Ax[1] *
P[22];
1586 Jac[3] = Ax[0] *
P[28] + Ax[1] *
P[29];
1587 Jac[4] = Ax[0] *
P[35] + Ax[1] *
P[36];
1588 Jac[5] = Ay[0] *
P[7] + Ay[1] *
P[8] + Ay[2] *
P[9];
1589 Jac[6] = Ay[0] *
P[14] + Ay[1] *
P[15] + Ay[2] *
P[16];
1590 Jac[7] = Ay[0] *
P[21] + Ay[1] *
P[22] + Ay[2] *
P[23];
1591 Jac[8] = Ay[0] *
P[28] + Ay[1] *
P[29] + Ay[2] *
P[30];
1592 Jac[9] = Ay[0] *
P[35] + Ay[1] *
P[36] + Ay[2] *
P[37];
1593 Jac[10] = P3 *
P[11] - P4 *
P[10];
1594 Jac[11] = P3 *
P[18] - P4 *
P[17];
1595 Jac[12] = P3 *
P[25] - P4 *
P[24];
1596 Jac[13] = P3 *
P[32] - P4 *
P[31];
1597 Jac[14] = P3 *
P[39] - P4 *
P[38];
1598 Jac[15] =
C *
P[12];
1599 Jac[16] =
C *
P[19];
1600 Jac[17] =
C *
P[26];
1601 Jac[18] =
C *
P[33];
1602 Jac[19] =
C *
P[40];
1614 double Sf, Cf, Ce, Se;
1618 const double Ax[3] = { -Sf, Cf, 0. };
1619 const double Ay[3] = { -Cf * Ce, -Sf * Ce, Se };
1673 const AmgVector(5)& Vp = Tp.parameters();
1729 double Sf, Cf, Ce, Se;
1756 jacobianTransformCurvilinearToPlane(
P, Jac);
1761 jacobianTransformCurvilinearToStraightLine(
P, Jac);
1766 jacobianTransformCurvilinearToCylinder(
P, Jac);
1770 jacobianTransformCurvilinearToDisc(
P, Jac);
1779 Jac[0] = Jac[3] = 1.;
1780 Jac[1] = Jac[2] = 0.;
1794 std::vector<std::pair<const Trk::Surface*, Trk::BoundaryCheck>>& SU,
1795 std::multimap<double, int>& DN,
1802 DN.erase(DN.begin(), DN.end());
1804 Eigen::Map<const Amg::Vector3D>
pos(&Pinp[0], 3, 1);
1805 Eigen::Map<const Amg::Vector3D>
dir(&Pinp[3], 3, 1);
1814 for (
int i = 0;
i !=
N; ++
i) {
1823 double dist =
ds.currentDistance(
false);
1824 DN.insert(std::make_pair(dist +
W,
i));
1829 int n =
ds.numberOfSolutions();
1832 for (
int i = 0;
i !=
n; ++
i) {
1835 i == 0 ? st =
ds.first() : st =
ds.second();
1837 if (
s == So && std::fabs(st) <= .001)