From 168e403db4ed0d5f18bb393586c0e6c3f73a8627 Mon Sep 17 00:00:00 2001 From: Deniz Tuana Ergonul Uzun Date: Fri, 6 Mar 2026 12:06:15 +0100 Subject: [PATCH 1/8] CRT topology change --- schema/appmodel/application.schema.xml | 10 ++- schema/appmodel/fdmodules.schema.xml | 14 +---- schema/appmodel/wiec.schema.xml | 8 +-- src/CRTReaderApplication.cpp | 84 ++++++++++---------------- src/ReadoutApplication.cpp | 13 +++- 5 files changed, 55 insertions(+), 74 deletions(-) diff --git a/schema/appmodel/application.schema.xml b/schema/appmodel/application.schema.xml index 17c90bf..a10e1ac 100644 --- a/schema/appmodel/application.schema.xml +++ b/schema/appmodel/application.schema.xml @@ -80,7 +80,7 @@ - + @@ -91,8 +91,8 @@ - + @@ -513,7 +513,11 @@ - + + + + + diff --git a/schema/appmodel/fdmodules.schema.xml b/schema/appmodel/fdmodules.schema.xml index 7cd6c8e..dd106fa 100644 --- a/schema/appmodel/fdmodules.schema.xml +++ b/schema/appmodel/fdmodules.schema.xml @@ -80,7 +80,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -97,7 +97,7 @@ - + @@ -153,10 +153,6 @@ - - - - @@ -245,8 +241,6 @@ - - @@ -259,8 +253,6 @@ - - diff --git a/schema/appmodel/wiec.schema.xml b/schema/appmodel/wiec.schema.xml index 299442f..b0c1090 100644 --- a/schema/appmodel/wiec.schema.xml +++ b/schema/appmodel/wiec.schema.xml @@ -80,7 +80,7 @@ - + @@ -122,9 +122,9 @@ - - - + + + diff --git a/src/CRTReaderApplication.cpp b/src/CRTReaderApplication.cpp index 62f9aec..19177dd 100644 --- a/src/CRTReaderApplication.cpp +++ b/src/CRTReaderApplication.cpp @@ -56,44 +56,33 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const const auto reader_conf = get_data_reader(); if (reader_conf == 0) { throw(BadConf(ERS_HERE, "No DataReaderModule configuration given")); - } + } const std::string reader_class = reader_conf->get_template_for(); - // Data writers - const auto writer_confs = get_data_writers(); - if (writer_confs.size() == 0) { + // Data writer + const auto writer_conf = get_data_writer(); + if (writer_conf == 0) { throw(BadConf(ERS_HERE, "No DataWriterModule configuration given")); } - + const std::string writer_class = writer_conf->get_template_for(); + // - // Process the queue rules looking for inputs to our DL/TP handler modules + // Process the queue rules looking for inputs to our socket writer modules // - const QueueDescriptor* dlh_input_qdesc = nullptr; - - for (auto rule : get_queue_rules()) { - auto destination_class = rule->get_destination_class(); - auto data_type = rule->get_descriptor()->get_data_type(); - // Why datahander here? It is the base class for several DataHandler types (e.g. FDDataHandlerModule, - // SNBDataHandlerModule) - if (destination_class == "DataHandlerModule") { - if (data_type != "DataRequest") { - dlh_input_qdesc = rule->get_descriptor(); - } - } - } - - if (dlh_input_qdesc == nullptr) { - throw(BadConf(ERS_HERE, "No data link handler input queue descriptor given")); + const QueueDescriptor* crtreader_output_qdesc = nullptr; + auto queue_rules = get_queue_rules(); + if (queue_rules.size() != 1) { + throw(BadConf(ERS_HERE, "Strictly 1 queue rule is expected")); } + crtreader_output_qdesc = queue_rules[0]->get_descriptor(); // // Scan Detector 2 DAQ connections to extract sender, receiver and stream information // - // Loop over the detector to daq connections and generate one data reader per connection - - // Collect all streams - std::map data_queues_by_sid; + // Loop over the detector to daq connections and generate: + // - One data reader per detector connection + // - One data writer per detector connection uint16_t conn_idx = 0; @@ -106,9 +95,8 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const } TLOG_DEBUG(6) << "Processing DetectorToDaqConnection " << d2d_conn->UID(); - // get the readout groups and the interfaces and streams therein; 1 reaout group corresponds to 1 data reader module - - std::vector enabled_det_streams; + + std::vector enabled_det_streams; // Loop over streams for (auto stream : d2d_conn->streams()) { @@ -123,15 +111,13 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const // Create the raw data queues std::vector data_queue_objs; - // keep a map for convenience // Create data queues for (auto ds : enabled_det_streams) { - conffwk::ConfigObject queue_obj = obj_fac.create_queue_sid_obj(dlh_input_qdesc, ds); + conffwk::ConfigObject queue_obj = obj_fac.create_queue_sid_obj(crtreader_output_qdesc, ds); const auto* data_queue = obj_fac.get_dal(queue_obj.UID()); data_queue_objs.push_back(&data_queue->config_object()); - data_queues_by_sid[ds->get_source_id()] = data_queue; - } + } //----------------------------------------------------------------- // @@ -144,11 +130,11 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const // Create the Data reader object - std::string reader_uid(fmt::format("crtdatareader-{}-{}", this->UID(), std::to_string(conn_idx++))); + std::string reader_uid(fmt::format("crtreader-{}-{}", this->UID(), std::to_string(conn_idx++))); TLOG_DEBUG(6) << fmt::format("creating OKS configuration object for Data reader class {} with id {}", reader_class, reader_uid); auto reader_obj = obj_fac.create(reader_class, reader_uid); - // Populate configuration and interfaces (leave output queues for later) + // Populate configuration and interfaces reader_obj.set_obj("configuration", &reader_conf->config_object()); reader_obj.set_objs("connections", {&d2d_conn->config_object()}); reader_obj.set_objs("outputs", data_queue_objs); @@ -157,33 +143,25 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const //----------------------------------------------------------------- // - // Create DataWriterModule objects + // Create DataWriterModule object // // // Instantiate DataWriterModule of type SocketWriterModule // - // Create the SocketWriterModule objects + // Create the SocketWriterModule object - conn_idx = 0; - - for (const auto writer_conf : writer_confs) { + std::string writer_uid(fmt::format("socketwriter-{}-{}", this->UID(), std::to_string(conn_idx++))); + TLOG_DEBUG(6) << fmt::format("Creating OKS configuration object for socket writer class {} with id {}", writer_class, writer_uid); + auto writer_obj = obj_fac.create(writer_class, writer_uid); - const std::string writer_class = writer_conf->get_template_for(); + // Populate configuration and interfaces + writer_obj.set_obj("configuration", &writer_conf->config_object()); + writer_obj.set_objs("connections", {&d2d_conn->config_object()}); + writer_obj.set_objs("inputs", data_queue_objs); - std::string writer_uid(fmt::format("socketdatawriter-{}-{}", this->UID(), std::to_string(conn_idx++))); - TLOG_DEBUG(6) << fmt::format( - "Creating OKS configuration object for socket data writer class {} with id {}", writer_class, writer_uid); - auto writer_obj = obj_fac.create(writer_class, writer_uid); - - // Populate configuration and interfaces - writer_obj.set_obj("configuration", &writer_conf->config_object()); - writer_obj.set_objs("connections", {&d2d_conn->config_object()}); - writer_obj.set_objs("inputs", data_queue_objs); - - modules.push_back(obj_fac.get_dal(writer_obj.UID())); - } + modules.push_back(obj_fac.get_dal(writer_obj.UID())); } obj_fac.update_modules(modules); diff --git a/src/ReadoutApplication.cpp b/src/ReadoutApplication.cpp index 54b478d..9d1af5f 100644 --- a/src/ReadoutApplication.cpp +++ b/src/ReadoutApplication.cpp @@ -233,15 +233,22 @@ ReadoutApplication::generate_modules(const confmodel::Session* session) const // Here I want to resolve the type of connection (network, felix, or?) // Rules of engagement: if the receiver interface is network or felix, the receivers should be castable to the counterpart - if (reader_class == "DPDKReaderModule" || reader_class == "SocketReaderModule") { + if (reader_class == "DPDKReaderModule") { if (!d2d_conn->castable("NetworkDetectorToDaqConnection")) { throw(BadConf(ERS_HERE, fmt::format("{} requires NetworkDetectorToDaqConnection, found {} of class {}", reader_class, d2d_conn->UID(), d2d_conn->class_name()))); } - if ((reader_class == "DPDKReaderModule" && !det_receiver->cast()) || - (reader_class == "SocketReaderModule" && !det_receiver->cast())) { + if (!det_receiver->cast()) { throw(BadConf(ERS_HERE, fmt::format("{} requires NWDetDataReceiver, found {} of class {}", reader_class, det_receiver->UID(), det_receiver->class_name()))); } } + else if (reader_class == "SocketReaderModule") { + if (!d2d_conn->castable("SocketDetectorToDaqConnection")) { + throw(BadConf(ERS_HERE, fmt::format("{} requires SocketDetectorToDaqConnection, found {} of class {}", reader_class, d2d_conn->UID(), d2d_conn->class_name()))); + } + if (!det_receiver->cast()) { + throw(BadConf(ERS_HERE, fmt::format("{} requires SocketReceiver, found {} of class {}", reader_class, det_receiver->UID(), det_receiver->class_name()))); + } + } else if (reader_class == "FelixReaderModule") { if (!d2d_conn->castable("FelixDetectorToDaqConnection")) { throw(BadConf(ERS_HERE, fmt::format("{} requires FelixDetectorToDaqConnection, found {} of class {}", reader_class, d2d_conn->UID(), d2d_conn->class_name()))); From 8e80fe0c173ea29bb17e84d815f21ad68b4b2879 Mon Sep 17 00:00:00 2001 From: Deniz Tuana Ergonul Uzun Date: Tue, 10 Mar 2026 17:13:28 +0100 Subject: [PATCH 2/8] Queues instead of callbacks --- src/CRTReaderApplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CRTReaderApplication.cpp b/src/CRTReaderApplication.cpp index a0087f4..326e9ca 100644 --- a/src/CRTReaderApplication.cpp +++ b/src/CRTReaderApplication.cpp @@ -138,7 +138,7 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const // Populate configuration and interfaces reader_obj.set_obj("configuration", &reader_conf->config_object()); reader_obj.set_objs("connections", { &d2d_conn->config_object() }); - reader_obj.set_objs("raw_data_callbacks", raw_data_callback_objs); + reader_obj.set_objs("outputs", data_queue_objs); modules.push_back(obj_fac.get_dal(reader_obj.UID())); From d658f83b0f584ff5f06bcf50368c140feecc0694 Mon Sep 17 00:00:00 2001 From: Deniz Tuana Ergonul Uzun Date: Wed, 11 Mar 2026 16:14:56 +0100 Subject: [PATCH 3/8] Don't check raw data callbacks for CRT readers --- test/apps/generate_modules_test.cxx | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/test/apps/generate_modules_test.cxx b/test/apps/generate_modules_test.cxx index e367d00..d79018f 100644 --- a/test/apps/generate_modules_test.cxx +++ b/test/apps/generate_modules_test.cxx @@ -27,8 +27,9 @@ #include "appmodel/DataHandlerModule.hpp" #include "appmodel/DataReaderModule.hpp" +#include "appmodel/CRTBernReaderModule.hpp" +#include "appmodel/CRTGrenobleReaderModule.hpp" #include "appmodel/DataMoveCallbackConf.hpp" -#include "appmodel/SocketDataWriterModule.hpp" #include "appmodel/appmodelIssues.hpp" @@ -97,11 +98,15 @@ main(int argc, char* argv[]) auto reader_module = daq_module->cast(); if (reader_module != nullptr) { - auto callback_confs = reader_module->get_raw_data_callbacks(); - std::cout << " callback confs " << std::endl; - for (auto* callback_conf : callback_confs) { - auto cbObj = callback_conf->config_object(); - cbObj.print_ref(std::cout, *confdb, " "); + auto crt_reader_module = daq_module->cast() != nullptr || + daq_module->cast() != nullptr; + if (!crt_reader_module) { // Don't check raw data callbacks for CRT readers + auto callback_confs = reader_module->get_raw_data_callbacks(); + std::cout << " callback confs " << std::endl; + for (auto* callback_conf : callback_confs) { + auto cbObj = callback_conf->config_object(); + cbObj.print_ref(std::cout, *confdb, " "); + } } } @@ -114,15 +119,6 @@ main(int argc, char* argv[]) } } - auto socketwriter_module = daq_module->cast(); - if (socketwriter_module != nullptr) { - auto callback_conf = socketwriter_module->get_raw_data_callback(); - if (callback_conf != nullptr) { - auto cbObj = callback_conf->config_object(); - cbObj.print_ref(std::cout, *confdb, " "); - } - } - std::cout << std::endl; } } else { From 3e916c64aad8844d6c1534c29a844826e993f084 Mon Sep 17 00:00:00 2001 From: Deniz Tuana Ergonul Uzun Date: Wed, 11 Mar 2026 16:35:57 +0100 Subject: [PATCH 4/8] Num of items update --- schema/appmodel/application.schema.xml | 2 +- schema/appmodel/fdmodules.schema.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/schema/appmodel/application.schema.xml b/schema/appmodel/application.schema.xml index 1522d97..a87d795 100644 --- a/schema/appmodel/application.schema.xml +++ b/schema/appmodel/application.schema.xml @@ -80,7 +80,7 @@ - + diff --git a/schema/appmodel/fdmodules.schema.xml b/schema/appmodel/fdmodules.schema.xml index dd106fa..86dc75c 100644 --- a/schema/appmodel/fdmodules.schema.xml +++ b/schema/appmodel/fdmodules.schema.xml @@ -80,7 +80,7 @@ - + From e9ed37f8e8ce3c9d937df726b48a6f837f5eff87 Mon Sep 17 00:00:00 2001 From: Deniz Tuana Ergonul Uzun Date: Fri, 13 Mar 2026 17:11:22 +0100 Subject: [PATCH 5/8] Communicates via callbacks: CRT readers with socket writers, socket readers with DHLs --- schema/appmodel/application.schema.xml | 1 + src/CRTReaderApplication.cpp | 27 +++++++++++++------------- test/apps/generate_modules_test.cxx | 27 +++++++++++++++----------- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/schema/appmodel/application.schema.xml b/schema/appmodel/application.schema.xml index a87d795..946d3e8 100644 --- a/schema/appmodel/application.schema.xml +++ b/schema/appmodel/application.schema.xml @@ -528,6 +528,7 @@ + diff --git a/src/CRTReaderApplication.cpp b/src/CRTReaderApplication.cpp index 326e9ca..176b0f4 100644 --- a/src/CRTReaderApplication.cpp +++ b/src/CRTReaderApplication.cpp @@ -68,14 +68,13 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const const std::string writer_class = writer_conf->get_template_for(); // - // Process the queue rules looking for inputs to our socket writer modules + // Get the callback descriptor // - const QueueDescriptor* crtreader_output_qdesc = nullptr; - auto queue_rules = get_queue_rules(); - if (queue_rules.size() != 1) { - throw(BadConf(ERS_HERE, "Strictly 1 queue rule is expected")); + const DataMoveCallbackDescriptor* raw_data_callback_desc = get_callback_desc(); + + if (raw_data_callback_desc == nullptr) { + throw(BadConf(ERS_HERE, "No Raw Data Callback descriptor given")); } - crtreader_output_qdesc = queue_rules[0]->get_descriptor(); // // Scan Detector 2 DAQ connections to extract sender, receiver and stream information @@ -110,15 +109,15 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const enabled_det_streams.push_back(stream); } - // Create the raw data queues - std::vector data_queue_objs; + // Create the raw data callbacks + std::vector raw_data_callback_objs; // Create data queues for (auto ds : enabled_det_streams) { - conffwk::ConfigObject queue_obj = obj_fac.create_queue_sid_obj(crtreader_output_qdesc, ds); - const auto* data_queue = obj_fac.get_dal(queue_obj.UID()); - data_queue_objs.push_back(&data_queue->config_object()); - } + conffwk::ConfigObject callback_obj = obj_fac.create_callback_sid_obj(raw_data_callback_desc, ds->get_source_id()); + const auto* callback_conf = obj_fac.get_dal(callback_obj.UID()); + raw_data_callback_objs.push_back(&callback_conf->config_object()); + } //----------------------------------------------------------------- // @@ -138,7 +137,7 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const // Populate configuration and interfaces reader_obj.set_obj("configuration", &reader_conf->config_object()); reader_obj.set_objs("connections", { &d2d_conn->config_object() }); - reader_obj.set_objs("outputs", data_queue_objs); + reader_obj.set_objs("raw_data_callbacks", raw_data_callback_objs); modules.push_back(obj_fac.get_dal(reader_obj.UID())); @@ -160,7 +159,7 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const // Populate configuration and interfaces writer_obj.set_obj("configuration", &writer_conf->config_object()); writer_obj.set_objs("connections", {&d2d_conn->config_object()}); - writer_obj.set_objs("inputs", data_queue_objs); + writer_obj.set_objs("raw_data_callbacks", raw_data_callback_objs); modules.push_back(obj_fac.get_dal(writer_obj.UID())); } diff --git a/test/apps/generate_modules_test.cxx b/test/apps/generate_modules_test.cxx index d79018f..e8be661 100644 --- a/test/apps/generate_modules_test.cxx +++ b/test/apps/generate_modules_test.cxx @@ -27,9 +27,8 @@ #include "appmodel/DataHandlerModule.hpp" #include "appmodel/DataReaderModule.hpp" -#include "appmodel/CRTBernReaderModule.hpp" -#include "appmodel/CRTGrenobleReaderModule.hpp" #include "appmodel/DataMoveCallbackConf.hpp" +#include "appmodel/SocketDataWriterModule.hpp" #include "appmodel/appmodelIssues.hpp" @@ -98,15 +97,11 @@ main(int argc, char* argv[]) auto reader_module = daq_module->cast(); if (reader_module != nullptr) { - auto crt_reader_module = daq_module->cast() != nullptr || - daq_module->cast() != nullptr; - if (!crt_reader_module) { // Don't check raw data callbacks for CRT readers - auto callback_confs = reader_module->get_raw_data_callbacks(); - std::cout << " callback confs " << std::endl; - for (auto* callback_conf : callback_confs) { - auto cbObj = callback_conf->config_object(); - cbObj.print_ref(std::cout, *confdb, " "); - } + auto callback_confs = reader_module->get_raw_data_callbacks(); + std::cout << " callback confs " << std::endl; + for (auto* callback_conf : callback_confs) { + auto cbObj = callback_conf->config_object(); + cbObj.print_ref(std::cout, *confdb, " "); } } @@ -119,6 +114,16 @@ main(int argc, char* argv[]) } } + auto socketwriter_module = daq_module->cast(); + if (socketwriter_module != nullptr) { + auto callback_confs = socketwriter_module->get_raw_data_callbacks(); + std::cout << " callback confs " << std::endl; + for (auto* callback_conf : callback_confs) { + auto cbObj = callback_conf->config_object(); + cbObj.print_ref(std::cout, *confdb, " "); + } + } + std::cout << std::endl; } } else { From 073187fa9f801de8c9090a4c6e72dd29a60a8325 Mon Sep 17 00:00:00 2001 From: Deniz Tuana Ergonul Uzun Date: Wed, 18 Mar 2026 17:34:57 +0100 Subject: [PATCH 6/8] SocketDataSender moved to new schema --- CMakeLists.txt | 2 +- schema/appmodel/socket.schema.xml | 97 +++++++++++++++++++++++++++++++ schema/appmodel/wiec.schema.xml | 9 +-- src/CRTReaderApplication.cpp | 7 ++- 4 files changed, 103 insertions(+), 12 deletions(-) create mode 100644 schema/appmodel/socket.schema.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index d2fb231..f6ec587 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ find_package(fmt REQUIRED) find_package(Boost COMPONENTS unit_test_framework program_options REQUIRED) -daq_add_dal_library(application.schema.xml hermes.schema.xml fdmodules.schema.xml trigger.schema.xml wiec.schema.xml PDS.schema.xml tde.schema.xml CTB.schema.xml CIB.schema.xml +daq_add_dal_library(application.schema.xml hermes.schema.xml fdmodules.schema.xml trigger.schema.xml wiec.schema.xml socket.schema.xml PDS.schema.xml tde.schema.xml CTB.schema.xml CIB.schema.xml NAMESPACE dunedaq::appmodel DEP_PKGS confmodel SOURCES ConfigurationHelper.cpp diff --git a/schema/appmodel/socket.schema.xml b/schema/appmodel/socket.schema.xml new file mode 100644 index 0000000..abee5a7 --- /dev/null +++ b/schema/appmodel/socket.schema.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + diff --git a/schema/appmodel/wiec.schema.xml b/schema/appmodel/wiec.schema.xml index 31d79c7..2c6eca5 100644 --- a/schema/appmodel/wiec.schema.xml +++ b/schema/appmodel/wiec.schema.xml @@ -80,7 +80,7 @@ - + @@ -120,13 +120,6 @@ - - - - - - - diff --git a/src/CRTReaderApplication.cpp b/src/CRTReaderApplication.cpp index 1a882a3..4cec473 100644 --- a/src/CRTReaderApplication.cpp +++ b/src/CRTReaderApplication.cpp @@ -31,6 +31,7 @@ #include #include +#include namespace dunedaq::appmodel { @@ -55,14 +56,14 @@ void // Data reader const auto reader_conf = get_data_reader(); - if (reader_conf == 0) { + if (reader_conf == nullptr) { throw(BadConf(ERS_HERE, "No DataReaderModule configuration given")); } const std::string reader_class = reader_conf->get_template_for(); // Data writer const auto writer_conf = get_data_writer(); - if (writer_conf == 0) { + if (writer_conf == nullptr) { throw(BadConf(ERS_HERE, "No DataWriterModule configuration given")); } const std::string writer_class = writer_conf->get_template_for(); @@ -84,7 +85,7 @@ void // - One data reader per detector connection // - One data writer per detector connection - uint16_t conn_idx = 0; + uint16_t conn_idx = 0; // NOLINT(build/unsigned) for (auto d2d_conn : get_detector_connections()) { From a30ce8eef93425d2bbe8640545c927fb5fbbf886 Mon Sep 17 00:00:00 2001 From: Deniz Tuana Ergonul Uzun Date: Fri, 20 Mar 2026 10:19:47 +0100 Subject: [PATCH 7/8] CRTReader is not a DataReader --- CMakeLists.txt | 2 +- schema/appmodel/application.schema.xml | 22 +++++++--- schema/appmodel/fdmodules.schema.xml | 22 +++++----- ...ion.cpp => CRTFrameBuilderApplication.cpp} | 42 +++++++++---------- 4 files changed, 49 insertions(+), 39 deletions(-) rename src/{CRTReaderApplication.cpp => CRTFrameBuilderApplication.cpp} (75%) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6ec587..f61d81a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ daq_add_dal_library(application.schema.xml hermes.schema.xml fdmodules.schema.xm SOURCES ConfigurationHelper.cpp ConfigObjectFactory.cpp - CRTReaderApplication.cpp + CRTFrameBuilderApplication.cpp CTBApplication.cpp DaphneApplication.cpp DFApplication.cpp diff --git a/schema/appmodel/application.schema.xml b/schema/appmodel/application.schema.xml index 17151ea..f8a872c 100644 --- a/schema/appmodel/application.schema.xml +++ b/schema/appmodel/application.schema.xml @@ -80,22 +80,22 @@ - + - + - + - + @@ -192,6 +192,16 @@ + + + + + + + + + + @@ -405,8 +415,8 @@ - - + + diff --git a/schema/appmodel/fdmodules.schema.xml b/schema/appmodel/fdmodules.schema.xml index 86dc75c..c061de8 100644 --- a/schema/appmodel/fdmodules.schema.xml +++ b/schema/appmodel/fdmodules.schema.xml @@ -80,7 +80,7 @@ - + @@ -88,24 +88,24 @@ - - + + - - + + - - + + - - + + - - + + diff --git a/src/CRTReaderApplication.cpp b/src/CRTFrameBuilderApplication.cpp similarity index 75% rename from src/CRTReaderApplication.cpp rename to src/CRTFrameBuilderApplication.cpp index 4cec473..fff0919 100644 --- a/src/CRTReaderApplication.cpp +++ b/src/CRTFrameBuilderApplication.cpp @@ -1,14 +1,14 @@ /** - * @file CRTReaderApplication.cpp + * @file CRTFrameBuilderApplication.cpp * - * Implementation of CRTReaderApplication's generate_modules dal method + * Implementation of CRTFrameBuilderApplication's generate_modules dal method * * This is part of the DUNE DAQ Software Suite, copyright 2023. * Licensing/copyright details are in the COPYING file that you should have * received with this code. */ -#include "appmodel/CRTReaderApplication.hpp" +#include "appmodel/CRTFrameBuilderApplication.hpp" #include "appmodel/appmodelIssues.hpp" @@ -36,12 +36,12 @@ namespace dunedaq::appmodel { std::vector -CRTReaderApplication::contained_resources() const { +CRTFrameBuilderApplication::contained_resources() const { return to_resources(get_detector_connections()); } void - CRTReaderApplication::generate_modules(std::shared_ptr helper) const + CRTFrameBuilderApplication::generate_modules(std::shared_ptr helper) const { TLOG_DEBUG(6) << "Generating modules for application " << this->UID(); @@ -55,11 +55,11 @@ void // // Data reader - const auto reader_conf = get_data_reader(); - if (reader_conf == nullptr) { - throw(BadConf(ERS_HERE, "No DataReaderModule configuration given")); - } - const std::string reader_class = reader_conf->get_template_for(); + //const auto reader_conf = get_data_reader(); + //if (reader_conf == nullptr) { + // throw(BadConf(ERS_HERE, "No DataReaderModule configuration given")); + //} + //const std::string reader_class = reader_conf->get_template_for(); // Data writer const auto writer_conf = get_data_writer(); @@ -126,21 +126,21 @@ void // // - // Instantiate DataReaderModule of type CRTBernReaderModule/CRTGrenobleReaderModule + // Instantiate DataReaderModule of type CRTBernFrameBuilderModule/CRTGrenobleFrameBuilderModule // // Create the Data reader object - std::string reader_uid(fmt::format("crtreader-{}-{}", this->UID(), std::to_string(conn_idx++))); - TLOG_DEBUG(6) << fmt::format("creating OKS configuration object for Data reader class {} with id {}", reader_class, reader_uid); - auto reader_obj = obj_fac.create(reader_class, reader_uid); - - // Populate configuration and interfaces - reader_obj.set_obj("configuration", &reader_conf->config_object()); - reader_obj.set_objs("connections", { &d2d_conn->config_object() }); - reader_obj.set_objs("raw_data_callbacks", raw_data_callback_objs); - - modules.push_back(obj_fac.get_dal(reader_obj.UID())); + //std::string reader_uid(fmt::format("crtframebuilder-{}-{}", this->UID(), std::to_string(conn_idx++))); + //TLOG_DEBUG(6) << fmt::format("creating OKS configuration object for Data reader class {} with id {}", reader_class, reader_uid); + //auto reader_obj = obj_fac.create(reader_class, reader_uid); +// + //// Populate configuration and interfaces + //reader_obj.set_obj("configuration", &reader_conf->config_object()); + //reader_obj.set_objs("connections", { &d2d_conn->config_object() }); + //reader_obj.set_objs("raw_data_callbacks", raw_data_callback_objs); +// + //modules.push_back(obj_fac.get_dal(reader_obj.UID())); //----------------------------------------------------------------- // From 41368a495415e9701dd5f0a87337bcda419ab608 Mon Sep 17 00:00:00 2001 From: Deniz Tuana Ergonul Uzun Date: Mon, 23 Mar 2026 13:03:47 +0100 Subject: [PATCH 8/8] Change of topology. Switch to IOM. --- schema/appmodel/application.schema.xml | 6 +- src/CRTFrameBuilderApplication.cpp | 189 ++++++++++++++----------- test/apps/generate_modules_test.cxx | 10 -- 3 files changed, 112 insertions(+), 93 deletions(-) diff --git a/schema/appmodel/application.schema.xml b/schema/appmodel/application.schema.xml index f8a872c..a75dba2 100644 --- a/schema/appmodel/application.schema.xml +++ b/schema/appmodel/application.schema.xml @@ -94,7 +94,6 @@ - @@ -199,7 +198,7 @@ - + @@ -537,8 +536,7 @@ - - + diff --git a/src/CRTFrameBuilderApplication.cpp b/src/CRTFrameBuilderApplication.cpp index fff0919..57f215b 100644 --- a/src/CRTFrameBuilderApplication.cpp +++ b/src/CRTFrameBuilderApplication.cpp @@ -12,18 +12,20 @@ #include "appmodel/appmodelIssues.hpp" -#include "appmodel/DataReaderConf.hpp" +#include "appmodel/DetectorFrameBuilderConf.hpp" #include "appmodel/SocketWriterConf.hpp" #include "appmodel/SocketWriterModule.hpp" -#include "appmodel/DataMoveCallbackConf.hpp" #include "appmodel/QueueConnectionRule.hpp" #include "appmodel/QueueDescriptor.hpp" +#include "appmodel/SocketDetectorToDaqConnection.hpp" #include "ConfigObjectFactory.hpp" #include "confmodel/Connection.hpp" #include "confmodel/DetectorStream.hpp" #include "confmodel/DetectorToDaqConnection.hpp" +#include "confmodel/DetDataSender.hpp" +#include "confmodel/DetDataReceiver.hpp" #include "logging/Logging.hpp" @@ -54,12 +56,12 @@ void // Extract basic configuration objects // - // Data reader - //const auto reader_conf = get_data_reader(); - //if (reader_conf == nullptr) { - // throw(BadConf(ERS_HERE, "No DataReaderModule configuration given")); - //} - //const std::string reader_class = reader_conf->get_template_for(); + // Detector frame builder + const auto det_frame_builder_conf = get_detector_frame_builder(); + if (det_frame_builder_conf == nullptr) { + throw(BadConf(ERS_HERE, "No DetectorFrameBuilderModule configuration given")); + } + const std::string builder_class = det_frame_builder_conf->get_template_for(); // Data writer const auto writer_conf = get_data_writer(); @@ -69,100 +71,129 @@ void const std::string writer_class = writer_conf->get_template_for(); // - // Get the callback descriptor + // Process the queue rules looking for inputs to our socket writer modules // - const DataMoveCallbackDescriptor* raw_data_callback_desc = get_callback_desc(); - - if (raw_data_callback_desc == nullptr) { - throw(BadConf(ERS_HERE, "No Raw Data Callback descriptor given")); + const QueueDescriptor* crtframebuilder_output_qdesc = nullptr; + auto queue_rules = get_queue_rules(); + if (queue_rules.size() != 1) { + throw(BadConf(ERS_HERE, "Strictly 1 queue rule is expected")); } + crtframebuilder_output_qdesc = queue_rules[0]->get_descriptor(); // // Scan Detector 2 DAQ connections to extract sender, receiver and stream information // // Loop over the detector to daq connections and generate: - // - One data reader per detector connection - // - One data writer per detector connection - - uint16_t conn_idx = 0; // NOLINT(build/unsigned) + // - One detector frame builder per data sender + // - One data writer per data sender + // - One queue per data sender for (auto d2d_conn : get_detector_connections()) { + auto d2d_conn_uid = d2d_conn->UID(); + // Are we sure? if (helper->is_disabled(d2d_conn)) { - TLOG_DEBUG(7) << "Ignoring disabled DetectorToDaqConnection " << d2d_conn->UID(); + TLOG_DEBUG(7) << "Ignoring disabled DetectorToDaqConnection " << d2d_conn_uid; continue; } - TLOG_DEBUG(6) << "Processing DetectorToDaqConnection " << d2d_conn->UID(); - - std::vector enabled_det_streams; - // Loop over streams - for (auto stream : d2d_conn->streams()) { + TLOG_DEBUG(6) << "Processing DetectorToDaqConnection " << d2d_conn_uid; + auto receiver = d2d_conn->receiver(); + + uint16_t sender_idx = 0; // NOLINT(build/unsigned) + + // Loop over senders + for (auto sender : d2d_conn->senders()) { + // Are we sure? - if (helper->is_disabled(stream)) { - TLOG_DEBUG(7) << "Ignoring disabled DetectorStream " << stream->UID(); + if (helper->is_disabled(sender)) { + TLOG_DEBUG(7) << "Ignoring disabled DataSender " << sender->UID(); continue; } - enabled_det_streams.push_back(stream); - } + + bool has_enabled_det_stream = false; + // Loop over streams + for (auto stream : sender->get_streams()) { + + // Are we sure? + if (helper->is_disabled(stream)) { + TLOG_DEBUG(7) << "Ignoring disabled DetectorStream " << stream->UID(); + continue; + } + + has_enabled_det_stream = true; + break; + } + + if (!has_enabled_det_stream) { + continue; + } - // Create the raw data callbacks - std::vector raw_data_callback_objs; + const auto sender_idx_str = std::to_string(sender_idx); + + // Create a connection that is dedicated to this sender + std::string sender_conn_uid(d2d_conn_uid + sender_idx_str); + auto sender_conn_obj = obj_fac.create("SocketDetectorToDaqConnection", sender_conn_uid); + sender_conn_obj.set_objs("net_senders", { &sender->config_object() }); + sender_conn_obj.set_obj("net_receiver", &receiver->config_object()); + const auto* sender_conn = obj_fac.get_dal(sender_conn_obj.UID()); + const auto* sender_conn_conf_obj = &sender_conn->config_object(); + + // Create data queue + conffwk::ConfigObject queue_obj = obj_fac.create_queue_obj(crtframebuilder_output_qdesc, sender_idx_str); + const auto* queue = obj_fac.get_dal(queue_obj.UID()); + const auto* queue_conf_obj = &queue->config_object(); + + //----------------------------------------------------------------- + // + // Create DetectorFrameBuilderModule object + // + + // + // Instantiate DetectorFrameBuilderModule of type CRTBernFrameBuilderModule/CRTGrenobleFrameBuilderModule + // + + // Create the detector frame builder object + + std::string builder_uid(fmt::format("crt-frame-builder-{}-{}", this->UID(), sender_idx_str)); + TLOG_DEBUG(6) << fmt::format("creating OKS configuration object for detector frame builder class {} with id {}", builder_class, builder_uid); + auto builder_obj = obj_fac.create(builder_class, builder_uid); + + // Populate configuration and interfaces + builder_obj.set_obj("configuration", &det_frame_builder_conf->config_object()); + builder_obj.set_obj("connection", sender_conn_conf_obj); + builder_obj.set_objs("outputs", { queue_conf_obj }); + + modules.push_back(obj_fac.get_dal(builder_obj.UID())); - // Create data queues - for (auto ds : enabled_det_streams) { - conffwk::ConfigObject callback_obj = obj_fac.create_callback_sid_obj(raw_data_callback_desc, ds->get_source_id()); - const auto* callback_conf = obj_fac.get_dal(callback_obj.UID()); - raw_data_callback_objs.push_back(&callback_conf->config_object()); - } - - //----------------------------------------------------------------- - // - // Create DataReaderModule object - // - - // - // Instantiate DataReaderModule of type CRTBernFrameBuilderModule/CRTGrenobleFrameBuilderModule - // - - // Create the Data reader object - - //std::string reader_uid(fmt::format("crtframebuilder-{}-{}", this->UID(), std::to_string(conn_idx++))); - //TLOG_DEBUG(6) << fmt::format("creating OKS configuration object for Data reader class {} with id {}", reader_class, reader_uid); - //auto reader_obj = obj_fac.create(reader_class, reader_uid); -// - //// Populate configuration and interfaces - //reader_obj.set_obj("configuration", &reader_conf->config_object()); - //reader_obj.set_objs("connections", { &d2d_conn->config_object() }); - //reader_obj.set_objs("raw_data_callbacks", raw_data_callback_objs); -// - //modules.push_back(obj_fac.get_dal(reader_obj.UID())); - - //----------------------------------------------------------------- - // - // Create DataWriterModule object - // - - // - // Instantiate DataWriterModule of type SocketWriterModule - // - - // Create the SocketWriterModule object - - std::string writer_uid(fmt::format("socketwriter-{}-{}", this->UID(), std::to_string(conn_idx++))); - TLOG_DEBUG(6) << fmt::format("Creating OKS configuration object for socket writer class {} with id {}", writer_class, writer_uid); - auto writer_obj = obj_fac.create(writer_class, writer_uid); - - // Populate configuration and interfaces - writer_obj.set_obj("configuration", &writer_conf->config_object()); - writer_obj.set_objs("connections", {&d2d_conn->config_object()}); - writer_obj.set_objs("raw_data_callbacks", raw_data_callback_objs); - - modules.push_back(obj_fac.get_dal(writer_obj.UID())); + //----------------------------------------------------------------- + // + // Create DataWriterModule object + // + + // + // Instantiate DataWriterModule of type SocketWriterModule + // + + // Create the SocketWriterModule object + + std::string writer_uid(fmt::format("socket-writer-{}-{}", this->UID(), sender_idx_str)); + TLOG_DEBUG(6) << fmt::format("Creating OKS configuration object for socket writer class {} with id {}", writer_class, writer_uid); + auto writer_obj = obj_fac.create(writer_class, writer_uid); + + // Populate configuration and interfaces + writer_obj.set_obj("configuration", &writer_conf->config_object()); + writer_obj.set_obj("connection", sender_conn_conf_obj); + writer_obj.set_objs("inputs", { queue_conf_obj }); + + modules.push_back(obj_fac.get_dal(writer_obj.UID())); + + ++sender_idx; + } } obj_fac.update_modules(modules); diff --git a/test/apps/generate_modules_test.cxx b/test/apps/generate_modules_test.cxx index 58ab190..cd4f8fa 100644 --- a/test/apps/generate_modules_test.cxx +++ b/test/apps/generate_modules_test.cxx @@ -118,16 +118,6 @@ main(int argc, char* argv[]) } } - auto socketwriter_module = daq_module->cast(); - if (socketwriter_module != nullptr) { - auto callback_confs = socketwriter_module->get_raw_data_callbacks(); - std::cout << " callback confs " << std::endl; - for (auto* callback_conf : callback_confs) { - auto cbObj = callback_conf->config_object(); - cbObj.print_ref(std::cout, *confdb, " "); - } - } - std::cout << std::endl; } } else {