Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1Trigger_TrackFindingTracklet_interface_TrackletEngineUnit_h
0002 #define L1Trigger_TrackFindingTracklet_interface_TrackletEngineUnit_h
0003 
0004 #include "L1Trigger/TrackFindingTracklet/interface/VMStubsTEMemory.h"
0005 #include "L1Trigger/TrackFindingTracklet/interface/CircularBuffer.h"
0006 #include "L1Trigger/TrackFindingTracklet/interface/TrackletLUT.h"
0007 
0008 #include <cassert>
0009 #include <vector>
0010 
0011 namespace trklet {
0012 
0013   class Settings;
0014   class Stub;
0015   class L1TStub;
0016   class FPGAWord;
0017 
0018   struct TEData {
0019     const Stub* stub_;
0020     int start_;
0021     int rzbinfirst_;
0022     int rzdiffmax_;
0023     int innerfinephi_;
0024     FPGAWord innerbend_;
0025     std::vector<std::tuple<int, int, int> > regions_;  // next z/r bin; phi-region; nstub
0026   };
0027 
0028   class TrackletEngineUnit {
0029   public:
0030     TrackletEngineUnit(const Settings* const settings,
0031                        unsigned int nbitsfinephi,
0032                        unsigned int layerdisk1,
0033                        unsigned int layerdisk2,
0034                        unsigned int iSeed,
0035                        unsigned int nbitsfinephiediff,
0036                        unsigned int iAllStub,
0037                        const TrackletLUT* pttableinnernew,
0038                        const TrackletLUT* pttableouternew,
0039                        VMStubsTEMemory* outervmstubs);
0040 
0041     ~TrackletEngineUnit() = default;
0042 
0043     void init(const TEData& tedata);
0044 
0045     bool empty() const { return candpairs_.empty(); }
0046 
0047     const std::pair<const Stub*, const Stub*>& read() { return candpairs_.read(); }
0048 
0049     const std::pair<const Stub*, const Stub*>& peek() const { return candpairs_.peek(); }
0050 
0051     bool idle() const { return idle_; }
0052 
0053     void setNearFull() { nearfull_ = candpairs_.nearfull(); }
0054 
0055     void reset();
0056 
0057     void step(bool print, int istep, int iTE);
0058 
0059     int rptr() const { return candpairs_.rptr(); }
0060 
0061     int wptr() const { return candpairs_.wptr(); }
0062 
0063     const Stub* innerStub() const { return tedata_.stub_; }
0064 
0065   private:
0066     VMStubsTEMemory* outervmstubs_;
0067     TEData tedata_;
0068     const Settings* settings_;
0069     unsigned int nbitsfinephi_;
0070     unsigned int layerdisk1_;
0071     unsigned int layerdisk2_;
0072     unsigned int iSeed_;
0073     unsigned int nbitsfinephidiff_;
0074     bool nearfull_;  //initialized at start of each processing step
0075     unsigned int iAllStub_;
0076 
0077     //unsigned int memory slot
0078     unsigned int nreg_;
0079     unsigned int istub_;
0080     unsigned int ireg_;
0081     unsigned int next_;
0082     unsigned int nstub_;
0083 
0084     bool idle_;
0085 
0086     const TrackletLUT* pttableinnernew_;
0087     const TrackletLUT* pttableouternew_;
0088 
0089     std::pair<const Stub*, const Stub*> candpair_, candpair__;
0090     bool goodpair_, goodpair__;
0091 
0092     //save the candidate matches
0093     CircularBuffer<std::pair<const Stub*, const Stub*> > candpairs_;
0094   };  // TrackletEngineUnit
0095 
0096 };  // namespace trklet
0097 #endif