Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:38

0001 
0002 #ifndef L1Trigger_DemonstratorTools_BoardDataReader_h
0003 #define L1Trigger_DemonstratorTools_BoardDataReader_h
0004 
0005 #include <map>
0006 #include <string>
0007 #include <vector>
0008 
0009 #include "L1Trigger/DemonstratorTools/interface/BoardData.h"
0010 #include "L1Trigger/DemonstratorTools/interface/ChannelSpec.h"
0011 #include "L1Trigger/DemonstratorTools/interface/EventData.h"
0012 #include "L1Trigger/DemonstratorTools/interface/FileFormat.h"
0013 
0014 namespace l1t::demo {
0015 
0016   // Reads I/O buffer files created from hardware/firmware tests, verifying that
0017   // received packets conform to the declared structure, separating out each
0018   // event (accounting for different TM periods of specific links and of the
0019   // data-processor itself), and transparently switching to data from new buffer
0020   // files as needed
0021   class BoardDataReader {
0022   public:
0023     // map of logical channel ID -> [TMUX period, interpacket-gap & offset; channel indices]
0024     typedef std::map<LinkId, std::pair<ChannelSpec, std::vector<size_t>>> ChannelMap_t;
0025 
0026     BoardDataReader(FileFormat,
0027                     const std::vector<std::string>&,
0028                     const size_t framesPerBX,
0029                     const size_t tmux,
0030                     const size_t emptyFramesAtStart,
0031                     const ChannelMap_t&);
0032 
0033     BoardDataReader(FileFormat,
0034                     const std::vector<std::string>&,
0035                     const size_t framesPerBX,
0036                     const size_t tmux,
0037                     const size_t emptyFramesAtStart,
0038                     const std::map<LinkId, std::vector<size_t>>&,
0039                     const std::map<std::string, ChannelSpec>&);
0040 
0041     EventData getNextEvent();
0042 
0043   private:
0044     static ChannelMap_t mergeMaps(const std::map<LinkId, std::vector<size_t>>&,
0045                                   const std::map<std::string, ChannelSpec>&);
0046 
0047     FileFormat fileFormat_;
0048 
0049     std::vector<std::string> fileNames_;
0050 
0051     size_t framesPerBX_;
0052 
0053     size_t boardTMUX_;
0054 
0055     size_t emptyFramesAtStart_;
0056 
0057     // map of logical channel ID -> [TMUX period, interpacket-gap & offset; channel indices]
0058     ChannelMap_t channelMap_;
0059 
0060     std::vector<EventData> events_;
0061 
0062     std::vector<EventData>::const_iterator eventIt_;
0063   };
0064 
0065 }  // namespace l1t::demo
0066 
0067 #endif