Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-03 00:12:20

0001 #ifndef L1Trigger_TrackFindingTracklet_State_h
0002 #define L1Trigger_TrackFindingTracklet_State_h
0003 
0004 #include "L1Trigger/TrackTrigger/interface/Setup.h"
0005 #include "L1Trigger/TrackFindingTracklet/interface/DataFormats.h"
0006 #include "L1Trigger/TrackFindingTracklet/interface/KalmanFilterFormats.h"
0007 
0008 #include <vector>
0009 #include <numeric>
0010 
0011 namespace trklet {
0012 
0013   // Class to represent a Kalman Filter helix State
0014   class State {
0015   public:
0016     //
0017     struct Stub {
0018       Stub(KalmanFilterFormats* kff, const tt::FrameStub& frame);
0019       StubDR stubDR_;
0020       double H12_;
0021       double H04_;
0022       double v0_;
0023       double v1_;
0024     };
0025     // copy constructor
0026     State(State* state);
0027     // proto state constructor
0028     State(KalmanFilterFormats* kff, TrackDR* track, const std::vector<Stub*>& stubs, int trackId);
0029     // updated state constructor
0030     State(State* state, const std::vector<double>& doubles);
0031     // combinatoric and seed building state constructor
0032     State(State* state, State* parent, int layer);
0033     ~State() = default;
0034     //
0035     State* comb(std::deque<State>& states, int layer);
0036     //
0037     State* combSeed(std::deque<State>& states, int layer);
0038     //
0039     State* update(std::deque<State>& states, int layer);
0040     // input track
0041     TrackDR* track() const { return track_; }
0042     // parent state (nullpointer if no parent available)
0043     State* parent() const { return parent_; }
0044     // stub to add to state
0045     Stub* stub() const { return stub_; }
0046     // hitPattern of so far added stubs
0047     const TTBV& hitPattern() const { return hitPattern_; }
0048     // shows which layer the found track has stubs on
0049     const TTBV& trackPattern() const { return trackPattern_; }
0050     // track id of input track
0051     int trackId() const { return trackId_; }
0052     // helix inv2R wrt input helix
0053     double x0() const { return x0_; }
0054     // helix phi at radius ChosenRofPhi wrt input helix
0055     double x1() const { return x1_; }
0056     // helix cot(Theta) wrt input helix
0057     double x2() const { return x2_; }
0058     // helix z at radius chosenRofZ wrt input helix
0059     double x3() const { return x3_; }
0060     //
0061     double x4() const { return x4_; }
0062     // cov. matrix element
0063     double C00() const { return C00_; }
0064     // cov. matrix element
0065     double C01() const { return C01_; }
0066     // cov. matrix element
0067     double C11() const { return C11_; }
0068     // cov. matrix element
0069     double C22() const { return C22_; }
0070     // cov. matrix element
0071     double C23() const { return C23_; }
0072     // cov. matrix element
0073     double C33() const { return C33_; }
0074     double C44() const { return C44_; }
0075     double C40() const { return C40_; }
0076     double C41() const { return C41_; }
0077     // Derivative of predicted stub coords wrt helix params: stub radius minus chosenRofPhi
0078     double H00() const { return stub_->stubDR_.r(); }
0079     // Derivative of predicted stub coords wrt helix params: stub radius minus chosenRofZ
0080     double H12() const { return stub_->H12_; }
0081     //
0082     double H04() const { return stub_->H04_; }
0083     // stub phi residual wrt input helix
0084     double m0() const { return stub_->stubDR_.phi(); }
0085     // stub z residual wrt input helix
0086     double m1() const { return stub_->stubDR_.z(); }
0087     // stub projected phi uncertainty
0088     double d0() const { return stub_->stubDR_.dPhi(); }
0089     // stub projected z uncertainty
0090     double d1() const { return stub_->stubDR_.dZ(); }
0091     // squared stub projected phi uncertainty instead of wheight (wrong but simpler)
0092     double v0() const { return stub_->v0_; }
0093     // squared stub projected z uncertainty instead of wheight (wrong but simpler)
0094     double v1() const { return stub_->v1_; }
0095     // layer of current to add stub
0096     int layer() const { return std::distance(stubs_.begin(), std::find(stubs_.begin(), stubs_.end(), stub_)); }
0097     //
0098     std::vector<Stub*> stubs() const { return stubs_; }
0099 
0100   private:
0101     // provides data fomats
0102     KalmanFilterFormats* kff_;
0103     // provides run-time constants
0104     const tt::Setup* setup_;
0105     // input track
0106     TrackDR* track_;
0107     // input track stubs
0108     std::vector<Stub*> stubs_;
0109     // track id
0110     int trackId_;
0111     // previous state, nullptr for first states
0112     State* parent_;
0113     // stub to add
0114     Stub* stub_;
0115     // shows which layer has been added so far
0116     TTBV hitPattern_;
0117     // shows which layer the found track has stubs on
0118     TTBV trackPattern_;
0119     // helix inv2R wrt input helix
0120     double x0_;
0121     // helix phi at radius ChosenRofPhi wrt input helix
0122     double x1_;
0123     // helix cot(Theta) wrt input helix
0124     double x2_;
0125     // helix z at radius chosenRofZ wrt input helix
0126     double x3_;
0127     // impact parameter in 1/cm
0128     double x4_;
0129     // cov. matrix
0130     double C00_;
0131     double C01_;
0132     double C11_;
0133     double C22_;
0134     double C23_;
0135     double C33_;
0136     double C44_;
0137     double C40_;
0138     double C41_;
0139   };
0140 
0141 }  // namespace trklet
0142 
0143 #endif