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