CMS 3D CMS Logo

MkBase.h
Go to the documentation of this file.
1 #ifndef RecoTracker_MkFitCore_src_MkBase_h
2 #define RecoTracker_MkFitCore_src_MkBase_h
3 
4 #include "Matrix.h"
5 
6 #include "PropagationMPlex.h"
7 
8 namespace mkfit {
9 
10  class PropagationFlags;
11 
12  //==============================================================================
13  // MkBase
14  //==============================================================================
15 
16  class MkBase {
17  public:
18  static constexpr int iC = 0; // current
19  static constexpr int iP = 1; // propagated
20 
21  float getPar(int itrack, int i, int par) const { return m_Par[i].constAt(itrack, par, 0); }
22 
23  float radiusSqr(int itrack, int i) const { return hipo_sqr(getPar(itrack, i, 0), getPar(itrack, i, 1)); }
24 
25  //----------------------------------------------------------------------------
26 
27  MkBase() {}
28 
29  //----------------------------------------------------------------------------
30 
31  void propagateTracksToR(float r, const int N_proc, const PropagationFlags &pf) {
32  MPlexQF msRad;
33 #pragma omp simd
34  for (int n = 0; n < NN; ++n) {
35  msRad.At(n, 0, 0) = r;
36  }
37 
39  }
40 
41  void propagateTracksToHitR(const MPlexHV &par,
42  const int N_proc,
43  const PropagationFlags &pf,
44  const MPlexQI *noMatEffPtr = nullptr) {
45  MPlexQF msRad;
46 #pragma omp simd
47  for (int n = 0; n < NN; ++n) {
48  msRad.At(n, 0, 0) = std::hypot(par.constAt(n, 0, 0), par.constAt(n, 1, 0));
49  }
50 
52  m_Err[iC], m_Par[iC], m_Chg, msRad, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf, noMatEffPtr);
53  }
54 
55  //----------------------------------------------------------------------------
56 
57  void propagateTracksToZ(float z, const int N_proc, const PropagationFlags &pf) {
58  MPlexQF msZ;
59 #pragma omp simd
60  for (int n = 0; n < NN; ++n) {
61  msZ.At(n, 0, 0) = z;
62  }
63 
65  }
66 
67  void propagateTracksToHitZ(const MPlexHV &par,
68  const int N_proc,
69  const PropagationFlags &pf,
70  const MPlexQI *noMatEffPtr = nullptr) {
71  MPlexQF msZ;
72 #pragma omp simd
73  for (int n = 0; n < NN; ++n) {
74  msZ.At(n, 0, 0) = par.constAt(n, 2, 0);
75  }
76 
78  m_Err[iC], m_Par[iC], m_Chg, msZ, m_Err[iP], m_Par[iP], m_FailFlag, N_proc, pf, noMatEffPtr);
79  }
80 
81  void propagateTracksToPCAZ(const int N_proc, const PropagationFlags &pf) {
82  MPlexQF msZ; // PCA z-coordinate
83 #pragma omp simd
84  for (int n = 0; n < NN; ++n) {
85  const float slope = std::tan(m_Par[iC].constAt(n, 5, 0));
86  // 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
87  msZ.At(n, 0, 0) = (slope * (slope * m_Par[iC].constAt(n, 2, 0) -
88  std::hypot(m_Par[iC].constAt(n, 0, 0), m_Par[iC].constAt(n, 1, 0)))) /
89  (1 + slope * slope); // PCA to origin
90  }
91 
93  }
94 
96 
97  //----------------------------------------------------------------------------
98 
99  protected:
104  };
105 
106 } // end namespace mkfit
107 #endif
float radiusSqr(int itrack, int i) const
Definition: MkBase.h:23
MPlexQI m_Chg
Definition: MkBase.h:102
static constexpr int iC
Definition: MkBase.h:18
void propagateHelixToRMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msRad, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr)
static constexpr int iP
Definition: MkBase.h:19
void propagateTracksToHitZ(const MPlexHV &par, const int N_proc, const PropagationFlags &pf, const MPlexQI *noMatEffPtr=nullptr)
Definition: MkBase.h:67
static const double slope[3]
const T & constAt(idx_t n, idx_t i, idx_t j) const
Definition: Matriplex.h:52
MPlexLV m_Par[2]
Definition: MkBase.h:101
MPlexQI m_FailFlag
Definition: MkBase.h:103
float hipo_sqr(float x, float y)
Definition: Matrix.h:11
void propagateTracksToZ(float z, const int N_proc, const PropagationFlags &pf)
Definition: MkBase.h:57
MPlexLS m_Err[2]
Definition: MkBase.h:100
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
void propagateTracksToHitR(const MPlexHV &par, const int N_proc, const PropagationFlags &pf, const MPlexQI *noMatEffPtr=nullptr)
Definition: MkBase.h:41
void clearFailFlag()
Definition: MkBase.h:95
void propagateTracksToPCAZ(const int N_proc, const PropagationFlags &pf)
Definition: MkBase.h:81
void propagateHelixToZMPlex(const MPlexLS &inErr, const MPlexLV &inPar, const MPlexQI &inChg, const MPlexQF &msZ, MPlexLS &outErr, MPlexLV &outPar, MPlexQI &outFailFlag, const int N_proc, const PropagationFlags &pflags, const MPlexQI *noMatEffPtr)
void setVal(T v)
Definition: Matriplex.h:31
void propagateTracksToR(float r, const int N_proc, const PropagationFlags &pf)
Definition: MkBase.h:31
T & At(idx_t n, idx_t i, idx_t j)
Definition: Matriplex.h:54
float getPar(int itrack, int i, int par) const
Definition: MkBase.h:21