File indexing completed on 2024-04-06 12:28:19
0001 #ifndef RecoTracker_MkFitCore_src_MiniPropagators_h
0002 #define RecoTracker_MkFitCore_src_MiniPropagators_h
0003
0004 #include "RecoTracker/MkFitCore/interface/Config.h"
0005 #include "RecoTracker/MkFitCore/interface/MatrixSTypes.h"
0006 #include "Matrix.h"
0007
0008 namespace mkfit::mini_propagators {
0009
0010 enum PropAlgo_e { PA_Line, PA_Quadratic, PA_Exact };
0011
0012 struct State {
0013 float x, y, z;
0014 float px, py, pz;
0015 float dalpha;
0016 int fail_flag;
0017
0018 State() = default;
0019 State(const MPlexLV& par, int ti);
0020 };
0021
0022 struct InitialState : public State {
0023 float inv_pt, inv_k;
0024 float theta;
0025
0026 InitialState(const MPlexLV& par, const MPlexQI& chg, int ti)
0027 : InitialState(State(par, ti), chg.constAt(ti, 0, 0), par.constAt(ti, 3, 0), par.constAt(ti, 5, 0)) {}
0028
0029 InitialState(State s, short charge, float ipt, float tht, float bf = Config::Bfield)
0030 : State(s), inv_pt(ipt), theta(tht) {
0031 inv_k = ((charge < 0) ? 0.01f : -0.01f) * Const::sol * bf;
0032 }
0033
0034 bool propagate_to_r(PropAlgo_e algo, float R, State& c, bool update_momentum) const;
0035 bool propagate_to_z(PropAlgo_e algo, float Z, State& c, bool update_momentum) const;
0036 };
0037
0038
0039
0040
0041
0042 using MPF = MPlexQF;
0043 using MPI = MPlexQI;
0044
0045 MPF fast_atan2(const MPF& y, const MPF& x);
0046 MPF fast_tan(const MPF& a);
0047 void fast_sincos(const MPF& a, MPF& s, MPF& c);
0048
0049 struct StatePlex {
0050 MPF x, y, z;
0051 MPF px, py, pz;
0052 MPF dalpha;
0053 MPI fail_flag{0};
0054
0055 StatePlex() = default;
0056 StatePlex(const MPlexLV& par);
0057 };
0058
0059 struct InitialStatePlex : public StatePlex {
0060 MPF inv_pt, inv_k;
0061 MPF theta;
0062
0063 InitialStatePlex(const MPlexLV& par, const MPI& chg)
0064 : InitialStatePlex(StatePlex(par), chg, par.ReduceFixedIJ(3, 0), par.ReduceFixedIJ(5, 0)) {}
0065
0066 InitialStatePlex(StatePlex s, MPI charge, MPF ipt, MPF tht, float bf = Config::Bfield)
0067 : StatePlex(s), inv_pt(ipt), theta(tht) {
0068 for (int i = 0; i < inv_k.kTotSize; ++i) {
0069 inv_k[i] = ((charge[i] < 0) ? 0.01f : -0.01f) * Const::sol * bf;
0070 }
0071 }
0072
0073 int propagate_to_r(PropAlgo_e algo, const MPF& R, StatePlex& c, bool update_momentum, int N_proc = NN) const;
0074 int propagate_to_z(PropAlgo_e algo, const MPF& Z, StatePlex& c, bool update_momentum, int N_proc = NN) const;
0075 };
0076
0077 };
0078
0079 #endif