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