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