|
10 | 10 | // or submit itself to any jurisdiction. |
11 | 11 |
|
12 | 12 | #include "ReconstructionDataFormats/TrackFwd.h" |
| 13 | +#include "ReconstructionDataFormats/TrackParametrization.h" |
| 14 | +#include "ReconstructionDataFormats/TrackParametrizationWithError.h" |
13 | 15 | #include "Math/MatrixFunctions.h" |
14 | 16 | #include <GPUCommonLogger.h> |
15 | 17 |
|
@@ -41,7 +43,7 @@ void TrackParFwd::propagateParamToZlinear(double zEnd) |
41 | 43 | auto dZ = (zEnd - getZ()); |
42 | 44 | auto phi0 = getPhi(); |
43 | 45 | auto [sinphi0, cosphi0] = o2::math_utils::sincosd(phi0); |
44 | | - auto invtanl0 = 1.0 / getTanl(); |
| 46 | + auto invtanl0 = 1.0 / getTgl(); |
45 | 47 | auto n = dZ * invtanl0; |
46 | 48 | mParameters(0) += n * cosphi0; |
47 | 49 | mParameters(1) += n * sinphi0; |
@@ -572,5 +574,79 @@ void TrackParCovFwd::propagateToDCAhelix(double zField, const std::array<double, |
572 | 574 | return; |
573 | 575 | } |
574 | 576 |
|
| 577 | +template <typename T> |
| 578 | +void TrackParFwd::toBarrelTrackPar(TrackParametrization<T>& t) const |
| 579 | +{ |
| 580 | + // we select the barrel frame with alpha = phi, then by construction the snp is 0 |
| 581 | + auto alpha = getPhi(); |
| 582 | + auto csa = TMath::Cos(alpha), sna = TMath::Sin(alpha); |
| 583 | + t.setAlpha(alpha); |
| 584 | + t.setX(csa * getX() + sna * getY()); |
| 585 | + t.setY(-sna * getX() + csa * getY()); |
| 586 | + t.setZ(getZ()); |
| 587 | + t.setSnp(0); |
| 588 | + t.setTgl(getTanl()); |
| 589 | + t.setQ2Pt(getInvQPt()); |
| 590 | +} |
| 591 | + |
| 592 | +template <typename T> |
| 593 | +void TrackParCovFwd::toBarrelTrackParCov(TrackParametrizationWithError<T>& t) const |
| 594 | +{ |
| 595 | + // We select the barrel frame with alpha = phi, then by construction the snp is 0 |
| 596 | + auto alpha = getPhi(); |
| 597 | + auto csa = TMath::Cos(alpha), sna = TMath::Sin(alpha); |
| 598 | + t.setAlpha(alpha); |
| 599 | + t.setX(csa * getX() + sna * getY()); |
| 600 | + t.setY(-sna * getX() + csa * getY()); |
| 601 | + t.setZ(getZ()); |
| 602 | + t.setSnp(0); |
| 603 | + t.setTgl(getTgl()); |
| 604 | + t.setQ2Pt(getInvQPt()); |
| 605 | + /* |
| 606 | + The standard Jacobian d{barrel_param} / d{fwd_param} should be augmented by the "forward" uncertainty |
| 607 | + in X_barrel translated to uncertainty in Z, i.e: |
| 608 | + A fwd param variation delta_x, delta_y leads to barrel frame coordinate variaion |
| 609 | + delta_xb = csa delta_x + sna delta_y |
| 610 | + delta_yb = -sna delta_x + csa delta_y |
| 611 | + with dx_b/dz = csp/tgL = 1/tgL, dy_b/dz = snp/tgL = 0 (for phi 0 in the tracking frame) the variation of delta_xb would require |
| 612 | + a shift in delta_zb = -tgL delta_xb to stat at the same X. |
| 613 | + So, for alpha=phi (-> snp=0) choice the full Jacobian fwd->barrel is: |
| 614 | + / -sna csa 0 0 0 \ |
| 615 | + | -tgL*csa -tgL*sna 0 0 0 | |
| 616 | + | 0 0 1 0 0 | |
| 617 | + | 0 0 0 1 0 | |
| 618 | + \ 0 0 0 0 1 / |
| 619 | + */ |
| 620 | + const T a1 = -sna; |
| 621 | + const T a2 = csa; |
| 622 | + const T b1 = -getTgl() * csa; |
| 623 | + const T b2 = -getTgl() * sna; |
| 624 | + const T cphi = 1; |
| 625 | + const auto& C = getCovariances(); |
| 626 | + typename TrackParametrizationWithError<T>::covMat_t covBarrel = { |
| 627 | + T(a1 * a1 * C(0, 0) + 2 * a1 * a2 * C(0, 1) + a2 * a2 * C(1, 1)), // kSigY2 |
| 628 | + T(a1 * b1 * C(0, 0) + (a1 * b2 + a2 * b1) * C(0, 1) + a2 * b2 * C(1, 1)), // kSigZY |
| 629 | + T(b1 * b1 * C(0, 0) + 2 * b1 * b2 * C(0, 1) + b2 * b2 * C(1, 1)), // kSigZ2 |
| 630 | + T(csa * (a1 * C(0, 2) + a2 * C(1, 2))), // kSigSnpY |
| 631 | + T(csa * (b1 * C(0, 2) + b2 * C(1, 2))), // kSigSnpZ |
| 632 | + T(csa * csa * C(2, 2)), // kSigSnp2 |
| 633 | + T(a1 * C(0, 3) + a2 * C(1, 3)), // kSigTglY |
| 634 | + T(b1 * C(0, 3) + b2 * C(1, 3)), // kSigTglZ |
| 635 | + T(csa * C(2, 3)), // kSigTglSnp |
| 636 | + T(C(3, 3)), // kSigTgl2 |
| 637 | + T(a1 * C(0, 4) + a2 * C(1, 4)), // kSigQ2PtY |
| 638 | + T(b1 * C(0, 4) + b2 * C(1, 4)), // kSigQ2PtZ |
| 639 | + T(csa * C(2, 4)), // kSigQ2PtSnp |
| 640 | + T(C(3, 4)), // kSigQ2PtTgl |
| 641 | + T(C(4, 4)) // kSigQ2Pt2 |
| 642 | + }; |
| 643 | + t.setCov(covBarrel); |
| 644 | +} |
| 645 | + |
| 646 | +template void TrackParFwd::toBarrelTrackPar<float>(TrackParametrization<float>&) const; |
| 647 | +template void TrackParFwd::toBarrelTrackPar<double>(TrackParametrization<double>&) const; |
| 648 | +template void TrackParCovFwd::toBarrelTrackParCov<float>(TrackParametrizationWithError<float>&) const; |
| 649 | +template void TrackParCovFwd::toBarrelTrackParCov<double>(TrackParametrizationWithError<double>&) const; |
| 650 | + |
575 | 651 | } // namespace track |
576 | 652 | } // namespace o2 |
0 commit comments