File indexing completed on 2024-04-06 12:19:38
0001
0002 #ifndef L1Trigger_DemonstratorTools_BoardDataWriter_h
0003 #define L1Trigger_DemonstratorTools_BoardDataWriter_h
0004
0005 #include <functional>
0006
0007 #include "L1Trigger/DemonstratorTools/interface/BoardData.h"
0008 #include "L1Trigger/DemonstratorTools/interface/EventData.h"
0009 #include "L1Trigger/DemonstratorTools/interface/ChannelSpec.h"
0010 #include "L1Trigger/DemonstratorTools/interface/FileFormat.h"
0011
0012 namespace l1t::demo {
0013
0014
0015
0016
0017
0018
0019
0020 class BoardDataWriter {
0021 public:
0022
0023 typedef std::map<LinkId, std::pair<ChannelSpec, std::vector<size_t>>> ChannelMap_t;
0024
0025 BoardDataWriter(FileFormat,
0026 const std::string& filePath,
0027 const std::string& fileExt,
0028 const size_t framesPerBX,
0029 const size_t tmux,
0030 const size_t maxFramesPerFile,
0031 const ChannelMap_t&);
0032
0033 BoardDataWriter(FileFormat,
0034 const std::string& filePath,
0035 const std::string& fileExt,
0036 const size_t framesPerBX,
0037 const size_t tmux,
0038 const size_t maxFramesPerFile,
0039 const std::map<LinkId, std::vector<size_t>>&,
0040 const std::map<std::string, ChannelSpec>&);
0041
0042
0043 void setBoardDataFileID(const std::string&);
0044
0045 void addEvent(const EventData& data);
0046
0047
0048 void flush();
0049
0050 private:
0051 static ChannelMap_t mergeMaps(const std::map<LinkId, std::vector<size_t>>&,
0052 const std::map<std::string, ChannelSpec>&);
0053
0054 void resetBoardData();
0055
0056 FileFormat fileFormat_;
0057
0058
0059 std::string boardDataFileID_;
0060
0061 std::function<std::string(const size_t)> filePathGen_;
0062
0063 std::vector<std::string> fileNames_;
0064
0065 size_t framesPerBX_;
0066
0067 size_t boardTMUX_;
0068
0069 size_t maxFramesPerFile_;
0070
0071 size_t maxEventsPerFile_;
0072
0073 size_t eventIndex_;
0074
0075
0076 size_t pendingEvents_;
0077
0078 BoardData boardData_;
0079
0080
0081 ChannelMap_t channelMap_;
0082 };
0083
0084 }
0085
0086 #endif