Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-10-14 01:43:51

0001 #ifndef L1Trigger_TrackerTFP_State_h
0002 #define L1Trigger_TrackerTFP_State_h
0003 
0004 #include "L1Trigger/TrackTrigger/interface/Setup.h"
0005 #include "L1Trigger/TrackerTFP/interface/DataFormats.h"
0006 
0007 #include <vector>
0008 #include <numeric>
0009 
0010 namespace trackerTFP {
0011 
0012   // Class to represent a Kalman Filter State
0013   class State {
0014   public:
0015     // default constructor
0016     State(State* state);
0017     // proto state constructor
0018     State(const DataFormats* dataFormats, TrackKFin* track, int trackId);
0019     // combinatoric state constructor
0020     State(State* state, StubKFin* stub);
0021     // updated state constructor
0022     State(State* state, const std::vector<double>& doubles);
0023     ~State() {}
0024 
0025     // Determine quality of completed state
0026     void finish();
0027     // number of skipped layers
0028     int numSkippedLayers() const { return numSkippedLayers_; }
0029     // number of consitent layers
0030     int numConsistentLayers() const { return numConsistentLayers_; }
0031     // input track
0032     TrackKFin* track() const { return track_; }
0033     // parent state (nullpointer if no parent available)
0034     State* parent() const { return parent_; }
0035     // stub to add to state
0036     StubKFin* stub() const { return stub_; }
0037     // hitPattern of so far added stubs
0038     const TTBV& hitPattern() const { return hitPattern_; }
0039     // track id of input track
0040     int trackId() const { return trackId_; }
0041     // pattern of maybe layers for input track
0042     TTBV maybePattern() const { return track_->maybePattern(); }
0043     // stub id per layer of so far added stubs
0044     const std::vector<int>& layerMap() const { return layerMap_; }
0045     // layer id of the current stub to add
0046     int layer() const { return stub_->layer(); }
0047     // helix inv2R wrt input helix
0048     double x0() const { return x0_; }
0049     // helix phi at radius ChosenRofPhi wrt input helix
0050     double x1() const { return x1_; }
0051     // helix cot(Theta) wrt input helix
0052     double x2() const { return x2_; }
0053     // helix z at radius chosenRofZ wrt input helix
0054     double x3() const { return x3_; }
0055     // cov. matrix element
0056     double C00() const { return C00_; }
0057     // cov. matrix element
0058     double C01() const { return C01_; }
0059     // cov. matrix element
0060     double C11() const { return C11_; }
0061     // cov. matrix element
0062     double C22() const { return C22_; }
0063     // cov. matrix element
0064     double C23() const { return C23_; }
0065     // cov. matrix element
0066     double C33() const { return C33_; }
0067     // Derivative of predicted stub coords wrt helix params: stub radius minus chosenRofPhi
0068     double H00() const { return stub_->r(); }
0069     // Derivative of predicted stub coords wrt helix params: stub radius minus chosenRofZ
0070     double H12() const { return stub_->r() + dataFormats_->chosenRofPhi() - setup_->chosenRofZ(); }
0071     // stub phi residual wrt input helix
0072     double m0() const { return stub_->phi(); }
0073     // stub z residual wrt input helix
0074     double m1() const { return stub_->z(); }
0075     // stub projected phi uncertainty
0076     double dPhi() const { return stub_->dPhi(); }
0077     // stub projected z uncertainty
0078     double dZ() const { return stub_->dZ(); }
0079     // squared stub projected phi uncertainty instead of wheight (wrong but simpler)
0080     double v0() const { return pow(stub_->dPhi(), 2); }
0081     // squared stub projected z uncertainty instead of wheight (wrong but simpler)
0082     double v1() const { return pow(stub_->dZ(), 2); }
0083     // output frame
0084     tt::FrameTrack frame() const { return TrackKF(*track_, x1_, x0_, x3_, x2_).frame(); }
0085     // collection of stubs added so far to state
0086     std::vector<StubKF> stubs() const;
0087 
0088   private:
0089     // provides data fomats
0090     const DataFormats* dataFormats_;
0091     // provides run-time constants
0092     const tt::Setup* setup_;
0093     // input track
0094     TrackKFin* track_;
0095     // track id
0096     int trackId_;
0097     // previous state, nullptr for first states
0098     State* parent_;
0099     // stub to add
0100     StubKFin* stub_;
0101     // shows which stub on each layer has been added so far
0102     std::vector<int> layerMap_;
0103     // shows which layer has been added so far
0104     TTBV hitPattern_;
0105     // helix inv2R wrt input helix
0106     double x0_;
0107     // helix phi at radius ChosenRofPhi wrt input helix
0108     double x1_;
0109     // helix cot(Theta) wrt input helix
0110     double x2_;
0111     // helix z at radius chosenRofZ wrt input helix
0112     double x3_;
0113 
0114     // cov. matrix
0115 
0116     double C00_;
0117     double C01_;
0118     double C11_;
0119     double C22_;
0120     double C23_;
0121     double C33_;
0122 
0123     // number of skipped layers
0124     int numSkippedLayers_;
0125     // number of consistent layers
0126     int numConsistentLayers_;
0127   };
0128 
0129 }  // namespace trackerTFP
0130 
0131 #endif