36 Double_t p = (TMath::Abs(
Qp()) > 1.e-4) ? 1. / TMath::Abs(
Qp()) : 1.e4;
37 Double_t pz = TMath::Sqrt(p * p / (
Tx() *
Tx() +
Ty() *
Ty() + 1));
38 Double_t px =
Tx() * pz;
39 Double_t py =
Ty() * pz;
40 mom.SetXYZ(px, py, pz);
45 fT[0] = param->GetX();
46 fT[1] = param->GetY();
47 fT[2] = param->GetTx();
48 fT[3] = param->GetTy();
49 fT[4] = param->GetQp();
50 fT[5] = param->GetZ();
51 for (Int_t
i = 0, iCov = 0;
i < 5;
i++)
52 for (Int_t j = 0; j <=
i; j++, iCov++)
53 fC[iCov] = param->GetCovariance(
i, j);
61 for (
int i = 0;
i < 6;
i++)
63 for (
int i = 0;
i < 15;
i++)
68 if (&other ==
this)
return *
this;
69 for (
int i = 0;
i < 6;
i++)
71 for (
int i = 0;
i < 15;
i++)
79 if (
fabs(
fT[5] - z) < 1.e-5)
return 0;
81 if (!
fgField || (300 <= z && 300 <=
fT[5])) {
88 if (
fT[5] < 300. && 300. < z) { zz = 300.; }
90 while (!err && repeat) {
91 const Double_t max_step = 5.;
93 if (
fabs(
fT[5] - zz) > max_step)
94 zzz =
fT[5] + ((zz >
fT[5]) ? max_step : -max_step);
119 Double_t dz = z_out -
fT[5];
125 const Double_t dzC_in8 = dz *
fC[8];
127 fC[4] =
fC[4] + dzC_in8;
128 fC[1] =
fC[1] + dz * (
fC[4] +
fC[6]);
130 const Double_t C_in3 =
fC[3];
132 fC[3] = C_in3 + dz *
fC[5];
133 fC[0] =
fC[0] + dz * (
fC[3] + C_in3);
135 const Double_t C_in7 =
fC[7];
137 fC[7] = C_in7 + dz *
fC[9];
138 fC[2] =
fC[2] + dz * (
fC[7] + C_in7);
139 fC[6] =
fC[6] + dzC_in8;
143 const Double_t
c_light = 0.000299792458;
145 static Double_t a[4] = {0.0, 0.5, 0.5, 1.0};
146 static Double_t c[4] = {1.0 / 6.0, 1.0 / 3.0, 1.0 / 3.0, 1.0 / 6.0};
147 static Double_t b[4] = {0.0, 0.5, 0.5, 1.0};
150 Double_t k[16], x0[4],
x[4], k1[16];
151 Double_t Ax[4], Ay[4], Ax_tx[4], Ay_tx[4], Ax_ty[4], Ay_ty[4];
155 Double_t qp_in =
fT[4];
156 Double_t z_in =
fT[5];
157 Double_t
h = z_out - z_in;
170 for (step = 0; step < 4; ++step) {
171 for (
i = 0;
i < 4; ++
i) {
175 x[
i] = x0[
i] + b[step] * k[step * 4 - 4 +
i];
179 Double_t point[3] = {
x[0],
x[1], z_in + a[step] *
h};
182 fgField->GetFieldValue(point, B);
184 B[0] = B[1] = B[2] = 0.;
189 Double_t tx2 = tx * tx;
190 Double_t ty2 = ty * ty;
191 Double_t txty = tx * ty;
192 Double_t tx2ty21 = 1.0 + tx2 + ty2;
193 if (tx2ty21 > 1.e4)
return 1;
194 Double_t I_tx2ty21 = 1.0 / tx2ty21 *
Qp();
195 Double_t tx2ty2 =
sqrt(tx2ty21);
198 Double_t tx2ty2qp = tx2ty2 *
Qp();
199 Ax[step] = (txty * B[0] + ty * B[2] - (1.0 + tx2) * B[1]) * tx2ty2;
200 Ay[step] = (-txty * B[1] - tx * B[2] + (1.0 + ty2) * B[0]) * tx2ty2;
203 Ax[step] * tx * I_tx2ty21 + (ty * B[0] - 2.0 * tx * B[1]) * tx2ty2qp;
204 Ax_ty[step] = Ax[step] * ty * I_tx2ty21 + (tx * B[0] + B[2]) * tx2ty2qp;
205 Ay_tx[step] = Ay[step] * tx * I_tx2ty21 + (-ty * B[1] - B[2]) * tx2ty2qp;
207 Ay[step] * ty * I_tx2ty21 + (-tx * B[1] + 2.0 * ty * B[0]) * tx2ty2qp;
211 k[step4 + 1] = ty *
h;
212 k[step4 + 2] = Ax[step] *
Qp();
213 k[step4 + 3] = Ay[step] *
Qp();
217 for (
i = 0;
i < 4; ++
i) {
218 fT[
i] = x0[
i] + c[0] * k[
i] + c[1] * k[4 +
i] + c[2] * k[8 +
i]
234 for (step = 0; step < 4; ++step) {
235 for (
i = 0;
i < 4; ++
i) {
239 x[
i] = x0[
i] + b[step] * k1[step * 4 - 4 +
i];
243 k1[step4] =
x[2] *
h;
244 k1[step4 + 1] =
x[3] *
h;
245 k1[step4 + 2] = Ax[step] + Ax_tx[step] *
x[2] + Ax_ty[step] *
x[3];
246 k1[step4 + 3] = Ay[step] + Ay_tx[step] *
x[2] + Ay_ty[step] *
x[3];
252 for (
i = 0;
i < 4; ++
i) {
253 J[20 +
i] = x0[
i] + c[0] * k1[
i] + c[1] * k1[4 +
i] + c[2] * k1[8 +
i]
273 for (step = 0; step < 4; ++step) {
274 for (
i = 0;
i < 4; ++
i) {
278 x[
i] = x0[
i] + b[step] * k1[step * 4 - 4 +
i];
282 k1[step4] =
x[2] *
h;
283 k1[step4 + 1] =
x[3] *
h;
285 k1[step4 + 3] = Ay_tx[step] *
x[2] + Ay_ty[step] *
x[3];
289 for (
i = 0;
i < 4; ++
i) {
291 J[10 +
i] = x0[
i] + c[0] * k1[
i] + c[1] * k1[4 +
i] + c[2] * k1[8 +
i]
311 for (step = 0; step < 4; ++step) {
312 for (
i = 0;
i < 4; ++
i) {
316 x[
i] = x0[
i] + b[step] * k1[step * 4 - 4 +
i];
320 k1[step4] =
x[2] *
h;
321 k1[step4 + 1] =
x[3] *
h;
322 k1[step4 + 2] = Ax_tx[step] *
x[2] + Ax_ty[step] *
x[3];
327 for (
i = 0;
i < 3; ++
i) {
328 J[15 +
i] = x0[
i] + c[0] * k1[
i] + c[1] * k1[4 +
i] + c[2] * k1[8 +
i]
338 for (
i = 0;
i < 10; ++
i) {
348 Double_t dqp = qp_in -
Qp();
351 for (Int_t ip = 0; ip < 4; ip++) {
352 fT[ip] += J[5 * 4 + ip] * dqp;
368 for (
int i = 0;
i < 6;
i++)
369 ok = ok && !TMath::IsNaN(
fT[
i]) && (
fT[
i] < 1.e5);
370 for (
int i = 0;
i < 15;
i++)
371 ok = ok && !TMath::IsNaN(
fC[
i]);
373 for (
int i = 0;
i < 15;
i++)
375 fC[0] =
fC[2] =
fC[5] =
fC[9] =
fC[14] = 100.;
379 const Double_t
c_light = 0.000299792458;
382 Double_t z_in =
fT[5];
383 Double_t dz = z_out - z_in;
390 xx =
x *
x, xy =
x *
y, yy =
y *
y, x2 =
x * 2, x4 =
x * 4,
391 xx31 = xx * 3 + 1, xx159 = xx * 15 + 9, y2 =
y * 2;
393 Double_t Ax = xy, Ay = -xx - 1, Az =
y, Ayy =
x * (xx * 3 + 3), Ayz = -2 * xy,
394 Ayyy = -(15 * xx * xx + 18 * xx + 3),
396 Ax_x =
y, Ay_x = -x2, Az_x = 0, Ayy_x = 3 * xx31, Ayz_x = -y2,
397 Ayyy_x = -x4 * xx159,
399 Ax_y =
x, Ay_y = 0, Az_y = 1, Ayy_y = 0, Ayz_y = -x2, Ayyy_y = 0,
401 Bx = yy + 1, By = -xy, Bz = -
x, Byy =
y * xx31, Byz = 2 * xx + 1,
404 Bx_x = 0, By_x = -
y, Bz_x = -1, Byy_x = 6 * xy, Byz_x = x4,
405 Byyy_x = -
y * (45 * xx + 9),
407 Bx_y = y2, By_y = -
x, Bz_y = 0, Byy_y = xx31, Byz_y = 0,
412 Double_t t2 = 1. + xx + yy;
413 if (t2 > 1.e4)
return 1;
416 Double_t sx = 0, sy = 0, sz = 0, syy = 0, syz = 0, syyy = 0, Sx = 0, Sy = 0,
417 Sz = 0, Syy = 0, Syz = 0, Syyy = 0;
422 Double_t r0[3], r1[3], r2[3];
430 r2[0] =
fT[0] +
fT[2] * dz;
431 r2[1] =
fT[1] +
fT[3] * dz;
434 r1[0] = 0.5 * (r0[0] + r2[0]);
435 r1[1] = 0.5 * (r0[1] + r2[1]);
436 r1[2] = 0.5 * (r0[2] + r2[2]);
438 fgField->GetFieldValue(r0, B[0]);
439 fgField->GetFieldValue(r1, B[1]);
440 fgField->GetFieldValue(r2, B[2]);
442 Sy = (7 * B[0][1] + 6 * B[1][1] - B[2][1]) * dz * dz / 96.;
443 r1[0] =
fT[0] +
x * dz / 2 + ht * Sy * Ay;
444 r1[1] =
fT[1] +
y * dz / 2 + ht * Sy * By;
446 Sy = (B[0][1] + 2 * B[1][1]) * dz * dz / 6.;
447 r2[0] =
fT[0] +
x * dz + ht * Sy * Ay;
448 r2[1] =
fT[1] +
y * dz + ht * Sy * By;
454 fgField->GetFieldValue(r0, B[0]);
455 fgField->GetFieldValue(r1, B[1]);
456 fgField->GetFieldValue(r2, B[2]);
458 sx = (B[0][0] + 4 * B[1][0] + B[2][0]) * dz / 6.;
459 sy = (B[0][1] + 4 * B[1][1] + B[2][1]) * dz / 6.;
460 sz = (B[0][2] + 4 * B[1][2] + B[2][2]) * dz / 6.;
462 Sx = (B[0][0] + 2 * B[1][0]) * dz * dz / 6.;
463 Sy = (B[0][1] + 2 * B[1][1]) * dz * dz / 6.;
464 Sz = (B[0][2] + 2 * B[1][2]) * dz * dz / 6.;
466 Double_t c2[3][3] = {{5, -4, -1}, {44, 80, -4}, {11, 44, 5}};
467 Double_t C2[3][3] = {{38, 8, -4}, {148, 208, -20}, {3, 36, 3}};
468 for (Int_t n = 0; n < 3; n++)
469 for (Int_t
m = 0;
m < 3;
m++) {
470 syz += c2[n][
m] * B[n][1] * B[
m][2];
471 Syz += C2[n][
m] * B[n][1] * B[
m][2];
474 syz *= dz * dz / 360.;
475 Syz *= dz * dz * dz / 2520.;
477 syy = (B[0][1] + 4 * B[1][1] + B[2][1]) * dz;
478 syyy = syy * syy * syy / 1296;
479 syy = syy * syy / 72;
481 Syy = (B[0][1] * (38 * B[0][1] + 156 * B[1][1] - B[2][1])
482 + B[1][1] * (208 * B[1][1] + 16 * B[2][1]) + B[2][1] * (3 * B[2][1]))
483 * dz * dz * dz / 2520.;
485 * (B[0][1] * (85 * B[0][1] + 526 * B[1][1] - 7 * B[2][1])
486 + B[1][1] * (1376 * B[1][1] + 84 * B[2][1])
487 + B[2][1] * (19 * B[2][1]))
489 * (B[1][1] * (1376 * B[1][1] + 256 * B[2][1])
490 + B[2][1] * (62 * B[2][1]))
491 + B[2][1] * B[2][1] * (3 * B[2][1]))
492 * dz * dz * dz * dz / 90720.;
497 sA1 = sx * Ax + sy * Ay + sz * Az,
498 sA1_x = sx * Ax_x + sy * Ay_x + sz * Az_x,
499 sA1_y = sx * Ax_y + sy * Ay_y + sz * Az_y,
501 sB1 = sx * Bx + sy * By + sz * Bz,
502 sB1_x = sx * Bx_x + sy * By_x + sz * Bz_x,
503 sB1_y = sx * Bx_y + sy * By_y + sz * Bz_y,
505 SA1 = Sx * Ax + Sy * Ay + Sz * Az,
506 SA1_x = Sx * Ax_x + Sy * Ay_x + Sz * Az_x,
507 SA1_y = Sx * Ax_y + Sy * Ay_y + Sz * Az_y,
509 SB1 = Sx * Bx + Sy * By + Sz * Bz,
510 SB1_x = Sx * Bx_x + Sy * By_x + Sz * Bz_x,
511 SB1_y = Sx * Bx_y + Sy * By_y + Sz * Bz_y,
513 sA2 = syy * Ayy + syz * Ayz, sA2_x = syy * Ayy_x + syz * Ayz_x,
514 sA2_y = syy * Ayy_y + syz * Ayz_y, sB2 = syy * Byy + syz * Byz,
515 sB2_x = syy * Byy_x + syz * Byz_x, sB2_y = syy * Byy_y + syz * Byz_y,
517 SA2 = Syy * Ayy + Syz * Ayz, SA2_x = Syy * Ayy_x + Syz * Ayz_x,
518 SA2_y = Syy * Ayy_y + Syz * Ayz_y, SB2 = Syy * Byy + Syz * Byz,
519 SB2_x = Syy * Byy_x + Syz * Byz_x, SB2_y = Syy * Byy_y + Syz * Byz_y,
521 sA3 = syyy * Ayyy, sA3_x = syyy * Ayyy_x, sA3_y = syyy * Ayyy_y,
522 sB3 = syyy * Byyy, sB3_x = syyy * Byyy_x, sB3_y = syyy * Byyy_y,
524 SA3 = Syyy * Ayyy, SA3_x = Syyy * Ayyy_x, SA3_y = Syyy * Ayyy_y,
525 SB3 = Syyy * Byyy, SB3_x = Syyy * Byyy_x, SB3_y = Syyy * Byyy_y;
527 fT[0] =
fT[0] +
x * dz + ht * (SA1 + ht * (SA2 + ht * SA3));
528 fT[1] =
fT[1] +
y * dz + ht * (SB1 + ht * (SB2 + ht * SB3));
529 fT[2] =
fT[2] + ht * (sA1 + ht * (sA2 + ht * sA3));
530 fT[3] =
fT[3] + ht * (sB1 + ht * (sB2 + ht * sB3));
533 T_out[0] =
fT[0] +
x * dz + ht * (SA1 + ht * (SA2 + ht * SA3));
534 T_out[1] =
fT[1] +
y * dz + ht * (SB1 + ht * (SB2 + ht * SB3));
535 T_out[2] =
fT[2] + ht * (sA1 + ht * (sA2 + ht * sA3));
536 T_out[3] =
fT[3] + ht * (sB1 + ht * (sB2 + ht * sB3));
560 J[10] = dz +
h *
x * (1. / t * SA1 +
h * (2 * SA2 + 3 * ht * SA3))
561 + ht * (SA1_x + ht * (SA2_x + ht * SA3_x));
562 J[11] =
h *
x * (1. / t * SB1 +
h * (2 * SB2 + 3 * ht * SB3))
563 + ht * (SB1_x + ht * (SB2_x + ht * SB3_x));
564 J[12] = 1 +
h *
x * (1. / t * sA1 +
h * (2 * sA2 + 3 * ht * sA3))
565 + ht * (sA1_x + ht * (sA2_x + ht * sA3_x));
566 J[13] =
h *
x * (1. / t * sB1 +
h * (2 * sB2 + 3 * ht * sB3))
567 + ht * (sB1_x + ht * (sB2_x + ht * sB3_x));
572 J[15] =
h *
y * (1. / t * SA1 +
h * (2 * SA2 + 3 * ht * SA3))
573 + ht * (SA1_y + ht * (SA2_y + ht * SA3_y));
574 J[16] = dz +
h *
y * (1. / t * SB1 +
h * (2 * SB2 + 3 * ht * SB3))
575 + ht * (SB1_y + ht * (SB2_y + ht * SB3_y));
576 J[17] =
h *
y * (1. / t * sA1 +
h * (2 * sA2 + 3 * ht * sA3))
577 + ht * (sA1_y + ht * (sA2_y + ht * sA3_y));
578 J[18] = 1 +
h *
y * (1. / t * sB1 +
h * (2 * sB2 + 3 * ht * sB3))
579 + ht * (sB1_y + ht * (sB2_y + ht * sB3_y));
584 J[20] =
c_light * t * (SA1 + ht * (2 * SA2 + 3 * ht * SA3));
585 J[21] =
c_light * t * (SB1 + ht * (2 * SB2 + 3 * ht * SB3));
586 J[22] =
c_light * t * (sA1 + ht * (2 * sA2 + 3 * ht * sA3));
587 J[23] =
c_light * t * (sB1 + ht * (2 * sB2 + 3 * ht * sB3));
595 Double_t dqp = qp_in -
Qp();
598 for (Int_t
i = 0;
i < 4;
i++) {
599 fT[
i] = T_out[
i] + J[5 * 4 +
i] * dqp;
613 for (Int_t
i = 0, n = 0;
i < N;
i++) {
614 for (Int_t j = 0; j < N; j++, ++n) {
616 for (Int_t k = 0; k < N; ++k)
621 for (Int_t
i = 0;
i < N;
i++) {
622 for (Int_t j = 0; j <=
i; j++) {
625 for (Int_t k = 0; k < N; k++)
626 fC[n] += Q[k * N +
i] * A[k * N + j];