Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1Trigger_TrackerTFP_KalmanFilter_h
0002 #define L1Trigger_TrackerTFP_KalmanFilter_h
0003 
0004 #include "L1Trigger/TrackTrigger/interface/Setup.h"
0005 #include "L1Trigger/TrackerTFP/interface/DataFormats.h"
0006 #include "L1Trigger/TrackerTFP/interface/KalmanFilterFormats.h"
0007 #include "L1Trigger/TrackerTFP/interface/State.h"
0008 #include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
0009 
0010 #include <deque>
0011 
0012 namespace trackerTFP {
0013 
0014   // Class to do helix fit to all tracks in a region.
0015   class KalmanFilter {
0016   public:
0017     KalmanFilter(const edm::ParameterSet& iConfig,
0018                  const tt::Setup* setup,
0019                  const DataFormats* dataFormats,
0020                  KalmanFilterFormats* kalmanFilterFormats,
0021                  int region);
0022     ~KalmanFilter() {}
0023 
0024     // read in and organize input tracks and stubs
0025     void consume(const tt::StreamsTrack& streamsTrack, const tt::StreamsStub& streamsStub);
0026     // fill output products
0027     void produce(tt::StreamsStub& accpetedStubs,
0028                  tt::StreamsTrack& acceptedTracks,
0029                  tt::StreamsStub& lostStubs,
0030                  tt::StreamsTrack& lostTracks,
0031                  int& numAcceptedStates,
0032                  int& numLostStates);
0033 
0034   private:
0035     // remove and return first element of deque, returns nullptr if empty
0036     template <class T>
0037     T* pop_front(std::deque<T*>& ts) const;
0038     // remove and return first element of vector, returns nullptr if empty
0039     template <class T>
0040     T* pop_front(std::vector<T*>& ts) const;
0041 
0042     // adds a layer to states
0043     void addLayer(std::deque<State*>& stream);
0044     // Assign next combinatoric (i.e. not first in layer) stub to state
0045     void comb(State*& state);
0046     // best state selection
0047     void accumulator(std::deque<State*>& stream);
0048     // updates state
0049     void update(State*& state);
0050 
0051     // true if truncation is enbaled
0052     bool enableTruncation_;
0053     // provides run-time constants
0054     const tt::Setup* setup_;
0055     // provides dataformats
0056     const DataFormats* dataFormats_;
0057     // provides dataformats of Kalman filter internals
0058     KalmanFilterFormats* kalmanFilterFormats_;
0059     // processing region (0 - 8)
0060     int region_;
0061     // container of input stubs
0062     std::vector<StubKFin> stubs_;
0063     // container of input tracks
0064     std::vector<TrackKFin> tracks_;
0065     // container of all Kalman Filter states
0066     std::deque<State> states_;
0067     // h/w liked organized pointer to input stubs
0068     std::vector<std::vector<TrackKFin*>> input_;
0069     // current layer used during state propagation
0070     int layer_;
0071 
0072     // dataformats of Kalman filter internals
0073 
0074     DataFormatKF* x0_;
0075     DataFormatKF* x1_;
0076     DataFormatKF* x2_;
0077     DataFormatKF* x3_;
0078     DataFormatKF* H00_;
0079     DataFormatKF* H12_;
0080     DataFormatKF* m0_;
0081     DataFormatKF* m1_;
0082     DataFormatKF* v0_;
0083     DataFormatKF* v1_;
0084     DataFormatKF* r0_;
0085     DataFormatKF* r1_;
0086     DataFormatKF* S00_;
0087     DataFormatKF* S01_;
0088     DataFormatKF* S12_;
0089     DataFormatKF* S13_;
0090     DataFormatKF* K00_;
0091     DataFormatKF* K10_;
0092     DataFormatKF* K21_;
0093     DataFormatKF* K31_;
0094     DataFormatKF* R00_;
0095     DataFormatKF* R11_;
0096     DataFormatKF* R00Rough_;
0097     DataFormatKF* R11Rough_;
0098     DataFormatKF* invR00Approx_;
0099     DataFormatKF* invR11Approx_;
0100     DataFormatKF* invR00Cor_;
0101     DataFormatKF* invR11Cor_;
0102     DataFormatKF* invR00_;
0103     DataFormatKF* invR11_;
0104     DataFormatKF* C00_;
0105     DataFormatKF* C01_;
0106     DataFormatKF* C11_;
0107     DataFormatKF* C22_;
0108     DataFormatKF* C23_;
0109     DataFormatKF* C33_;
0110   };
0111 
0112 }  // namespace trackerTFP
0113 
0114 #endif