Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-05-29 02:55: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   // MkBase
0014   //==============================================================================
0015 
0016   class MkBase {
0017   public:
0018     static constexpr int iC = 0;  // current
0019     static constexpr int iP = 1;  // propagated
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 
0025     //----------------------------------------------------------------------------
0026 
0027     MkBase() {}
0028 
0029     //----------------------------------------------------------------------------
0030 
0031     void propagateTracksToR(float r, const int N_proc, const PropagationFlags &pf) {
0032       MPlexQF msRad;
0033 #pragma omp simd
0034       for (int n = 0; n < NN; ++n) {
0035         msRad.At(n, 0, 0) = r;
0036       }
0037 
0038       propagateHelixToRMPlex(m_Err[iC], m_Par[iC], m_Chg, msRad, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf);
0039     }
0040 
0041     void propagateTracksToHitR(const MPlexHV &par,
0042                                const int N_proc,
0043                                const PropagationFlags &pf,
0044                                const MPlexQI *noMatEffPtr = nullptr) {
0045       MPlexQF msRad;
0046 #pragma omp simd
0047       for (int n = 0; n < NN; ++n) {
0048         msRad.At(n, 0, 0) = std::hypot(par.constAt(n, 0, 0), par.constAt(n, 1, 0));
0049       }
0050 
0051       propagateHelixToRMPlex(
0052           m_Err[iC], m_Par[iC], m_Chg, msRad, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf, noMatEffPtr);
0053     }
0054 
0055     //----------------------------------------------------------------------------
0056 
0057     void propagateTracksToZ(float z, const int N_proc, const PropagationFlags &pf) {
0058       MPlexQF msZ;
0059 #pragma omp simd
0060       for (int n = 0; n < NN; ++n) {
0061         msZ.At(n, 0, 0) = z;
0062       }
0063 
0064       propagateHelixToZMPlex(m_Err[iC], m_Par[iC], m_Chg, msZ, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf);
0065     }
0066 
0067     void propagateTracksToHitZ(const MPlexHV &par,
0068                                const int N_proc,
0069                                const PropagationFlags &pf,
0070                                const MPlexQI *noMatEffPtr = nullptr) {
0071       MPlexQF msZ;
0072 #pragma omp simd
0073       for (int n = 0; n < NN; ++n) {
0074         msZ.At(n, 0, 0) = par.constAt(n, 2, 0);
0075       }
0076 
0077       propagateHelixToZMPlex(
0078           m_Err[iC], m_Par[iC], m_Chg, msZ, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf, noMatEffPtr);
0079     }
0080 
0081     void propagateTracksToPCAZ(const int N_proc, const PropagationFlags &pf) {
0082       MPlexQF msZ;  // PCA z-coordinate
0083 #pragma omp simd
0084       for (int n = 0; n < NN; ++n) {
0085         const float slope = std::tan(m_Par[iC].constAt(n, 5, 0));
0086         //      msZ.At(n, 0, 0) = ( Config::beamspotz0 + slope * ( Config::beamspotr0 - std::hypot(m_Par[iC].constAt(n, 0, 0), m_Par[iC].constAt(n, 1, 0))) + slope * slope * m_Par[iC].constAt(n, 2, 0) ) / ( 1+slope*slope); // PCA w.r.t. z0, r0
0087         msZ.At(n, 0, 0) = (slope * (slope * m_Par[iC].constAt(n, 2, 0) -
0088                                     std::hypot(m_Par[iC].constAt(n, 0, 0), m_Par[iC].constAt(n, 1, 0)))) /
0089                           (1 + slope * slope);  // PCA to origin
0090       }
0091 
0092       propagateHelixToZMPlex(m_Err[iC], m_Par[iC], m_Chg, msZ, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf);
0093     }
0094 
0095     void clearFailFlag() { m_FailFlag.setVal(0); }
0096 
0097     //----------------------------------------------------------------------------
0098 
0099   protected:
0100     MPlexLS m_Err[2];
0101     MPlexLV m_Par[2];
0102     MPlexQI m_Chg;
0103     MPlexQI m_FailFlag;
0104   };
0105 
0106 }  // end namespace mkfit
0107 #endif