Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions schema/appmodel/application.schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

<oks-schema>

<info name="" type="" num-of-items="69" oks-format="schema" oks-version="862f2957270" created-by="gjc" created-on="thinkpad" creation-time="20230616T091343" last-modified-by="eflumerf" last-modified-on="ironvirt9.mshome.net" last-modification-time="20260203T131505"/>
<info name="" type="" num-of-items="70" oks-format="schema" oks-version="862f2957270" created-by="gjc" created-on="thinkpad" creation-time="20230616T091343" last-modified-by="dergonul" last-modified-on="np04-srv-015.cern.ch" last-modification-time="20260213T122408"/>

<include>
<file path="schema/confmodel/dunedaq.schema.xml"/>
Expand All @@ -91,8 +91,8 @@
<superclass name="ResourceSetDisableAND"/>
<superclass name="SmartDaqApplication"/>
<attribute name="application_name" type="string" init-value="daq_application" is-not-null="yes"/>
<relationship name="data_writers" class-type="SocketDataWriterConf" low-cc="one" high-cc="many" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="data_reader" class-type="DataReaderConf" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="data_writer" class-type="SocketDataWriterConf" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="detector_connections" class-type="DetectorToDaqConnection" low-cc="zero" high-cc="many" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="callback_desc" class-type="DataMoveCallbackDescriptor" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<method name="generate_modules" description="Generate daq module dal objects for streams of the CRTReaderApplication on the fly">
Expand Down Expand Up @@ -527,8 +527,12 @@
<class name="SocketDataWriterModule">
<superclass name="DaqModule"/>
<relationship name="configuration" class-type="SocketDataWriterConf" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="connections" class-type="NetworkDetectorToDaqConnection" low-cc="one" high-cc="many" is-composite="yes" is-exclusive="no" is-dependent="no"/>
<relationship name="raw_data_callback" description="Configuration for raw data callback" class-type="DataMoveCallbackConf" low-cc="one" high-cc="one" is-composite="no" is-exclusive="no" is-dependent="no"/>
<relationship name="connections" class-type="SocketDetectorToDaqConnection" low-cc="one" high-cc="many" is-composite="yes" is-exclusive="no" is-dependent="no"/>
<relationship name="raw_data_callbacks" description="Configurations for raw data callbacks" class-type="DataMoveCallbackConf" low-cc="one" high-cc="many" is-composite="no" is-exclusive="no" is-dependent="no"/>
</class>

<class name="SocketDetectorToDaqConnection">
<superclass name="NetworkDetectorToDaqConnection"/>
</class>

<class name="SourceIDConf">
Expand Down
14 changes: 3 additions & 11 deletions schema/appmodel/fdmodules.schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

<oks-schema>

<info name="" type="" num-of-items="33" oks-format="schema" oks-version="862f2957270" created-by="gjc" created-on="thinkpad" creation-time="20230616T091343" last-modified-by="eflumerf" last-modified-on="ironvirt9.mshome.net" last-modification-time="20251104T211957"/>
<info name="" type="" num-of-items="32" oks-format="schema" oks-version="862f2957270" created-by="gjc" created-on="thinkpad" creation-time="20230616T091343" last-modified-by="dergonul" last-modified-on="np04-srv-015.cern.ch" last-modification-time="20260212T162900"/>

<include>
<file path="schema/confmodel/dunedaq.schema.xml"/>
Expand All @@ -89,15 +89,15 @@


<class name="CRTBernReaderConf">
<superclass name="DataReaderConf"/>
<superclass name="CRTReaderConf"/>
</class>

<class name="CRTBernReaderModule">
<superclass name="DataReaderModule"/>
</class>

<class name="CRTGrenobleReaderConf">
<superclass name="DataReaderConf"/>
<superclass name="CRTReaderConf"/>
</class>

<class name="CRTGrenobleReaderModule">
Expand Down Expand Up @@ -153,10 +153,6 @@
<superclass name="NWDetDataSender"/>
</class>

<class name="FakeSocketWriterModule">
<superclass name="SocketDataWriterModule"/>
</class>

<class name="FelixCardControllerModule">
<superclass name="DaqModule"/>
<attribute name="super_chunk_size" description="Number of chunks in superchunk" type="u16" init-value="12" is-not-null="yes"/>
Expand Down Expand Up @@ -245,8 +241,6 @@

<class name="SocketReaderConf">
<superclass name="DataReaderConf"/>
<attribute name="socket_type" description="Socket type" type="enum" range="TCP,UDP" init-value="UDP" is-not-null="yes"/>
<attribute name="local_ip" description="Local IP address" type="string" init-value="127.0.0.1" is-not-null="yes"/>
</class>

<class name="SocketReaderModule">
Expand All @@ -259,8 +253,6 @@

<class name="SocketWriterConf">
<superclass name="SocketDataWriterConf"/>
<attribute name="socket_type" description="Socket type" type="enum" range="TCP,UDP" init-value="UDP" is-not-null="yes"/>
<attribute name="remote_ip" description="Remote IP address" type="string" init-value="127.0.0.1" is-not-null="yes"/>
</class>

<class name="SocketWriterModule">
Expand Down
8 changes: 4 additions & 4 deletions schema/appmodel/wiec.schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

<oks-schema>

<info name="" type="" num-of-items="8" oks-format="schema" oks-version="862f2957270" created-by="gjc" created-on="thinkpad" creation-time="20230616T091343" last-modified-by="gjc" last-modified-on="latitude" last-modification-time="20250818T143705"/>
<info name="" type="" num-of-items="8" oks-format="schema" oks-version="862f2957270" created-by="gjc" created-on="thinkpad" creation-time="20230616T091343" last-modified-by="dergonul" last-modified-on="np04-srv-015.cern.ch" last-modification-time="20260212T161706"/>

<include>
<file path="schema/confmodel/dunedaq.schema.xml"/>
Expand Down Expand Up @@ -122,9 +122,9 @@

<class name="SocketDataSender">
<superclass name="NWDetDataSender"/>
<attribute name="link_id" type="u32" is-not-null="yes"/>
<attribute name="port" type="u32" init-value="1234" is-not-null="yes"/>
<attribute name="control_host" type="string" init-value="localhost" is-not-null="yes"/>
<attribute name="socket_type" description="Socket type" type="enum" range="TCP,UDP" init-value="UDP" is-not-null="yes"/>
<attribute name="local_port" type="u32" is-not-null="yes" range="0..65535" init-value="0"/>
<attribute name="remote_port" type="u32" is-not-null="yes" range="1..65535" init-value="20001"/>
</class>

<class name="WIBModule">
Expand Down
57 changes: 24 additions & 33 deletions src/CRTReaderApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ 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();

//
// Get the callback descriptor
//
Expand All @@ -79,10 +80,9 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const
// 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<uint32_t, const appmodel::DataMoveCallbackConf*> callback_confs_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;

Expand All @@ -95,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<const confmodel::DetectorStream*> enabled_det_streams;

std::vector<const confmodel::DetectorStream*> enabled_det_streams;
// Loop over streams
for (auto stream : d2d_conn->streams()) {

Expand All @@ -118,8 +117,7 @@ CRTReaderApplication::generate_modules(const confmodel::Session* session) const
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<DataMoveCallbackConf>(callback_obj.UID());
raw_data_callback_objs.push_back(&callback_conf->config_object());
callback_confs_by_sid[ds->get_source_id()] = callback_conf;
}
}

//-----------------------------------------------------------------
//
Expand All @@ -132,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("raw_data_callbacks", raw_data_callback_objs);
Expand All @@ -145,32 +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

conn_idx = 0;

for (const auto writer_conf : writer_confs) {
// Create the SocketWriterModule object

const std::string writer_class = writer_conf->get_template_for();
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);

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("raw_data_callbacks", raw_data_callback_objs);

// Populate configuration and interfaces
writer_obj.set_obj("configuration", &writer_conf->config_object());
writer_obj.set_objs("connections", {&d2d_conn->config_object()});

modules.push_back(obj_fac.get_dal<confmodel::DaqModule>(writer_obj.UID()));
}
modules.push_back(obj_fac.get_dal<confmodel::DaqModule>(writer_obj.UID()));
}

obj_fac.update_modules(modules);
Expand Down
13 changes: 10 additions & 3 deletions src/ReadoutApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,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<appmodel::DPDKReceiver>()) ||
(reader_class == "SocketReaderModule" && !det_receiver->cast<appmodel::SocketReceiver>())) {
if (!det_receiver->cast<appmodel::DPDKReceiver>()) {
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<appmodel::SocketReceiver>()) {
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())));
Expand Down
5 changes: 3 additions & 2 deletions test/apps/generate_modules_test.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ main(int argc, char* argv[])

auto socketwriter_module = daq_module->cast<appmodel::SocketDataWriterModule>();
if (socketwriter_module != nullptr) {
auto callback_conf = socketwriter_module->get_raw_data_callback();
if (callback_conf != 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, " ");
}
Expand Down
Loading