CMS 3D CMS Logo

MiniPropagators.h
Go to the documentation of this file.
1 #ifndef RecoTracker_MkFitCore_src_MiniPropagators_h
2 #define RecoTracker_MkFitCore_src_MiniPropagators_h
3 
6 #include "Matrix.h"
7 
8 namespace mkfit::mini_propagators {
9 
11 
12  struct State {
13  float x, y, z;
14  float px, py, pz;
15  float dalpha;
16  int fail_flag;
17 
18  State() = default;
19  State(const MPlexLV& par, int ti);
20  };
21 
22  struct InitialState : public State {
23  float inv_pt, inv_k;
24  float theta;
25 
26  InitialState(const MPlexLV& par, const MPlexQI& chg, int ti)
27  : InitialState(State(par, ti), chg.constAt(ti, 0, 0), par.constAt(ti, 3, 0), par.constAt(ti, 5, 0)) {}
28 
29  InitialState(State s, short charge, float ipt, float tht, float bf = Config::Bfield)
30  : State(s), inv_pt(ipt), theta(tht) {
31  inv_k = ((charge < 0) ? 0.01f : -0.01f) * Const::sol * bf;
32  }
33 
34  bool propagate_to_r(PropAlgo_e algo, float R, State& c, bool update_momentum) const;
35  bool propagate_to_z(PropAlgo_e algo, float Z, State& c, bool update_momentum) const;
36  };
37 
38  //-----------------------------------------------------------
39  // Vectorized version
40  //-----------------------------------------------------------
41 
42  using MPF = MPlexQF;
43  using MPI = MPlexQI;
44 
45  MPF fast_atan2(const MPF& y, const MPF& x);
46  MPF fast_tan(const MPF& a);
47  void fast_sincos(const MPF& a, MPF& s, MPF& c);
48 
49  struct StatePlex {
50  MPF x, y, z;
51  MPF px, py, pz;
54 
55  StatePlex() = default;
56  StatePlex(const MPlexLV& par);
57  };
58 
59  struct InitialStatePlex : public StatePlex {
62 
63  InitialStatePlex(const MPlexLV& par, const MPI& chg)
64  : InitialStatePlex(StatePlex(par), chg, par.ReduceFixedIJ(3, 0), par.ReduceFixedIJ(5, 0)) {}
65 
67  : StatePlex(s), inv_pt(ipt), theta(tht) {
68  for (int i = 0; i < inv_k.kTotSize; ++i) {
69  inv_k[i] = ((charge[i] < 0) ? 0.01f : -0.01f) * Const::sol * bf;
70  }
71  }
72 
73  int propagate_to_r(PropAlgo_e algo, const MPF& R, StatePlex& c, bool update_momentum, int N_proc = NN) const;
74  int propagate_to_z(PropAlgo_e algo, const MPF& Z, StatePlex& c, bool update_momentum, int N_proc = NN) const;
75  };
76 
77 }; // namespace mkfit::mini_propagators
78 
79 #endif
InitialState(State s, short charge, float ipt, float tht, float bf=Config::Bfield)
const float chg[109]
Definition: CoreSimTrack.cc:5
int propagate_to_r(PropAlgo_e algo, const MPF &R, StatePlex &c, bool update_momentum, int N_proc=NN) const
int propagate_to_z(PropAlgo_e algo, const MPF &Z, StatePlex &c, bool update_momentum, int N_proc=NN) const
Matriplex::Matriplex< float, LL, 1, NN > MPlexLV
Definition: Matrix.h:49
bool propagate_to_z(PropAlgo_e algo, float Z, State &c, bool update_momentum) const
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43
MPF fast_tan(const MPF &a)
constexpr float Bfield
Definition: Config.h:55
double f[11][100]
InitialStatePlex(const MPlexLV &par, const MPI &chg)
Matriplex::Matriplex< int, 1, 1, NN > MPlexQI
Definition: Matrix.h:72
constexpr float sol
Definition: Config.h:13
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:71
double a
Definition: hdecay.h:121
InitialStatePlex(StatePlex s, MPI charge, MPF ipt, MPF tht, float bf=Config::Bfield)
MPF fast_atan2(const MPF &y, const MPF &x)
InitialState(const MPlexLV &par, const MPlexQI &chg, int ti)
void fast_sincos(const MPF &a, MPF &s, MPF &c)
bool propagate_to_r(PropAlgo_e algo, float R, State &c, bool update_momentum) const