DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
appmodel
src
DTSHSIApplication.cpp
Go to the documentation of this file.
1
10
11
12
#include "
appmodel/ConfigurationHelper.hpp
"
13
#include "
ConfigObjectFactory.hpp
"
14
#include "
appmodel/DTSHSIApplication.hpp
"
15
#include "
appmodel/NetworkConnectionDescriptor.hpp
"
16
#include "
appmodel/NetworkConnectionRule.hpp
"
17
#include "
appmodel/QueueConnectionRule.hpp
"
18
#include "
appmodel/QueueDescriptor.hpp
"
19
#include "
appmodel/DataHandlerModule.hpp
"
20
#include "
appmodel/DataHandlerConf.hpp
"
21
#include "
appmodel/SourceIDConf.hpp
"
22
#include "
appmodel/HSIReadout.hpp
"
23
#include "
appmodel/HSIReadoutConf.hpp
"
24
#include "
appmodel/appmodelIssues.hpp
"
25
#include "
confmodel/Connection.hpp
"
26
#include "
confmodel/NetworkConnection.hpp
"
27
#include "
confmodel/Service.hpp
"
28
#include "
logging/Logging.hpp
"
29
#include "
conffwk/Configuration.hpp
"
30
31
#include <iostream>
32
#include <string>
33
#include <vector>
34
35
namespace
dunedaq
{
36
namespace
appmodel
{
37
38
39
void
40
DTSHSIApplication::generate_modules
(std::shared_ptr<appmodel::ConfigurationHelper>
/*helper*/
)
const
41
{
42
ConfigObjectFactory
obj_fac(
this
);
43
44
std::vector<const confmodel::DaqModule*> modules;
45
46
auto
dlhConf =
get_link_handler
();
47
auto
dlhClass = dlhConf->get_template_for();
48
49
const
QueueDescriptor
* dlhInputQDesc =
nullptr
;
50
51
for
(
auto
rule :
get_queue_rules
()) {
52
auto
destination_class = rule->get_destination_class();
53
auto
data_type = rule->get_descriptor()->get_data_type();
54
if
(destination_class ==
"DataHandlerModule"
|| destination_class == dlhClass) {
55
dlhInputQDesc = rule->get_descriptor();
56
}
57
}
58
59
const
NetworkConnectionDescriptor
* dlhReqInputNetDesc =
nullptr
;
60
const
NetworkConnectionDescriptor
* tsNetDesc =
nullptr
;
61
const
NetworkConnectionDescriptor
* hsiNetDesc =
nullptr
;
62
63
for
(
auto
rule :
get_network_rules
()) {
64
auto
endpoint_class = rule->get_endpoint_class();
65
auto
data_type = rule->get_descriptor()->get_data_type();
66
67
if
(endpoint_class ==
"DataHandlerModule"
|| endpoint_class == dlhClass) {
68
if
(data_type ==
"TimeSync"
) {
69
tsNetDesc = rule->get_descriptor();
70
}
71
if
(data_type ==
"DataRequest"
) {
72
dlhReqInputNetDesc = rule->get_descriptor();
73
}
74
}
75
if
(data_type ==
"HSIEvent"
) {
76
hsiNetDesc = rule->get_descriptor();
77
}
78
}
79
80
auto
rdrConf =
get_generator
();
81
if
(rdrConf == 0) {
82
throw
(BadConf(
ERS_HERE
,
"No HSIEventGeneratorModule configuration given"
));
83
}
84
if
(dlhInputQDesc ==
nullptr
) {
85
throw
(BadConf(
ERS_HERE
,
"No DLH data input queue descriptor given"
));
86
}
87
if
(dlhReqInputNetDesc ==
nullptr
) {
88
throw
(BadConf(
ERS_HERE
,
"No DLH request input network descriptor given"
));
89
}
90
if
(hsiNetDesc ==
nullptr
) {
91
throw
(BadConf(
ERS_HERE
,
"No HSIEvent output network descriptor given"
));
92
}
93
94
auto
idconf =
get_source_id
();
95
if
(idconf ==
nullptr
) {
96
throw
(BadConf(
ERS_HERE
,
"No SourceIDConf given"
));
97
}
98
auto
id
= idconf->get_sid();
99
100
auto
det_id = 1;
// TODO Eric Flumerfelt <eflumerf@fnal.gov>, 08-Feb-2024: This is a magic number corresponding to kDAQ
101
std::string uid(
"DLH-"
+ std::to_string(
id
));
102
TLOG_DEBUG
(7) <<
"creating OKS configuration object for Data Link Handler class "
<< dlhClass <<
", id "
<< id;
103
conffwk::ConfigObject
dlhObj = obj_fac.
create
(dlhClass, uid);
104
dlhObj.
set_by_val
<uint32_t>(
"source_id"
, id);
105
dlhObj.
set_by_val
<uint32_t>(
"detector_id"
, det_id);
106
dlhObj.
set_by_val
<
bool
>(
"post_processing_enabled"
,
false
);
107
dlhObj.
set_obj
(
"module_configuration"
, &dlhConf->config_object());
108
109
// Time Sync network connection
110
if
(dlhConf->get_generate_timesync()) {
111
auto
tsServiceObj = tsNetDesc->
get_associated_service
()->
config_object
();
112
auto
tsNetObj = obj_fac.
create_net_obj
(tsNetDesc, std::to_string(
id
));
113
114
dlhObj.
set_objs
(
"outputs"
, { &tsNetObj });
115
}
else
{
116
dlhObj.
set_objs
(
"outputs"
, {});
117
}
118
conffwk::ConfigObject
queueObj = obj_fac.
create_queue_sid_obj
(dlhInputQDesc,
id
);
119
conffwk::ConfigObject
faNetObj = obj_fac.
create_net_obj
(dlhReqInputNetDesc,
UID
());
120
dlhObj.
set_objs
(
"inputs"
, { &queueObj, &faNetObj });
121
122
modules.push_back(obj_fac.
get_dal
<
DataHandlerModule
>(uid));
123
124
auto
hsiServiceObj = hsiNetDesc->
get_associated_service
()->
config_object
();
125
conffwk::ConfigObject
hsiNetObj = obj_fac.
create_net_obj
(hsiNetDesc,
""
);
126
127
std::string genuid(
"HSI-"
+ std::to_string(
id
));
128
conffwk::ConfigObject
hsiObj = obj_fac.
create
(
"HSIReadout"
, genuid);
129
hsiObj.
set_obj
(
"configuration"
, &rdrConf->config_object());
130
hsiObj.
set_objs
(
"outputs"
, { &queueObj, &hsiNetObj });
131
132
modules.push_back(obj_fac.
get_dal
<
HSIReadout
>(genuid));
133
134
obj_fac.
update_modules
(modules);
135
}
136
137
}
// namespace appmodel
138
}
// namespace dunedaq
ConfigObjectFactory.hpp
ConfigurationHelper.hpp
ERS_HERE
#define ERS_HERE
Definition
LocalContext.hpp:141
appmodelIssues.hpp
dunedaq::appmodel::ConfigObjectFactory
Definition
ConfigObjectFactory.hpp:32
dunedaq::appmodel::ConfigObjectFactory::update_modules
void update_modules(const std::vector< const confmodel::DaqModule * > &modules)
Definition
ConfigObjectFactory.hpp:87
dunedaq::appmodel::ConfigObjectFactory::create_queue_sid_obj
conffwk::ConfigObject create_queue_sid_obj(const QueueDescriptor *qdesc, uint32_t src_id) const
Definition
ConfigObjectFactory.cpp:48
dunedaq::appmodel::ConfigObjectFactory::create_net_obj
conffwk::ConfigObject create_net_obj(const NetworkConnectionDescriptor *ndesc, std::string uid) const
Helper function that gets a network connection config.
Definition
ConfigObjectFactory.cpp:90
dunedaq::appmodel::ConfigObjectFactory::get_dal
const T * get_dal(std::string uid) const
Definition
ConfigObjectFactory.hpp:77
dunedaq::appmodel::ConfigObjectFactory::create
conffwk::ConfigObject create(const std::string &class_name, const std::string &id) const
Definition
ConfigObjectFactory.cpp:26
dunedaq::appmodel::DTSHSIApplication::get_link_handler
const dunedaq::appmodel::DataHandlerConf * get_link_handler() const
Get "link_handler" relationship value.
Definition
DTSHSIApplication.hpp:107
dunedaq::appmodel::DTSHSIApplication::generate_modules
void generate_modules(std::shared_ptr< appmodel::ConfigurationHelper >) const override
Definition
DTSHSIApplication.cpp:40
dunedaq::appmodel::DTSHSIApplication::get_generator
const dunedaq::appmodel::HSIReadoutConf * get_generator() const
Get "generator" relationship value.
Definition
DTSHSIApplication.hpp:138
dunedaq::appmodel::DataHandlerModule
Definition
DataHandlerModule.hpp:36
dunedaq::appmodel::HSIReadout
Definition
HSIReadout.hpp:32
dunedaq::appmodel::NetworkConnectionDescriptor
Definition
NetworkConnectionDescriptor.hpp:29
dunedaq::appmodel::NetworkConnectionDescriptor::get_associated_service
const dunedaq::confmodel::Service * get_associated_service() const
Get "associated_service" relationship value. Service provided by this connection.
Definition
NetworkConnectionDescriptor.hpp:254
dunedaq::appmodel::QueueDescriptor
Definition
QueueDescriptor.hpp:20
dunedaq::appmodel::SmartDaqApplication::get_network_rules
const std::vector< const dunedaq::appmodel::NetworkConnectionRule * > & get_network_rules() const
Get "network_rules" relationship value.
Definition
SmartDaqApplication.hpp:168
dunedaq::appmodel::SmartDaqApplication::get_queue_rules
const std::vector< const dunedaq::appmodel::QueueConnectionRule * > & get_queue_rules() const
Get "queue_rules" relationship value.
Definition
SmartDaqApplication.hpp:143
dunedaq::appmodel::SmartDaqApplication::get_source_id
const dunedaq::appmodel::SourceIDConf * get_source_id() const
Get "source_id" relationship value.
Definition
SmartDaqApplication.hpp:118
dunedaq::conffwk::ConfigObject::set_by_val
void set_by_val(const std::string &name, T value)
Set attribute value.
Definition
ConfigObject.hpp:398
dunedaq::conffwk::ConfigObject::set_objs
void set_objs(const std::string &name, const std::vector< const ConfigObject * > &o, bool skip_non_null_check=false)
Set relationship multi-value.
Definition
ConfigObject.hpp:372
dunedaq::conffwk::ConfigObject::set_obj
void set_obj(const std::string &name, const ConfigObject *o, bool skip_non_null_check=false)
Set relationship single-value.
Definition
ConfigObject.hpp:356
dunedaq::conffwk::DalObject::config_object
const ConfigObject & config_object() const
Definition
DalObject.hpp:206
dunedaq::conffwk::DalObject::UID
const std::string & UID() const noexcept
Definition
DalObject.hpp:135
Configuration.hpp
conffwk entry point
DTSHSIApplication.hpp
DataHandlerConf.hpp
DataHandlerModule.hpp
HSIReadoutConf.hpp
HSIReadout.hpp
NetworkConnectionDescriptor.hpp
NetworkConnectionRule.hpp
QueueConnectionRule.hpp
QueueDescriptor.hpp
SourceIDConf.hpp
Connection.hpp
NetworkConnection.hpp
Service.hpp
Logging.hpp
TLOG_DEBUG
#define TLOG_DEBUG(lvl,...)
Definition
Logging.hpp:112
conffwk.ConfigObject
Definition
ConfigObject.py:1
dunedaq::appmodel
Definition
CardControllerWrapper.hpp:21
dunedaq
Including Qt Headers.
Definition
module.cpp:16
Generated on
for DUNE-DAQ by
1.17.0