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