DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
appmodel
src
FakeDataApplication.cpp
Go to the documentation of this file.
1
10
11
12
#include "
ConfigObjectFactory.hpp
"
13
14
#include "
conffwk/Configuration.hpp
"
15
#include "
oks/kernel.hpp
"
16
17
#include "
confmodel/Connection.hpp
"
18
#include "
confmodel/NetworkConnection.hpp
"
19
// #include "confmodel/ReadoutGroup.hpp"
20
#include "
confmodel/ResourceSet.hpp
"
21
#include "
confmodel/Service.hpp
"
22
23
#include "
appmodel/FakeDataApplication.hpp
"
24
#include "
appmodel/FakeDataProdConf.hpp
"
25
#include "
appmodel/FakeDataProdModule.hpp
"
26
#include "
appmodel/FragmentAggregatorModule.hpp
"
27
#include "
appmodel/FragmentAggregatorConf.hpp
"
28
#include "
appmodel/NetworkConnectionDescriptor.hpp
"
29
#include "
appmodel/NetworkConnectionRule.hpp
"
30
#include "
appmodel/QueueConnectionRule.hpp
"
31
#include "
appmodel/QueueDescriptor.hpp
"
32
33
#include "
appmodel/appmodelIssues.hpp
"
34
35
#include "
logging/Logging.hpp
"
36
37
#include <string>
38
#include <vector>
39
40
namespace
dunedaq
{
41
namespace
appmodel
{
42
43
//-----------------------------------------------------------------------------
44
45
std::vector<const confmodel::Resource*>
46
FakeDataApplication::contained_resources
()
const
{
47
return
to_resources
(
get_producers
());
48
}
49
50
void
51
FakeDataApplication::generate_modules
(std::shared_ptr<appmodel::ConfigurationHelper> helper)
const
52
{
53
// oks::OksFile::set_nolock_mode(true);
54
55
std::vector<const confmodel::DaqModule*> modules;
56
57
ConfigObjectFactory
obj_fac(
this
);
58
59
60
// Process the queue rules looking for inputs to our DL/TP handler modules
61
const
QueueDescriptor
* dlhReqInputQDesc =
nullptr
;
62
const
QueueDescriptor
* faOutputQDesc =
nullptr
;
63
64
for
(
auto
rule :
get_queue_rules
()) {
65
auto
destination_class = rule->get_destination_class();
66
auto
data_type = rule->get_descriptor()->get_data_type();
67
if
(destination_class ==
"FakeDataProdModule"
) {
68
if
(data_type ==
"DataRequest"
) {
69
dlhReqInputQDesc = rule->get_descriptor();
70
}
71
}
else
if
(destination_class ==
"FragmentAggregatorModule"
) {
72
faOutputQDesc = rule->get_descriptor();
73
}
74
}
75
if
(faOutputQDesc ==
nullptr
) {
76
throw
(BadConf(
ERS_HERE
,
"No fragment output queue descriptor given"
));
77
}
78
if
(dlhReqInputQDesc ==
nullptr
) {
79
throw
(BadConf(
ERS_HERE
,
"No DLH request input queue descriptor given"
));
80
}
81
// Process the network rules looking for the Fragment Aggregator and TP handler data reuest inputs
82
const
NetworkConnectionDescriptor
* faNetDesc =
nullptr
;
83
const
NetworkConnectionDescriptor
* tsNetDesc =
nullptr
;
84
for
(
auto
rule :
get_network_rules
()) {
85
auto
endpoint_class = rule->get_endpoint_class();
86
if
(endpoint_class ==
"FragmentAggregatorModule"
) {
87
faNetDesc = rule->get_descriptor();
88
}
else
if
(endpoint_class ==
"FakeDataProdModule"
) {
89
tsNetDesc = rule->get_descriptor();
90
}
91
}
92
if
(faNetDesc ==
nullptr
) {
93
throw
(BadConf(
ERS_HERE
,
"No Fragment output network descriptor given"
));
94
}
95
if
(tsNetDesc ==
nullptr
) {
96
throw
(BadConf(
ERS_HERE
,
"No TimeSync output network descriptor given"
));
97
}
98
99
// Create here the Queue on which all data fragments are forwarded to the fragment aggregator
100
// and a container for the queues of data request to TP handler and DLH
101
102
std::vector<const confmodel::Connection*> faOutputQueues;
103
104
conffwk::ConfigObject
faQueueObj = obj_fac.
create_queue_obj
(faOutputQDesc,
UID
());
105
106
// Create a FakeDataProdModule for each stream of this Readout Group
107
for
(
auto
fdpConf :
get_producers
()) {
108
if
(helper->is_disabled(fdpConf)) {
109
TLOG_DEBUG
(7) <<
"Ignoring disabled FakeDataProdConf "
<< fdpConf->UID();
110
continue
;
111
}
112
113
auto
stream = fdpConf->cast<
appmodel::FakeDataProdConf
>();
114
if
(stream ==
nullptr
) {
115
throw
(BadConf(
ERS_HERE
,
"ReadoutGroup contains something other than FakeDataProdConf"
));
116
}
117
118
auto
id
= stream->
get_source_id
();
119
std::string uid(
"FakeDataProdModule-"
+ std::to_string(
id
));
120
TLOG_DEBUG
(7) <<
"creating OKS configuration object for FakeDataProdModule"
;
121
conffwk::ConfigObject
dlhObj = obj_fac.
create
(
"FakeDataProdModule"
, uid);
122
dlhObj.
set_obj
(
"configuration"
, &stream->config_object());
123
124
// Time Sync network connection
125
auto
tsNetObj = obj_fac.
create_net_obj
(tsNetDesc, std::to_string(
id
));
126
127
dlhObj.
set_objs
(
"outputs"
, { &faQueueObj, &tsNetObj });
128
129
auto
reqQueueObj = obj_fac.
create_queue_sid_obj
(dlhReqInputQDesc,
id
);
130
131
// Add the requessts queue dal pointer to the outputs of the FragmentAggregatorModule
132
faOutputQueues.push_back(obj_fac.
get_dal
<
confmodel::Connection
>(
133
dlhReqInputQDesc->
get_uid_base
() + std::to_string(
id
)));
134
135
dlhObj.
set_objs
(
"inputs"
, { &reqQueueObj });
136
137
modules.push_back(obj_fac.
get_dal
<
FakeDataProdModule
>(uid));
138
}
139
140
// Finally create Fragment Aggregator
141
auto
aggregator_conf =
get_fragment_aggregator
();
142
if
(aggregator_conf == 0) {
143
throw
(BadConf(
ERS_HERE
,
"No FragmentAggregatorModule configuration given"
));
144
}
145
std::string faUid(
"fragmentaggregator-"
+
UID
());
146
TLOG_DEBUG
(7) <<
"creating OKS configuration object for Fragment Aggregator class "
;
147
conffwk::ConfigObject
faObj = obj_fac.
create
(
"FragmentAggregatorModule"
, faUid);
148
149
// Add network connection to TRBs
150
conffwk::ConfigObject
faNetObj = obj_fac.
create_net_obj
(faNetDesc,
UID
());
151
152
// Add output queueus of data requests
153
std::vector<const conffwk::ConfigObject*> qObjs;
154
for
(
auto
q : faOutputQueues) {
155
qObjs.push_back(&q->config_object());
156
}
157
faObj.
set_obj
(
"configuration"
, &aggregator_conf->config_object());
158
faObj.
set_objs
(
"inputs"
, { &faNetObj, &faQueueObj });
159
faObj.
set_objs
(
"outputs"
, qObjs);
160
161
modules.push_back(obj_fac.
get_dal
<
FragmentAggregatorModule
>(faUid));
162
163
obj_fac.
update_modules
(modules);
164
}
165
166
}
// namespace appmodel
167
}
// 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_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_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::FakeDataApplication::generate_modules
void generate_modules(std::shared_ptr< appmodel::ConfigurationHelper >) const override
Definition
FakeDataApplication.cpp:51
dunedaq::appmodel::FakeDataApplication::get_fragment_aggregator
const dunedaq::appmodel::FragmentAggregatorConf * get_fragment_aggregator() const
Get "fragment_aggregator" relationship value.
Definition
FakeDataApplication.hpp:183
dunedaq::appmodel::FakeDataApplication::get_producers
const std::vector< const dunedaq::appmodel::FakeDataProdConf * > & get_producers() const
Get "producers" relationship value. List of configurations of fake data producer modules to be used b...
Definition
FakeDataApplication.hpp:151
dunedaq::appmodel::FakeDataApplication::contained_resources
virtual std::vector< const Resource * > contained_resources() const override
Definition
FakeDataApplication.cpp:46
dunedaq::appmodel::FakeDataProdConf
Definition
FakeDataProdConf.hpp:23
dunedaq::appmodel::FakeDataProdConf::get_source_id
uint32_t get_source_id() const
Get "source_id" attribute value. The SourceID of this link.
Definition
FakeDataProdConf.hpp:142
dunedaq::appmodel::FakeDataProdModule
Definition
FakeDataProdModule.hpp:32
dunedaq::appmodel::FragmentAggregatorModule
Definition
FragmentAggregatorModule.hpp:32
dunedaq::appmodel::NetworkConnectionDescriptor
Definition
NetworkConnectionDescriptor.hpp:29
dunedaq::appmodel::QueueDescriptor
Definition
QueueDescriptor.hpp:20
dunedaq::appmodel::QueueDescriptor::get_uid_base
const std::string & get_uid_base() const
Get "uid_base" attribute value. Base for UID string. May be combined with a source id.
Definition
QueueDescriptor.hpp:100
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::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
dunedaq::confmodel::Connection
Definition
Connection.hpp:20
Configuration.hpp
conffwk entry point
FakeDataApplication.hpp
FakeDataProdConf.hpp
FakeDataProdModule.hpp
FragmentAggregatorConf.hpp
FragmentAggregatorModule.hpp
NetworkConnectionDescriptor.hpp
NetworkConnectionRule.hpp
QueueConnectionRule.hpp
QueueDescriptor.hpp
Connection.hpp
NetworkConnection.hpp
ResourceSet.hpp
to_resources
std::vector< const dunedaq::confmodel::Resource * > to_resources(const std::vector< T * > &vector_of_children)
Definition
ResourceSet.hpp:108
Service.hpp
kernel.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