Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-01 23:54:03

0001 
0002 #ifndef L1Trigger_DemonstratorTools_EventData_h
0003 #define L1Trigger_DemonstratorTools_EventData_h
0004 
0005 #include <map>
0006 #include <string>
0007 #include <vector>
0008 
0009 #include "ap_int.h"
0010 
0011 #include "L1Trigger/DemonstratorTools/interface/LinkId.h"
0012 
0013 namespace l1t::demo {
0014 
0015   /*!
0016    * \brief Class representing information phase-2 ATCA I/O data corresponding to a single event, 
0017    *   with logical channel IDs (essentially string-uint pairs, e.g. tracks-0 to tracks-17).
0018    *    
0019    *   This class is used to provide an event-index-independent interface to the BoardDataWriter &
0020    *   BoardDataReader classes - i.e. to avoid any need to keep track of  `eventIndex % tmux` when
0021    *   using that class for boards whose TMUX period is less than any of their upstream systems. 
0022    *   One logical channel ID corresponds to different I/O channel indices from one event to the
0023    *   next for the input channels of a board have a higher TMUX period than the board (e.g. for
0024    *   tracks sent to the correlator/GMT/GTT, or for the GMT, GTT and correlator links into GT); the
0025    *   mapping of logical channel IDs to I/O channel indices is implemented in the BoardDataWriter
0026    *   and BoardDataReader classes.
0027    */
0028   class EventData {
0029   public:
0030     typedef std::map<LinkId, std::vector<ap_uint<64>>>::const_iterator const_iterator;
0031 
0032     EventData();
0033 
0034     EventData(const std::map<LinkId, std::vector<ap_uint<64>>>&);
0035 
0036     const_iterator begin() const;
0037 
0038     const_iterator end() const;
0039 
0040     void add(const LinkId&, const std::vector<ap_uint<64>>&);
0041 
0042     void add(const EventData&);
0043 
0044     const std::vector<ap_uint<64>>& at(const LinkId&) const;
0045 
0046     bool has(const LinkId&) const;
0047 
0048     // Returns number of channels
0049     size_t size();
0050 
0051   private:
0052     // Map of channel IDs to data
0053     std::map<LinkId, std::vector<ap_uint<64>>> data_;
0054   };
0055 
0056 }  // namespace l1t::demo
0057 
0058 #endif