27 fvec d[5], uud, u[5][5];
28 for (
int i = 0;
i < 5;
i++) {
30 for (
int j = 0; j < 5; j++)
34 for (
int i = 0;
i < 5;
i++) {
36 for (
int j = 0; j <
i; j++)
37 uud += u[j][
i] * u[j][
i] *
d[j];
38 uud = a[
i * (
i + 3) / 2] - uud;
40 fvec smallval = 1.e-12;
41 fvec initialised =
fvec(uud < smallval);
42 uud = ((!initialised) & uud) + (smallval & initialised);
47 for (
int j =
i + 1; j < 5; j++) {
49 for (
int k = 0; k <
i; k++)
50 uud += u[k][
i] * u[k][j] *
d[k];
51 uud = a[j * (j + 1) / 2 +
i] - uud;
52 u[
i][j] =
d[
i] / u[
i][
i] * uud;
58 for (
int i = 0;
i < 5;
i++) {
60 u[
i][
i] = 1.f / u[
i][
i];
62 for (
int i = 0;
i < 4;
i++) {
63 u[
i][
i + 1] = -u[
i][
i + 1] * u[
i][
i] * u[
i + 1][
i + 1];
65 for (
int i = 0;
i < 3;
i++) {
66 u[
i][
i + 2] = u[
i][
i + 1] * u1[
i + 1] * u[
i + 1][
i + 2]
67 - u[
i][
i + 2] * u[
i][
i] * u[
i + 2][
i + 2];
69 for (
int i = 0;
i < 2;
i++) {
70 u[
i][
i + 3] = u[
i][
i + 2] * u1[
i + 2] * u[
i + 2][
i + 3]
71 - u[
i][
i + 3] * u[
i][
i] * u[
i + 3][
i + 3];
73 u[
i][
i + 1] * u1[
i + 1]
74 * (u[
i + 1][
i + 2] * u1[
i + 2] * u[
i + 2][
i + 3] - u[
i + 1][
i + 3]);
76 u[0][4] = u[0][2] * u1[2] * u[2][4] - u[0][4] * u[0][0] * u[4][4];
79 * (u[1][4] - u[1][3] * u1[3] * u[3][4] - u[1][2] * u1[2] * u[2][4]);
82 * (u[0][3] - u1[2] * u[2][3] * (u[0][2] - u[0][1] * u1[1] * u[1][2]));
84 for (
int i = 0;
i < 5;
i++)
85 a[
i + 10] = u[
i][4] *
d[4] * u[4][4];
86 for (
int i = 0;
i < 4;
i++)
87 a[
i + 6] = u[
i][3] * u[3][3] *
d[3] + u[
i][4] * u[3][4] *
d[4];
88 for (
int i = 0;
i < 3;
i++)
89 a[
i + 3] = u[
i][2] * u[2][2] *
d[2] + u[
i][3] * u[2][3] *
d[3]
90 + u[
i][4] * u[2][4] *
d[4];
91 for (
int i = 0;
i < 2;
i++)
92 a[
i + 1] = u[
i][1] * u[1][1] *
d[1] + u[
i][2] * u[1][2] *
d[2]
93 + u[
i][3] * u[1][3] *
d[3] + u[
i][4] * u[1][4] *
d[4];
94 a[0] = u[0][0] * u[0][0] *
d[0] + u[0][1] * u[0][1] *
d[1]
95 + u[0][2] * u[0][2] *
d[2] + u[0][3] * u[0][3] *
d[3]
96 + u[0][4] * u[0][4] *
d[4];
101 C[0] * V[0] + C[1] * V[1] + C[3] * V[3] + C[6] * V[6] + C[10] * V[10];
103 C[0] * V[1] + C[1] * V[2] + C[3] * V[4] + C[6] * V[7] + C[10] * V[11];
105 C[0] * V[3] + C[1] * V[4] + C[3] * V[5] + C[6] * V[8] + C[10] * V[12];
107 C[0] * V[6] + C[1] * V[7] + C[3] * V[8] + C[6] * V[9] + C[10] * V[13];
109 C[0] * V[10] + C[1] * V[11] + C[3] * V[12] + C[6] * V[13] + C[10] * V[14];
112 C[1] * V[0] + C[2] * V[1] + C[4] * V[3] + C[7] * V[6] + C[11] * V[10];
114 C[1] * V[1] + C[2] * V[2] + C[4] * V[4] + C[7] * V[7] + C[11] * V[11];
116 C[1] * V[3] + C[2] * V[4] + C[4] * V[5] + C[7] * V[8] + C[11] * V[12];
118 C[1] * V[6] + C[2] * V[7] + C[4] * V[8] + C[7] * V[9] + C[11] * V[13];
120 C[1] * V[10] + C[2] * V[11] + C[4] * V[12] + C[7] * V[13] + C[11] * V[14];
123 C[3] * V[0] + C[4] * V[1] + C[5] * V[3] + C[8] * V[6] + C[12] * V[10];
125 C[3] * V[1] + C[4] * V[2] + C[5] * V[4] + C[8] * V[7] + C[12] * V[11];
127 C[3] * V[3] + C[4] * V[4] + C[5] * V[5] + C[8] * V[8] + C[12] * V[12];
129 C[3] * V[6] + C[4] * V[7] + C[5] * V[8] + C[8] * V[9] + C[12] * V[13];
131 C[3] * V[10] + C[4] * V[11] + C[5] * V[12] + C[8] * V[13] + C[12] * V[14];
134 C[6] * V[0] + C[7] * V[1] + C[8] * V[3] + C[9] * V[6] + C[13] * V[10];
136 C[6] * V[1] + C[7] * V[2] + C[8] * V[4] + C[9] * V[7] + C[13] * V[11];
138 C[6] * V[3] + C[7] * V[4] + C[8] * V[5] + C[9] * V[8] + C[13] * V[12];
140 C[6] * V[6] + C[7] * V[7] + C[8] * V[8] + C[9] * V[9] + C[13] * V[13];
142 C[6] * V[10] + C[7] * V[11] + C[8] * V[12] + C[9] * V[13] + C[13] * V[14];
145 C[10] * V[0] + C[11] * V[1] + C[12] * V[3] + C[13] * V[6] + C[14] * V[10];
147 C[10] * V[1] + C[11] * V[2] + C[12] * V[4] + C[13] * V[7] + C[14] * V[11];
149 C[10] * V[3] + C[11] * V[4] + C[12] * V[5] + C[13] * V[8] + C[14] * V[12];
151 C[10] * V[6] + C[11] * V[7] + C[12] * V[8] + C[13] * V[9] + C[14] * V[13];
152 K[4][4] = C[10] * V[10] + C[11] * V[11] + C[12] * V[12] + C[13] * V[13]
157 K[0] = C[0][0] * V[0] + C[0][1] * V[1] + C[0][2] * V[3] + C[0][3] * V[6]
160 K[1] = C[1][0] * V[0] + C[1][1] * V[1] + C[1][2] * V[3] + C[1][3] * V[6]
162 K[2] = C[1][0] * V[1] + C[1][1] * V[2] + C[1][2] * V[4] + C[1][3] * V[7]
165 K[3] = C[2][0] * V[0] + C[2][1] * V[1] + C[2][2] * V[3] + C[2][3] * V[6]
167 K[4] = C[2][0] * V[1] + C[2][1] * V[2] + C[2][2] * V[4] + C[2][3] * V[7]
169 K[5] = C[2][0] * V[3] + C[2][1] * V[4] + C[2][2] * V[5] + C[2][3] * V[8]
172 K[6] = C[3][0] * V[0] + C[3][1] * V[1] + C[3][2] * V[3] + C[3][3] * V[6]
174 K[7] = C[3][0] * V[1] + C[3][1] * V[2] + C[3][2] * V[4] + C[3][3] * V[7]
176 K[8] = C[3][0] * V[3] + C[3][1] * V[4] + C[3][2] * V[5] + C[3][3] * V[8]
178 K[9] = C[3][0] * V[6] + C[3][1] * V[7] + C[3][2] * V[8] + C[3][3] * V[9]
181 K[10] = C[4][0] * V[0] + C[4][1] * V[1] + C[4][2] * V[3] + C[4][3] * V[6]
183 K[11] = C[4][0] * V[1] + C[4][1] * V[2] + C[4][2] * V[4] + C[4][3] * V[7]
185 K[12] = C[4][0] * V[3] + C[4][1] * V[4] + C[4][2] * V[5] + C[4][3] * V[8]
187 K[13] = C[4][0] * V[6] + C[4][1] * V[7] + C[4][2] * V[8] + C[4][3] * V[9]
189 K[14] = C[4][0] * V[10] + C[4][1] * V[11] + C[4][2] * V[12] + C[4][3] * V[13]
194 r_out[0] = r_in[0] * C[0] + r_in[1] * C[1] + r_in[2] * C[3] + r_in[3] * C[6]
196 r_out[1] = r_in[0] * C[1] + r_in[1] * C[2] + r_in[2] * C[4] + r_in[3] * C[7]
198 r_out[2] = r_in[0] * C[3] + r_in[1] * C[4] + r_in[2] * C[5] + r_in[3] * C[8]
200 r_out[3] = r_in[0] * C[6] + r_in[1] * C[7] + r_in[2] * C[8] + r_in[3] * C[9]
202 r_out[4] = r_in[0] * C[10] + r_in[1] * C[11] + r_in[2] * C[12]
203 + r_in[3] * C[13] + r_in[4] * C[14];
214 for (
int i = 0;
i < 15;
i++) {
223 for (
int i = 0;
i < 5;
i++)
224 dzeta[
i] =
m[
i] - r[
i];
227 for (
int i = 0;
i < 5;
i++)
235 for (
int i = 0;
i < 15;
i++)
239 for (
int i = 0;
i < 5;
i++) {
241 for (
int j = 0; j < 5; j++)
242 kd += K[
i][j] * dzeta[j];
249 *chi2 = dzeta[0] * S_dzeta[0] + dzeta[1] * S_dzeta[1]
250 + dzeta[2] * S_dzeta[2] + dzeta[3] * S_dzeta[3]
251 + dzeta[4] * S_dzeta[4];
282 unsigned short ista = 0;
284 #pragma omp parallel for
289 ista = (*vSFlag)[(*vStsHits)[
vRecoHits[start_hit]].f] / 4;
291 start_hit +=
vTracks[iTr].NHits - 1;
293 ista = (*vSFlag)[(*vStsHits)[
vRecoHits[start_hit]].f] / 4;
311 #pragma omp parallel for
313 for (
int iTr = 0; iTr < static_cast<unsigned short>(
NTracksIsecAll); iTr++) {
315 for (
int jTr = 0; jTr < static_cast<unsigned short>(
NTracksIsecAll);
319 if (iTr == jTr)
continue;
325 unsigned short dist = 0;
326 unsigned short stab = 0, staf = 0;
434 if (dist == 0)
continue;
440 vStations[staf].fieldSlice.GetFieldValue(Tf.
x, Tf.
y, fBf);
441 vStations[stab].fieldSlice.GetFieldValue(Tb.
x, Tb.
y, fBb);
446 fvec zm = vStations[stam].z;
447 fvec xm = 0.5 * (Tf.
x + Tf.
tx * (zm - Tf.
z) + Tb.
x + Tb.
tx * (zm - Tb.
z));
448 fvec ym = 0.5 * (Tb.
y + Tb.
ty * (zm - Tb.
z) + Tb.
y + Tb.
ty * (zm - Tb.
z));
449 vStations[stam].fieldSlice.GetFieldValue(xm, ym, fBm);
450 fld.Set(fBb, Tb.
z, fBm, zm, fBf, Tf.
z);
452 fvec zMiddle = 0.5 * (Tb.
z + Tf.
z);
457 fvec Chi2Tracks = 0.f;
459 if (Chi2Tracks[0] > 50)
continue;
461 if (
Neighbour[iTr] <
static_cast<unsigned short>(50000)) {
466 if (
Neighbour[jTr] <
static_cast<unsigned short>(50000)) {
475 IsNext[iTr] = IsNextTemp;
476 IsNext[jTr] = (!IsNextTemp);
480 for (
int iTr = 0; iTr < static_cast<unsigned short>(
NTracksIsecAll); iTr++) {
481 if (IsUsed[iTr])
continue;
502 for (
unsigned short iTr = 0; iTr <
vTracksNew.size(); iTr++)