Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-25 02:14:14

0001 #ifndef RecoTracker_MkFitCore_standalone_RntDumper_RntStructs_h
0002 #define RecoTracker_MkFitCore_standalone_RntDumper_RntStructs_h
0003 
0004 #include "RecoTracker/MkFitCore/interface/IdxChi2List.h"
0005 
0006 #include "ROOT/REveVector.hxx"
0007 #include "Math/Point3D.h"
0008 #include "Math/Vector3D.h"
0009 
0010 // From CMSSW data formats
0011 /// point in space with cartesian internal representation
0012 typedef ROOT::Math::PositionVector3D<ROOT::Math::Cartesian3D<float> > XYZPointF;
0013 /// spatial vector with cartesian internal representation
0014 typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float> > XYZVectorF;
0015 /// spatial vector with cylindrical internal representation using pseudorapidity
0016 typedef ROOT::Math::DisplacementVector3D<ROOT::Math::CylindricalEta3D<float> > RhoEtaPhiVectorF;
0017 /// spatial vector with polar internal representation
0018 /// WARNING: ROOT dictionary not provided for the type below
0019 // typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Polar3D<float> > RThetaPhiVectorF;
0020 
0021 using RVec = ROOT::Experimental::REveVector;
0022 
0023 struct HeaderLayer {
0024   int event, iter_idx, iter_algo, eta_region, layer;
0025   float qb_min, qb_max;  // qbar layer limits, r for barrel, z for endcap
0026   bool is_barrel, is_pix, is_stereo;
0027 
0028   HeaderLayer() = default;
0029   HeaderLayer& operator=(const HeaderLayer&) = default;
0030 };
0031 
0032 struct State {
0033   RVec pos, mom;
0034 
0035   State() = default;
0036   State& operator=(const State&) = default;
0037 };
0038 
0039 struct PropState : public State {
0040   float dalpha;  // helix angle during propagation
0041   int fail_flag;
0042 
0043   PropState() = default;
0044   PropState& operator=(const PropState&) = default;
0045 };
0046 
0047 struct SimSeedInfo {
0048   State s_sim;
0049   State s_seed;
0050   int sim_lbl, seed_lbl, seed_idx;
0051   int n_hits, n_match;
0052   bool has_sim = false;
0053 
0054   float good_frac() const { return (float)n_match / n_hits; }
0055 
0056   SimSeedInfo() = default;
0057   SimSeedInfo& operator=(const SimSeedInfo&) = default;
0058 };
0059 
0060 struct BinSearch {
0061   float phi, dphi, q, dq;
0062   short unsigned int p1, p2, q1, q2;
0063   short int wsr;
0064   bool wsr_in_gap;
0065   bool has_nans = false;
0066 
0067   bool nan_check();
0068 
0069   BinSearch() = default;
0070   BinSearch& operator=(const BinSearch&) = default;
0071 };
0072 
0073 struct HitInfo {
0074   RVec hit_pos;
0075   float hit_q, hit_qhalflen, hit_qbar, hit_phi;
0076   int hit_lbl;
0077 
0078   HitInfo() = default;
0079   HitInfo& operator=(const HitInfo&) = default;
0080 };
0081 
0082 struct HitMatchInfo : public HitInfo {
0083   RVec trk_pos, trk_mom;
0084   float ddq, ddphi;
0085   float chi2_true;
0086   int hit_index;
0087   bool match;
0088   bool presel;
0089   bool prop_ok;
0090   bool has_ic2list{false};
0091   mkfit::IdxChi2List ic2list;
0092 
0093   bool accept() const { return presel && prop_ok; }
0094 
0095   HitMatchInfo() = default;
0096   HitMatchInfo& operator=(const HitMatchInfo&) = default;
0097 };
0098 
0099 struct CandInfo {
0100   SimSeedInfo ssi;
0101   State s_ctr;
0102   PropState ps_min, ps_max;
0103   BinSearch bso;
0104   BinSearch bsn;
0105   std::vector<HitMatchInfo> hmi;
0106   int n_all_hits = 0, n_hits_pass = 0, n_hits_match = 0, n_hits_pass_match = 0;
0107   int ord_first_match = -1;
0108   float dphi_first_match = -9999.0f, dq_first_match = -9999.0f;
0109   bool has_nans = false;
0110 
0111   CandInfo(const SimSeedInfo& s, const State& c) : ssi(s), s_ctr(c) {}
0112 
0113   void nan_check();
0114   void reset_hits_match() {
0115     n_all_hits = n_hits_pass = n_hits_match = n_hits_pass_match = 0;
0116     ord_first_match = -1;
0117     dphi_first_match = dq_first_match = -9999.0f;
0118   }
0119 
0120   bool assignIdxChi2List(const mkfit::IdxChi2List& ic2l) {
0121     for (auto& hm : hmi) {
0122       if (hm.hit_index == ic2l.hitIdx) {
0123         hm.has_ic2list = true;
0124         hm.ic2list = ic2l;
0125         return true;
0126       }
0127     }
0128     return false;
0129   }
0130 
0131   CandInfo() = default;
0132   CandInfo& operator=(const CandInfo&) = default;
0133 };
0134 
0135 struct FailedPropInfo {
0136   SimSeedInfo ssi;
0137   State s_prev;
0138   State s_final;
0139   bool has_nans = false;
0140 
0141   FailedPropInfo(const SimSeedInfo& s, const State& p, const State& f) : ssi(s), s_prev(p), s_final(f) {}
0142 
0143   void nan_check();
0144 
0145   FailedPropInfo() = default;
0146   FailedPropInfo& operator=(const FailedPropInfo&) = default;
0147 };
0148 
0149 #endif