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
#include "
ConfigObjectFactory.hpp
"
12
13
#include "
conffwk/Configuration.hpp
"
14
#include "
oks/kernel.hpp
"
15
16
#include "
confmodel/Connection.hpp
"
17
#include "
confmodel/NetworkConnection.hpp
"
18
// #include "confmodel/ReadoutGroup.hpp"
19
#include "
confmodel/ExcludableEntitySet.hpp
"
20
#include "
confmodel/Service.hpp
"
21
22
#include "
appmodel/FakeDataApplication.hpp
"
23
#include "
appmodel/FakeDataProdConf.hpp
"
24
#include "
appmodel/FakeDataProdModule.hpp
"
25
#include "
appmodel/FragmentAggregatorConf.hpp
"
26
#include "
appmodel/FragmentAggregatorModule.hpp
"
27
#include "
appmodel/NetworkConnectionDescriptor.hpp
"
28
#include "
appmodel/NetworkConnectionRule.hpp
"
29
#include "
appmodel/QueueConnectionRule.hpp
"
30
#include "
appmodel/QueueDescriptor.hpp
"
31
32
#include "
appmodel/appmodelIssues.hpp
"
33
34
#include "
logging/Logging.hpp
"
35
36
#include <string>
37
#include <vector>
38
39
namespace
dunedaq
{
40
namespace
appmodel
{
41
42
//-----------------------------------------------------------------------------
43
44
std::vector<const confmodel::ExcludableEntity*>
45
FakeDataApplication::contained_excludable_entities
()
const
46
{
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
// Process the queue rules looking for inputs to our DL/TP handler modules
60
const
QueueDescriptor
* dlhReqInputQDesc =
nullptr
;
61
const
QueueDescriptor
* faOutputQDesc =
nullptr
;
62
63
for
(
auto
rule :
get_queue_rules
()) {
64
auto
destination_class = rule->get_destination_class();
65
auto
data_type = rule->get_descriptor()->get_data_type();
66
if
(destination_class ==
"FakeDataProdModule"
) {
67
if
(data_type ==
"DataRequest"
) {
68
dlhReqInputQDesc = rule->get_descriptor();
69
}
70
}
else
if
(destination_class ==
"FragmentAggregatorModule"
) {
71
faOutputQDesc = rule->get_descriptor();
72
}
73
}
74
if
(faOutputQDesc ==
nullptr
) {
75
throw
(BadConf(
ERS_HERE
,
"No fragment output queue descriptor given"
));
76
}
77
if
(dlhReqInputQDesc ==
nullptr
) {
78
throw
(BadConf(
ERS_HERE
,
"No DLH request input queue descriptor given"
));
79
}
80
// Process the network rules looking for the Fragment Aggregator and TP handler data reuest inputs
81
const
NetworkConnectionDescriptor
* faNetDesc =
nullptr
;
82
const
NetworkConnectionDescriptor
* tsNetDesc =
nullptr
;
83
for
(
auto
rule :
get_network_rules
()) {
84
auto
endpoint_class = rule->get_endpoint_class();
85
if
(endpoint_class ==
"FragmentAggregatorModule"
) {
86
faNetDesc = rule->get_descriptor();
87
}
else
if
(endpoint_class ==
"FakeDataProdModule"
) {
88
tsNetDesc = rule->get_descriptor();
89
}
90
}
91
if
(faNetDesc ==
nullptr
) {
92
throw
(BadConf(
ERS_HERE
,
"No Fragment output network descriptor given"
));
93
}
94
if
(tsNetDesc ==
nullptr
) {
95
throw
(BadConf(
ERS_HERE
,
"No TimeSync output network descriptor given"
));
96
}
97
98
// Create here the Queue on which all data fragments are forwarded to the fragment aggregator
99
// and a container for the queues of data request to TP handler and DLH
100
101
std::vector<const confmodel::Connection*> faOutputQueues;
102
103
conffwk::ConfigObject
faQueueObj = obj_fac.
create_queue_obj
(faOutputQDesc,
UID
());
104
105
// Create a FakeDataProdModule for each stream of this Readout Group
106
for
(
auto
fdpConf :
get_producers
()) {
107
if
(helper->is_excluded(fdpConf)) {
108
TLOG_DEBUG
(7) <<
"Ignoring excluded FakeDataProdConf "
<< fdpConf->UID();
109
continue
;
110
}
111
112
auto
stream = fdpConf->cast<
appmodel::FakeDataProdConf
>();
113
if
(stream ==
nullptr
) {
114
throw
(BadConf(
ERS_HERE
,
"ReadoutGroup contains something other than FakeDataProdConf"
));
115
}
116
117
auto
id
= stream->
get_source_id
();
118
std::string uid(
"FakeDataProdModule-"
+ std::to_string(
id
));
119
TLOG_DEBUG
(7) <<
"creating OKS configuration object for FakeDataProdModule"
;
120
conffwk::ConfigObject
dlhObj = obj_fac.
create
(
"FakeDataProdModule"
, uid);
121
dlhObj.
set_obj
(
"configuration"
, &stream->config_object());
122
123
// Time Sync network connection
124
auto
tsNetObj = obj_fac.
create_net_obj
(tsNetDesc, std::to_string(
id
));
125
126
dlhObj.
set_objs
(
"outputs"
, { &faQueueObj, &tsNetObj });
127
128
auto
reqQueueObj = obj_fac.
create_queue_sid_obj
(dlhReqInputQDesc,
id
);
129
130
// Add the requessts queue dal pointer to the outputs of the FragmentAggregatorModule
131
faOutputQueues.push_back(
132
obj_fac.
get_dal
<
confmodel::Connection
>(dlhReqInputQDesc->
get_uid_base
() + std::to_string(
id
)));
133
134
dlhObj.
set_objs
(
"inputs"
, { &reqQueueObj });
135
136
modules.push_back(obj_fac.
get_dal
<
FakeDataProdModule
>(uid));
137
}
138
139
// Finally create Fragment Aggregator
140
auto
aggregator_conf =
get_fragment_aggregator
();
141
if
(aggregator_conf == 0) {
142
throw
(BadConf(
ERS_HERE
,
"No FragmentAggregatorModule configuration given"
));
143
}
144
std::string faUid(
"fragmentaggregator-"
+
UID
());
145
TLOG_DEBUG
(7) <<
"creating OKS configuration object for Fragment Aggregator class "
;
146
conffwk::ConfigObject
faObj = obj_fac.
create
(
"FragmentAggregatorModule"
, faUid);
147
148
// Add network connection to TRBs
149
conffwk::ConfigObject
faNetObj = obj_fac.
create_net_obj
(faNetDesc,
UID
());
150
151
// Add output queueus of data requests
152
std::vector<const conffwk::ConfigObject*> qObjs;
153
for
(
auto
q : faOutputQueues) {
154
qObjs.push_back(&q->config_object());
155
}
156
faObj.
set_obj
(
"configuration"
, &aggregator_conf->config_object());
157
faObj.
set_objs
(
"inputs"
, { &faNetObj, &faQueueObj });
158
faObj.
set_objs
(
"outputs"
, qObjs);
159
160
modules.push_back(obj_fac.
get_dal
<
FragmentAggregatorModule
>(faUid));
161
162
obj_fac.
update_modules
(modules);
163
}
164
165
}
// namespace appmodel
166
}
// namespace dunedaq
ConfigObjectFactory.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_queue_obj
conffwk::ConfigObject create_queue_obj(const QueueDescriptor *qdesc, std::string uid="") const
Definition
ConfigObjectFactory.cpp:37
dunedaq::appmodel::ConfigObjectFactory::create
conffwk::ConfigObject create(const std::string &class_name, const std::string &id) const
Definition
ConfigObjectFactory.cpp:28
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_excludable_entities
virtual std::vector< const ExcludableEntity * > contained_excludable_entities() const override
Definition
FakeDataApplication.cpp:45
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: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::UID
const std::string & UID() const noexcept
Definition
DalObject.hpp:119
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
ExcludableEntitySet.hpp
to_resources
std::vector< const dunedaq::confmodel::ExcludableEntity * > to_resources(const std::vector< T * > &vector_of_children)
Definition
ExcludableEntitySet.hpp:108
NetworkConnection.hpp
Service.hpp
kernel.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