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 {
9  struct ModuleInfo;
10 }
11 
12 namespace mkfit::mini_propagators {
13 
15 
16  struct State {
17  float x, y, z;
18  float px, py, pz;
19  float dalpha;
20  int fail_flag;
21 
22  State() = default;
23  State(const MPlexLV& par, int ti);
24  };
25 
26  struct InitialState : public State {
27  float inv_pt, inv_k;
28  float theta;
29 
30  InitialState(const MPlexLV& par, const MPlexQI& chg, int ti)
31  : InitialState(State(par, ti), chg.constAt(ti, 0, 0), par.constAt(ti, 3, 0), par.constAt(ti, 5, 0)) {}
32 
33  InitialState(State s, short charge, float ipt, float tht, float bf = Config::Bfield)
34  : State(s), inv_pt(ipt), theta(tht) {
35  inv_k = ((charge < 0) ? 0.01f : -0.01f) * Const::sol * bf;
36  }
37 
38  bool propagate_to_r(PropAlgo_e algo, float R, State& c, bool update_momentum) const;
39  bool propagate_to_z(PropAlgo_e algo, float Z, State& c, bool update_momentum) const;
40 
41  bool propagate_to_plane(PropAlgo_e algo, const ModuleInfo& mi, State& c, bool update_momentum) const;
42  };
43 
44  //-----------------------------------------------------------
45  // Vectorized version
46  //-----------------------------------------------------------
47 
48  using MPF = MPlexQF;
49  using MPI = MPlexQI;
50 
51  MPF fast_atan2(const MPF& y, const MPF& x);
52  MPF fast_tan(const MPF& a);
53  void fast_sincos(const MPF& a, MPF& s, MPF& c);
54 
55  struct StatePlex {
56  MPF x, y, z;
57  MPF px, py, pz;
60 
61  StatePlex() = default;
62  StatePlex(const MPlexLV& par);
63  };
64 
65  struct InitialStatePlex : public StatePlex {
68 
69  InitialStatePlex(const MPlexLV& par, const MPI& chg)
70  : InitialStatePlex(StatePlex(par), chg, par.ReduceFixedIJ(3, 0), par.ReduceFixedIJ(5, 0)) {}
71 
73  : StatePlex(s), inv_pt(ipt), theta(tht) {
74  for (int i = 0; i < inv_k.kTotSize; ++i) {
75  inv_k[i] = ((charge[i] < 0) ? 0.01f : -0.01f) * Const::sol * bf;
76  }
77  }
78 
79  int propagate_to_r(PropAlgo_e algo, const MPF& R, StatePlex& c, bool update_momentum, int N_proc = NN) const;
80  int propagate_to_z(PropAlgo_e algo, const MPF& Z, StatePlex& c, bool update_momentum, int N_proc = NN) const;
81  };
82 
83 }; // namespace mkfit::mini_propagators
84 
85 #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:54
bool propagate_to_z(PropAlgo_e algo, float Z, State &c, bool update_momentum) const
constexpr Matriplex::idx_t NN
Definition: Matrix.h:48
MPF fast_tan(const MPF &a)
constexpr float Bfield
Definition: Config.h:60
bool propagate_to_plane(PropAlgo_e algo, const ModuleInfo &mi, State &c, bool update_momentum) const
double f[11][100]
InitialStatePlex(const MPlexLV &par, const MPI &chg)
Matriplex::Matriplex< int, 1, 1, NN > MPlexQI
Definition: Matrix.h:81
constexpr float sol
Definition: Config.h:13
Matriplex::Matriplex< float, 1, 1, NN > MPlexQF
Definition: Matrix.h:80
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