File indexing completed on 2024-04-06 12:28:19
0001 #ifndef RecoTracker_MkFitCore_src_MkBase_h
0002 #define RecoTracker_MkFitCore_src_MkBase_h
0003
0004 #include "Matrix.h"
0005
0006 #include "PropagationMPlex.h"
0007
0008 namespace mkfit {
0009
0010 class PropagationFlags;
0011
0012
0013
0014
0015
0016 class MkBase {
0017 public:
0018 static constexpr int iC = 0;
0019 static constexpr int iP = 1;
0020
0021 float getPar(int itrack, int i, int par) const { return m_Par[i].constAt(itrack, par, 0); }
0022
0023 float radiusSqr(int itrack, int i) const { return hipo_sqr(getPar(itrack, i, 0), getPar(itrack, i, 1)); }
0024 float radius(int itrack, int i) const { return hipo(getPar(itrack, i, 0), getPar(itrack, i, 1)); }
0025
0026
0027
0028 MkBase() {}
0029
0030
0031
0032 void propagateTracksToR(float r, const int N_proc, const PropagationFlags &pf) {
0033 MPlexQF msRad;
0034 #pragma omp simd
0035 for (int n = 0; n < NN; ++n) {
0036 msRad.At(n, 0, 0) = r;
0037 }
0038
0039 propagateHelixToRMPlex(m_Err[iC], m_Par[iC], m_Chg, msRad, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf);
0040 }
0041
0042 void propagateTracksToHitR(const MPlexHV &par,
0043 const int N_proc,
0044 const PropagationFlags &pf,
0045 const MPlexQI *noMatEffPtr = nullptr) {
0046 MPlexQF msRad;
0047 #pragma omp simd
0048 for (int n = 0; n < NN; ++n) {
0049 msRad.At(n, 0, 0) = std::hypot(par.constAt(n, 0, 0), par.constAt(n, 1, 0));
0050 }
0051
0052 propagateHelixToRMPlex(
0053 m_Err[iC], m_Par[iC], m_Chg, msRad, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf, noMatEffPtr);
0054 }
0055
0056
0057
0058 void propagateTracksToZ(float z, const int N_proc, const PropagationFlags &pf) {
0059 MPlexQF msZ;
0060 #pragma omp simd
0061 for (int n = 0; n < NN; ++n) {
0062 msZ.At(n, 0, 0) = z;
0063 }
0064
0065 propagateHelixToZMPlex(m_Err[iC], m_Par[iC], m_Chg, msZ, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf);
0066 }
0067
0068 void propagateTracksToHitZ(const MPlexHV &par,
0069 const int N_proc,
0070 const PropagationFlags &pf,
0071 const MPlexQI *noMatEffPtr = nullptr) {
0072 MPlexQF msZ;
0073 #pragma omp simd
0074 for (int n = 0; n < NN; ++n) {
0075 msZ.At(n, 0, 0) = par.constAt(n, 2, 0);
0076 }
0077
0078 propagateHelixToZMPlex(
0079 m_Err[iC], m_Par[iC], m_Chg, msZ, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf, noMatEffPtr);
0080 }
0081
0082 void propagateTracksToPCAZ(const int N_proc, const PropagationFlags &pf) {
0083 MPlexQF msZ;
0084 #pragma omp simd
0085 for (int n = 0; n < NN; ++n) {
0086 const float slope = std::tan(m_Par[iC].constAt(n, 5, 0));
0087
0088 msZ.At(n, 0, 0) = (slope * (slope * m_Par[iC].constAt(n, 2, 0) -
0089 std::hypot(m_Par[iC].constAt(n, 0, 0), m_Par[iC].constAt(n, 1, 0)))) /
0090 (1 + slope * slope);
0091 }
0092
0093 propagateHelixToZMPlex(m_Err[iC], m_Par[iC], m_Chg, msZ, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf);
0094 }
0095
0096 void clearFailFlag() { m_FailFlag.setVal(0); }
0097
0098
0099
0100 protected:
0101 MPlexLS m_Err[2];
0102 MPlexLV m_Par[2];
0103 MPlexQI m_Chg;
0104 MPlexQI m_FailFlag;
0105 };
0106
0107 }
0108 #endif