Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-17 22:59:04

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 {
0009   struct ModuleInfo;
0010 }
0011 
0012 namespace mkfit::mini_propagators {
0013 
0014   enum PropAlgo_e { PA_Line, PA_Quadratic, PA_Exact };
0015 
0016   struct State {
0017     float x, y, z;
0018     float px, py, pz;
0019     float dalpha;
0020     int fail_flag;
0021 
0022     State() = default;
0023     State(const MPlexLV& par, int ti);
0024   };
0025 
0026   struct InitialState : public State {
0027     float inv_pt, inv_k;
0028     float theta;
0029 
0030     InitialState(const MPlexLV& par, const MPlexQI& chg, int ti)
0031         : InitialState(State(par, ti), chg.constAt(ti, 0, 0), par.constAt(ti, 3, 0), par.constAt(ti, 5, 0)) {}
0032 
0033     InitialState(State s, short charge, float ipt, float tht, float bf = Config::Bfield)
0034         : State(s), inv_pt(ipt), theta(tht) {
0035       inv_k = ((charge < 0) ? 0.01f : -0.01f) * Const::sol * bf;
0036     }
0037 
0038     bool propagate_to_r(PropAlgo_e algo, float R, State& c, bool update_momentum) const;
0039     bool propagate_to_z(PropAlgo_e algo, float Z, State& c, bool update_momentum) const;
0040 
0041     bool propagate_to_plane(PropAlgo_e algo, const ModuleInfo& mi, State& c, bool update_momentum) const;
0042   };
0043 
0044   //-----------------------------------------------------------
0045   // Vectorized version
0046   //-----------------------------------------------------------
0047 
0048   using MPF = MPlexQF;
0049   using MPI = MPlexQI;
0050 
0051   MPF fast_atan2(const MPF& y, const MPF& x);
0052   MPF fast_tan(const MPF& a);
0053   void fast_sincos(const MPF& a, MPF& s, MPF& c);
0054 
0055   struct StatePlex {
0056     MPF x, y, z;
0057     MPF px, py, pz;
0058     MPF dalpha;
0059     MPI fail_flag{0};
0060 
0061     StatePlex() = default;
0062     StatePlex(const MPlexLV& par);
0063   };
0064 
0065   struct InitialStatePlex : public StatePlex {
0066     MPF inv_pt, inv_k;
0067     MPF theta;
0068 
0069     InitialStatePlex(const MPlexLV& par, const MPI& chg)
0070         : InitialStatePlex(StatePlex(par), chg, par.ReduceFixedIJ(3, 0), par.ReduceFixedIJ(5, 0)) {}
0071 
0072     InitialStatePlex(StatePlex s, MPI charge, MPF ipt, MPF tht, float bf = Config::Bfield)
0073         : StatePlex(s), inv_pt(ipt), theta(tht) {
0074       for (int i = 0; i < inv_k.kTotSize; ++i) {
0075         inv_k[i] = ((charge[i] < 0) ? 0.01f : -0.01f) * Const::sol * bf;
0076       }
0077     }
0078 
0079     int propagate_to_r(PropAlgo_e algo, const MPF& R, StatePlex& c, bool update_momentum, int N_proc = NN) const;
0080     int propagate_to_z(PropAlgo_e algo, const MPF& Z, StatePlex& c, bool update_momentum, int N_proc = NN) const;
0081   };
0082 
0083 };  // namespace mkfit::mini_propagators
0084 
0085 #endif