Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-07 22:33:27

0001 #ifndef L1Trigger_TrackFindingTracklet_interface_MatchEngineUnit_h
0002 #define L1Trigger_TrackFindingTracklet_interface_MatchEngineUnit_h
0003 
0004 #include "L1Trigger/TrackFindingTracklet/interface/VMStubsMEMemory.h"
0005 #include "L1Trigger/TrackFindingTracklet/interface/CircularBuffer.h"
0006 #include "L1Trigger/TrackFindingTracklet/interface/Tracklet.h"
0007 #include "L1Trigger/TrackFindingTracklet/interface/MemoryBase.h"
0008 
0009 #include <cassert>
0010 #include <vector>
0011 
0012 namespace trklet {
0013 
0014   class Settings;
0015   class Stub;
0016   class L1TStub;
0017   class TrackletLUT;
0018 
0019   class MatchEngineUnit {
0020   public:
0021     MatchEngineUnit(bool barrel, unsigned int layerdisk, const TrackletLUT& luttable);
0022 
0023     ~MatchEngineUnit() = default;
0024 
0025     void init(VMStubsMEMemory* vmstubsmemory,
0026               unsigned int nrzbin,
0027               unsigned int rzbin,
0028               unsigned int iphi,
0029               int shift,
0030               int projrinv,
0031               int projfinerz,
0032               int projfinephi,
0033               bool usefirstMinus,
0034               bool usefirstPlus,
0035               bool usesecondMinus,
0036               bool usesecondPlus,
0037               bool isPSseed,
0038               Tracklet* proj,
0039               bool print);
0040 
0041     bool empty() const { return candmatches_.empty(); }
0042 
0043     int TCID() const;
0044 
0045     std::pair<Tracklet*, const Stub*> read() { return candmatches_.read(); }
0046 
0047     std::pair<Tracklet*, const Stub*> peek() const { return candmatches_.peek(); }
0048 
0049     Tracklet* currentProj() const { return proj_; }
0050 
0051     bool idle() const { return idle_; }
0052 
0053     bool active() const { return !idle_ || goodpair_ || goodpair__ || !empty(); }
0054 
0055     //needed for consistency with HLS FW version ("_" vs "__" indicating different pipelining stages)
0056     bool have_() const { return havepair_; }
0057     bool have__() const { return havepair__; }
0058 
0059     void reset();
0060 
0061     unsigned int rptr() const { return candmatches_.rptr(); }
0062     unsigned int wptr() const { return candmatches_.wptr(); }
0063 
0064     void step(bool print);
0065 
0066   private:
0067     VMStubsMEMemory* vmstubsmemory_;
0068 
0069     unsigned int nrzbins_;
0070     unsigned int rzbin_;
0071     unsigned int phibin_;
0072     int shift_;
0073 
0074     unsigned int istub_;
0075     unsigned int iuse_;
0076 
0077     bool barrel_;
0078     int projrinv_;
0079     int projfinerz_;
0080     int projfinephi_;
0081     std::vector<std::pair<unsigned int, unsigned int>> use_;
0082     bool isPSseed_;
0083     Tracklet* proj_;
0084 
0085     bool idle_;
0086 
0087     unsigned int layerdisk_;
0088 
0089     //LUT for bend consistency with rinv
0090     const TrackletLUT& luttable_;
0091 
0092     //Pipeline variables
0093     std::pair<Tracklet*, const Stub*> tmppair_, tmppair__;
0094     bool goodpair_, goodpair__;
0095     bool havepair_, havepair__;
0096 
0097     //save the candidate matches
0098     CircularBuffer<std::pair<Tracklet*, const Stub*>> candmatches_;
0099   };
0100 
0101 };  // namespace trklet
0102 #endif