DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
appmodel
src
TRMonReqApplication.cpp
Go to the documentation of this file.
1
10
11
#include "
appmodel/TRMonReqApplication.hpp
"
12
#include "
ConfigObjectFactory.hpp
"
13
#include "
appmodel/DataStoreConf.hpp
"
14
#include "
appmodel/DataWriterConf.hpp
"
15
#include "
appmodel/DataWriterModule.hpp
"
16
#include "
appmodel/FilenameParams.hpp
"
17
#include "
appmodel/NetworkConnectionDescriptor.hpp
"
18
#include "
appmodel/NetworkConnectionRule.hpp
"
19
#include "
appmodel/QueueConnectionRule.hpp
"
20
#include "
appmodel/QueueDescriptor.hpp
"
21
#include "
appmodel/TRMonRequestorConf.hpp
"
22
#include "
appmodel/TRMonRequestorModule.hpp
"
23
#include "
appmodel/appmodelIssues.hpp
"
24
25
#include "
conffwk/Configuration.hpp
"
26
27
#include "
confmodel/Connection.hpp
"
28
#include "
confmodel/DetectorStream.hpp
"
29
#include "
confmodel/DetectorToDaqConnection.hpp
"
30
#include "
confmodel/NetworkConnection.hpp
"
31
#include "
confmodel/Service.hpp
"
32
33
#include "
logging/Logging.hpp
"
34
#include "
oks/kernel.hpp
"
35
36
#include <fmt/core.h>
37
#include <string>
38
#include <vector>
39
40
namespace
dunedaq
{
41
namespace
appmodel
{
42
43
void
44
TRMonReqApplication::generate_modules
(std::shared_ptr<appmodel::ConfigurationHelper> helper)
const
45
{
46
47
ConfigObjectFactory
obj_fac(
this
);
48
49
std::vector<const confmodel::DaqModule*> modules;
50
51
// Containers for module specific config objects for output/input
52
std::vector<const conffwk::ConfigObject*> trmrOutputObjs;
53
54
// -- First, we process expected Queue and Network connections and create their objects.
55
56
// Process the queue rules looking for the TriggerDecisionToken queue between DataWriterModule and TRMonRequestor
57
const
QueueDescriptor
* tdtQDesc =
nullptr
;
58
for
(
auto
rule :
get_queue_rules
()) {
59
auto
destination_class = rule->get_destination_class();
60
if
(destination_class ==
"TRMonRequestorModule"
) {
61
tdtQDesc = rule->get_descriptor();
62
}
63
}
64
if
(tdtQDesc ==
nullptr
) {
// BadConf if no descriptor between DataWriterModule and TRMonRequestor
65
throw
(BadConf(
ERS_HERE
,
"Could not find queue descriptor rule for TriggerDecisionTokens!"
));
66
}
67
// Create queue connection config object
68
auto
tdtQueueObj = obj_fac.
create_queue_obj
(tdtQDesc,
UID
());
69
70
// Process the network rules looking for the TriggerRecord input for the DataWriter
71
const
NetworkConnectionDescriptor
* dwNetDesc =
nullptr
;
72
for
(
auto
rule :
get_network_rules
()) {
73
auto
descriptor
= rule->get_descriptor();
74
auto
data_type =
descriptor
->get_data_type();
75
if
(data_type ==
"TriggerRecord"
) {
76
dwNetDesc = rule->get_descriptor();
77
}
78
}
79
if
(dwNetDesc ==
nullptr
) {
// BadConf if no descriptor for TriggerRecords into DW
80
throw
(BadConf(
ERS_HERE
,
"Could not find network descriptor rule for input TriggerRecords!"
));
81
}
82
// Create network connection config object
83
auto
dwInputObj = obj_fac.
create_net_obj
(dwNetDesc,
""
);
84
85
// Create network connections for all DFApplications in session
86
std::vector<conffwk::ConfigObject> trmonreqNetObjs;
87
for
(
auto
[uid,
descriptor
]:
88
helper->get_netdescriptors(
"TRMonRequest"
,
"DFApplication"
)) {
89
trmonreqNetObjs.emplace_back(obj_fac.
create_net_obj
(
descriptor
, uid));
90
}
91
92
// Get pointers to objects here, after vector has been filled so they don't move on us
93
for
(
auto
&
obj
: trmonreqNetObjs) {
94
trmrOutputObjs.push_back(&
obj
);
95
}
96
97
// -- Second, we create the Module objects and assign their configs, with the precreated
98
// -- connection config objects above.
99
100
// Get TRB Config Object
101
auto
trmrConf =
get_trmonreq
();
102
if
(trmrConf ==
nullptr
) {
103
throw
(BadConf(
ERS_HERE
,
"No TRMonRequestor configuration given"
));
104
}
105
auto
trmrConfObj = trmrConf->config_object();
106
// Prepare TRMR Module Object and assign its Config Object.
107
std::string trmrUid(
UID
() +
"-trmr"
);
108
conffwk::ConfigObject
trmrObj = obj_fac.
create
(
"TRMonRequestorModule"
, trmrUid);
109
trmrObj.
set_obj
(
"configuration"
, &trmrConfObj);
110
trmrObj.
set_objs
(
"inputs"
, { &tdtQueueObj });
111
trmrObj.
set_objs
(
"outputs"
, trmrOutputObjs);
112
trmrObj.
set_obj
(
"trigger_record_destination"
, &dwInputObj);
113
// Push TRMR Module Object from confdb
114
modules.push_back(obj_fac.
get_dal
<
TRMonRequestorModule
>(trmrUid));
115
116
// Get DataWriterModule Config Object (only one for now, maybe more later?)
117
auto
dwrConf =
get_data_writer
();
118
if
(dwrConf ==
nullptr
) {
119
throw
(BadConf(
ERS_HERE
,
"No DataWriterModule configuration given"
));
120
}
121
122
auto
dwrConfObj = dwrConf->config_object();
123
124
// Prepare DataWriterModule Module Object and assign its Config Object.
125
std::string dwrUid(fmt::format(
"{}-dw"
,
UID
()));
126
conffwk::ConfigObject
dwrObj = obj_fac.
create
(
"DataWriterModule"
, dwrUid);
127
dwrObj.
set_by_val
(
"writer_identifier"
, fmt::format(
"{}_dw"
,
UID
()));
128
dwrObj.
set_obj
(
"configuration"
, &dwrConfObj);
129
dwrObj.
set_objs
(
"inputs"
, { &dwInputObj });
130
dwrObj.
set_objs
(
"outputs"
, { &tdtQueueObj });
131
// Push DataWriterModule Module Object from confdb
132
modules.push_back(obj_fac.
get_dal
<
DataWriterModule
>(dwrUid));
133
134
obj_fac.
update_modules
(modules);
135
}
136
137
}
// namespace appmodel
138
}
// namespace dunedaq
ConfigObjectFactory.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_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_queue_obj
conffwk::ConfigObject create_queue_obj(const QueueDescriptor *qdesc, std::string uid="") const
Definition
ConfigObjectFactory.cpp:35
dunedaq::appmodel::ConfigObjectFactory::create
conffwk::ConfigObject create(const std::string &class_name, const std::string &id) const
Definition
ConfigObjectFactory.cpp:26
dunedaq::appmodel::DataWriterModule
Definition
DataWriterModule.hpp:32
dunedaq::appmodel::NetworkConnectionDescriptor
Definition
NetworkConnectionDescriptor.hpp:29
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::TRMonReqApplication::generate_modules
void generate_modules(std::shared_ptr< appmodel::ConfigurationHelper >) const override
Definition
TRMonReqApplication.cpp:44
dunedaq::appmodel::TRMonReqApplication::get_trmonreq
const dunedaq::appmodel::TRMonRequestorConf * get_trmonreq() const
Get "trmonreq" relationship value. Configuration of the TRMonRequestor to be generated by get_modules...
Definition
TRMonReqApplication.hpp:112
dunedaq::appmodel::TRMonReqApplication::get_data_writer
const dunedaq::appmodel::DataWriterConf * get_data_writer() const
Get "data_writer" relationship value.
Definition
TRMonReqApplication.hpp:144
dunedaq::appmodel::TRMonRequestorModule
Definition
TRMonRequestorModule.hpp:35
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::UID
const std::string & UID() const noexcept
Definition
DalObject.hpp:135
Configuration.hpp
conffwk entry point
DataStoreConf.hpp
DataWriterConf.hpp
DataWriterModule.hpp
FilenameParams.hpp
NetworkConnectionDescriptor.hpp
NetworkConnectionRule.hpp
QueueConnectionRule.hpp
QueueDescriptor.hpp
TRMonReqApplication.hpp
TRMonRequestorConf.hpp
TRMonRequestorModule.hpp
Connection.hpp
DetectorStream.hpp
DetectorToDaqConnection.hpp
NetworkConnection.hpp
Service.hpp
kernel.hpp
Logging.hpp
conffwk.ConfigObject
Definition
ConfigObject.py:1
dunedaq::appmodel
Definition
CardControllerWrapper.hpp:21
dunedaq
Including Qt Headers.
Definition
module.cpp:16
dunedaq::obj
msgpack::object obj
Definition
Serialization.hpp:257
dunedaq::descriptor
CIB Buffer std::string descriptor Message from std::string descriptor CIB process std::string descriptor descriptor
Definition
CIBModuleIssues.hpp:57
Generated on
for DUNE-DAQ by
1.17.0