Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-21 23:14:17

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