Line data Source code
1 : /**
2 : * @file FDDataHandlerModule.cpp FDDataHandlerModule class implementation
3 : *
4 : * This is part of the DUNE DAQ , copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 : #include "FDDataHandlerModule.hpp"
9 :
10 : #include "datahandlinglibs/opmon/datahandling_info.pb.h"
11 :
12 : #include "logging/Logging.hpp"
13 : #include "iomanager/IOManager.hpp"
14 :
15 : #include "datahandlinglibs/DataHandlingIssues.hpp"
16 : #include "datahandlinglibs/ReadoutLogging.hpp"
17 : #include "datahandlinglibs/concepts/DataHandlingConcept.hpp"
18 : #include "datahandlinglibs/models/BinarySearchQueueModel.hpp"
19 : #include "datahandlinglibs/models/DefaultRequestHandlerModel.hpp"
20 : #include "datahandlinglibs/models/EmptyFragmentRequestHandlerModel.hpp"
21 : #include "datahandlinglibs/models/FixedRateQueueModel.hpp"
22 : #include "datahandlinglibs/models/DataHandlingModel.hpp"
23 : #include "datahandlinglibs/models/ZeroCopyRecordingRequestHandlerModel.hpp"
24 : #include "datahandlinglibs/models/DefaultSkipListRequestHandler.hpp"
25 : #include "datahandlinglibs/models/SkipListLatencyBufferModel.hpp"
26 :
27 : #include "fdreadoutlibs/DUNEWIBEthTypeAdapter.hpp"
28 : #include "fdreadoutlibs/DAPHNESuperChunkTypeAdapter.hpp"
29 : #include "fdreadoutlibs/DAPHNEStreamSuperChunkTypeAdapter.hpp"
30 : #include "fdreadoutlibs/TDEEthTypeAdapter.hpp"
31 : #include "fdreadoutlibs/DAPHNEEthTypeAdapter.hpp"
32 : #include "fdreadoutlibs/DAPHNEEthStreamTypeAdapter.hpp"
33 :
34 : #include "fdreadoutlibs/daphne/DAPHNEFrameProcessor.hpp"
35 : #include "fdreadoutlibs/daphne/DAPHNEStreamFrameProcessor.hpp"
36 : #include "fdreadoutlibs/wibeth/WIBEthFrameProcessor.hpp"
37 : #include "fdreadoutlibs/tde/TDEEthFrameProcessor.hpp"
38 : #include "fdreadoutlibs/crt/CRTBernFrameProcessor.hpp"
39 : #include "fdreadoutlibs/crt/CRTGrenobleFrameProcessor.hpp"
40 : #include "fdreadoutlibs/daphneeth/DAPHNEEthFrameProcessor.hpp"
41 : #include "fdreadoutlibs/daphneeth/DAPHNEEthStreamFrameProcessor.hpp"
42 :
43 : #include <memory>
44 : #include <sstream>
45 : #include <string>
46 : #include <vector>
47 :
48 : using namespace dunedaq::datahandlinglibs::logging;
49 :
50 : namespace dunedaq {
51 :
52 0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DUNEWIBEthTypeAdapter, "WIBEthFrame")
53 0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DAPHNESuperChunkTypeAdapter, "PDSFrame")
54 0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DAPHNEStreamSuperChunkTypeAdapter, "PDSStreamFrame")
55 0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::TDEEthTypeAdapter, "TDEEthFrame")
56 0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::CRTBernTypeAdapter, "CRTBernFrame")
57 0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::CRTGrenobleTypeAdapter, "CRTGrenobleFrame")
58 0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DAPHNEEthTypeAdapter, "DAPHNEEthFrame")
59 0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter, "DAPHNEEthStreamFrame")
60 :
61 : namespace fdreadoutmodules {
62 :
63 0 : FDDataHandlerModule::FDDataHandlerModule(const std::string& name)
64 : : DAQModule(name)
65 0 : , RawDataHandlerBase(name)
66 : {
67 :
68 0 : inherited_mod::register_command("conf", &inherited_dlh::do_conf);
69 0 : inherited_mod::register_command("scrap", &inherited_dlh::do_scrap);
70 0 : inherited_mod::register_command("start", &inherited_dlh::do_start);
71 0 : inherited_mod::register_command("stop_trigger_sources", &inherited_dlh::do_stop);
72 0 : inherited_mod::register_command("record", &inherited_dlh::do_record);
73 0 : }
74 :
75 : void
76 0 : FDDataHandlerModule::init(std::shared_ptr<appfwk::ConfigurationManager> cfg)
77 : {
78 :
79 0 : TLOG_DEBUG(TLVL_ENTER_EXIT_METHODS) << get_name() << ": Entering init() method";
80 0 : inherited_dlh::init(cfg);
81 0 : TLOG_DEBUG(TLVL_ENTER_EXIT_METHODS) << get_name() << ": Exiting init() method";
82 0 : }
83 :
84 :
85 : void
86 0 : FDDataHandlerModule::generate_opmon_data()
87 : {
88 0 : }
89 :
90 : std::shared_ptr<datahandlinglibs::DataHandlingConcept>
91 0 : FDDataHandlerModule::create_readout(const appmodel::DataHandlerModule* modconf, std::atomic<bool>& run_marker)
92 : {
93 0 : namespace rol = dunedaq::datahandlinglibs;
94 0 : namespace fdl = dunedaq::fdreadoutlibs;
95 0 : namespace fdt = dunedaq::fdreadoutlibs::types;
96 :
97 :
98 : // Acquire DataType
99 0 : std::string raw_dt = modconf->get_module_configuration()->get_input_data_type();
100 0 : TLOG() << "Choosing specializations for DataHandlingModel with data_type:" << raw_dt << ']';
101 :
102 : // IF WIBEth
103 0 : if (raw_dt.find("WIBEthFrame") != std::string::npos) {
104 0 : TLOG_DEBUG(TLVL_WORK_STEPS) << "Creating readout for an Ethernet DUNE-WIB";
105 0 : auto readout_model = std::make_shared<
106 : rol::DataHandlingModel<fdt::DUNEWIBEthTypeAdapter,
107 : rol::ZeroCopyRecordingRequestHandlerModel<
108 : fdt::DUNEWIBEthTypeAdapter,
109 : rol::FixedRateQueueModel<fdt::DUNEWIBEthTypeAdapter>
110 : >,
111 : rol::FixedRateQueueModel<fdt::DUNEWIBEthTypeAdapter>,
112 : fdl::WIBEthFrameProcessor
113 0 : >>(run_marker);
114 0 : register_node("WIBEthFrameProcessor", readout_model);
115 0 : readout_model->init(modconf);
116 0 : return readout_model;
117 0 : }
118 :
119 : // IF CRTBern
120 0 : if (raw_dt.find("CRTBernFrame") != std::string::npos) {
121 0 : TLOG_DEBUG(TLVL_WORK_STEPS) << "Creating readout for a CRTBern";
122 0 : auto readout_model = std::make_shared<
123 : rol::DataHandlingModel<fdt::CRTBernTypeAdapter,
124 : rol::DefaultSkipListRequestHandler<fdt::CRTBernTypeAdapter>,
125 : rol::SkipListLatencyBufferModel<fdt::CRTBernTypeAdapter>,
126 : fdl::CRTBernFrameProcessor
127 0 : >>(run_marker);
128 0 : register_node("CRTBernFrameProcessor", readout_model);
129 0 : readout_model->init(modconf);
130 0 : return readout_model;
131 0 : }
132 :
133 : // IF CRTGrenoble
134 0 : if (raw_dt.find("CRTGrenobleFrame") != std::string::npos) {
135 0 : TLOG_DEBUG(TLVL_WORK_STEPS) << "Creating readout for a CRTGrenoble";
136 0 : auto readout_model = std::make_shared<
137 : rol::DataHandlingModel<fdt::CRTGrenobleTypeAdapter,
138 : rol::DefaultSkipListRequestHandler<fdt::CRTGrenobleTypeAdapter>,
139 : rol::SkipListLatencyBufferModel<fdt::CRTGrenobleTypeAdapter>,
140 : fdl::CRTGrenobleFrameProcessor
141 0 : >>(run_marker);
142 0 : register_node("CRTGrenobleFrameProcessor", readout_model);
143 0 : readout_model->init(modconf);
144 0 : return readout_model;
145 0 : }
146 :
147 : // IF TDEEth
148 0 : if (raw_dt.find("TDEEthFrame") != std::string::npos) {
149 0 : TLOG_DEBUG(TLVL_WORK_STEPS) << "Creating readout for an Ethernet TDEEth";
150 0 : auto readout_model =
151 : std::make_shared<rol::DataHandlingModel<
152 : fdt::TDEEthTypeAdapter,
153 : rol::ZeroCopyRecordingRequestHandlerModel<
154 : fdt::TDEEthTypeAdapter,
155 : rol::FixedRateQueueModel<fdt::TDEEthTypeAdapter>
156 : >,
157 : rol::FixedRateQueueModel<fdt::TDEEthTypeAdapter>,
158 : fdl::TDEEthFrameProcessor
159 0 : >>(run_marker);
160 0 : register_node("TDEEthFrameProcessor", readout_model);
161 0 : readout_model->init(modconf);
162 0 : return readout_model;
163 0 : }
164 :
165 : // IF PDS Frame using skiplist
166 0 : if (raw_dt.find("PDSFrame") != std::string::npos) {
167 0 : TLOG_DEBUG(TLVL_WORK_STEPS) << "Creating readout for a PDS DAPHNE using SkipList LB";
168 0 : auto readout_model = std::make_shared<rol::DataHandlingModel<
169 : fdt::DAPHNESuperChunkTypeAdapter,
170 : rol::DefaultSkipListRequestHandler<fdt::DAPHNESuperChunkTypeAdapter>,
171 : rol::SkipListLatencyBufferModel<fdt::DAPHNESuperChunkTypeAdapter>,
172 0 : fdl::DAPHNEFrameProcessor>>(run_marker);
173 0 : register_node("PDSFrameProcessor", readout_model);
174 0 : readout_model->init(modconf);
175 0 : return readout_model;
176 0 : }
177 :
178 : // IF PDS Frame using skiplist
179 0 : if (raw_dt.find("DAPHNEEthFrame") != std::string::npos) {
180 0 : TLOG_DEBUG(TLVL_WORK_STEPS) << "Creating readout for a PDS DAPHNE Ethernet using SkipList LB";
181 0 : auto readout_model = std::make_shared<rol::DataHandlingModel<
182 : fdt::DAPHNEEthTypeAdapter,
183 : rol::DefaultSkipListRequestHandler<fdt::DAPHNEEthTypeAdapter>,
184 : rol::SkipListLatencyBufferModel<fdt::DAPHNEEthTypeAdapter>,
185 0 : fdl::DAPHNEEthFrameProcessor>>(run_marker);
186 0 : register_node("DAPHNEEthFrameProcessor", readout_model);
187 0 : readout_model->init(modconf);
188 0 : return readout_model;
189 0 : }
190 :
191 : // IF PDS Stream Frame using SPSC LB
192 0 : if (raw_dt.find("PDSStreamFrame") != std::string::npos) {
193 0 : TLOG_DEBUG(TLVL_WORK_STEPS) << "Creating readout for a PDS DAPHNE stream mode using BinarySearchQueue LB";
194 0 : auto readout_model = std::make_shared<
195 : rol::DataHandlingModel<fdt::DAPHNEStreamSuperChunkTypeAdapter,
196 : rol::DefaultRequestHandlerModel<fdt::DAPHNEStreamSuperChunkTypeAdapter,
197 : rol::BinarySearchQueueModel<fdt::DAPHNEStreamSuperChunkTypeAdapter>>,
198 : rol::BinarySearchQueueModel<fdt::DAPHNEStreamSuperChunkTypeAdapter>,
199 0 : fdl::DAPHNEStreamFrameProcessor>>(run_marker);
200 0 : register_node("PDSStreamFrameProcessor", readout_model);
201 0 : readout_model->init(modconf);
202 0 : return readout_model;
203 0 : }
204 :
205 : // IF PDS Stream Frame using SPSC LB
206 0 : if (raw_dt.find("DAPHNEEthStreamFrame") != std::string::npos) {
207 0 : TLOG_DEBUG(TLVL_WORK_STEPS) << "Creating readout for a DAPHNE eth stream mode using BinarySearchQueue LB";
208 0 : auto readout_model = std::make_shared<
209 : rol::DataHandlingModel<fdt::DAPHNEEthStreamTypeAdapter,
210 : rol::DefaultRequestHandlerModel<fdt::DAPHNEEthStreamTypeAdapter,
211 : rol::BinarySearchQueueModel<fdt::DAPHNEEthStreamTypeAdapter>>,
212 : rol::BinarySearchQueueModel<fdt::DAPHNEEthStreamTypeAdapter>,
213 0 : fdl::DAPHNEEthStreamFrameProcessor>>(run_marker);
214 0 : register_node("DAPHNEEthStreamFrameProcessor", readout_model);
215 0 : readout_model->init(modconf);
216 0 : return readout_model;
217 0 : }
218 0 : return nullptr;
219 0 : }
220 :
221 : } // namespace fdreadoutmodules
222 : } // namespace dunedaq
223 :
224 0 : DEFINE_DUNE_DAQ_MODULE(dunedaq::fdreadoutmodules::FDDataHandlerModule)
|