DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
appmodel
src
TDECrateApplication.cpp
Go to the documentation of this file.
1
10
#include "
conffwk/Configuration.hpp
"
11
#include "
logging/Logging.hpp
"
12
#include "
oks/kernel.hpp
"
13
14
#include "
appmodel/NWDetDataReceiver.hpp
"
15
#include "
confmodel/DetectorStream.hpp
"
16
#include "
confmodel/DetectorToDaqConnection.hpp
"
17
#include "
confmodel/GeoId.hpp
"
18
#include "
confmodel/NetworkInterface.hpp
"
19
20
#include "
ConfigObjectFactory.hpp
"
21
#include "
appmodel/TDEAMCModule.hpp
"
22
#include "
appmodel/TDEAMCModuleConf.hpp
"
23
#include "
appmodel/TDECrateApplication.hpp
"
24
#include "
appmodel/TdeAmcDetDataSender.hpp
"
25
#include "
appmodel/appmodelIssues.hpp
"
26
27
#include <fmt/core.h>
28
#include <iostream>
29
#include <string>
30
#include <vector>
31
32
namespace
dunedaq
{
33
namespace
appmodel
{
34
35
std::vector<const confmodel::ExcludableEntity*>
36
TDECrateApplication::contained_excludable_entities
()
const
37
{
38
return
to_resources
(
get_detector_connections
());
39
}
40
41
void
42
TDECrateApplication::generate_modules
(std::shared_ptr<appmodel::ConfigurationHelper> helper)
const
43
{
44
ConfigObjectFactory
obj_fac(
this
);
45
46
std::vector<const confmodel::DaqModule*> modules;
47
48
std::map<std::string, std::vector<const appmodel::TdeAmcDetDataSender*>> ctrlhost_sender_map;
49
50
for
(
auto
d2d_conn :
get_detector_connections
()) {
51
// Are we sure?
52
if
(helper->is_excluded(d2d_conn)) {
53
TLOG_DEBUG
(7) <<
"Ignoring excluded DetectorToDaqConnection "
<< d2d_conn->UID();
54
continue
;
55
}
56
57
TLOG_DEBUG
(6) <<
"Processing DetectorToDaqConnection "
<< d2d_conn->UID();
58
// get the readout groups and the interfaces and streams therein; 1 reaout group corresponds to 1 data reader module
59
60
auto
det_senders = d2d_conn->senders();
61
// Should not be necessary, schema doesn't allow 0 senders
62
if
(det_senders.empty()) {
63
throw
(BadConf(
ERS_HERE
,
"DetectorToDaqConnection does not contain senders"
));
64
}
65
66
// Loop over senders
67
for
(
const
auto
* sender : det_senders) {
68
69
if
(helper->is_excluded(sender)) {
70
TLOG
() <<
"Skipping excluded sender: "
<< sender->UID();
71
continue
;
72
}
73
74
// Check the sender type, must me a TdeAmcDetDataSender
75
const
auto
* tde_sender = sender->cast<
appmodel::TdeAmcDetDataSender
>();
76
if
(!tde_sender) {
77
throw
(BadConf(
ERS_HERE
, fmt::format(
"DataSender {} is not a appmodel::TdeAmcDetDataSender"
, sender->UID())));
78
}
79
80
ctrlhost_sender_map[tde_sender->get_control_host()].push_back(tde_sender);
81
}
82
}
83
84
for
(
const
auto
& [ctrlhost, senders] : ctrlhost_sender_map) {
85
86
// std::cout << "this->UID()='" << this->UID() << "' ctrlhost='" << ctrlhost << "'" << std::endl;
87
if
(this->
get_tde_amc_module_conf
()) {
88
conffwk::ConfigObject
tde_obj =
89
obj_fac.
create
(
"TDEAMCModule"
, fmt::format(
"tde-ctrl-{}-{}"
, this->
UID
(), ctrlhost));
90
// std::string tde_uid = fmt::format("tde-ctrl-{}-{}", this->UID(), ctrlhost);
91
// config->create(dbfile, "TDEAMCModule", tde_uid, tde_obj);
92
tde_obj.
set_obj
(
"amc"
, &(senders[0]->
config_object
()));
// for now just allow one AMC per module
93
modules.push_back(obj_fac.
get_dal
<
appmodel::TDEAMCModule
>(tde_obj));
94
}
95
}
96
obj_fac.
update_modules
(modules);
97
}
98
99
}
// namespace appmodel
100
}
// 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::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::TDEAMCModule
Definition
TDEAMCModule.hpp:32
dunedaq::appmodel::TDECrateApplication::contained_excludable_entities
virtual std::vector< const ExcludableEntity * > contained_excludable_entities() const override
Definition
TDECrateApplication.cpp:36
dunedaq::appmodel::TDECrateApplication::get_tde_amc_module_conf
const dunedaq::appmodel::TDEAMCModuleConf * get_tde_amc_module_conf() const
Get "tde_amc_module_conf" relationship value.
Definition
TDECrateApplication.hpp:109
dunedaq::appmodel::TDECrateApplication::generate_modules
void generate_modules(std::shared_ptr< appmodel::ConfigurationHelper >) const override
Definition
TDECrateApplication.cpp:42
dunedaq::appmodel::TDECrateApplication::get_detector_connections
const std::vector< const dunedaq::confmodel::DetectorToDaqConnection * > & get_detector_connections() const
Get "detector_connections" relationship value.
Definition
TDECrateApplication.hpp:134
dunedaq::appmodel::TdeAmcDetDataSender
Definition
TdeAmcDetDataSender.hpp:32
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
NWDetDataReceiver.hpp
TDEAMCModuleConf.hpp
TDEAMCModule.hpp
TDECrateApplication.hpp
TdeAmcDetDataSender.hpp
DetectorStream.hpp
DetectorToDaqConnection.hpp
to_resources
std::vector< const dunedaq::confmodel::ExcludableEntity * > to_resources(const std::vector< T * > &vector_of_children)
Definition
ExcludableEntitySet.hpp:108
GeoId.hpp
NetworkInterface.hpp
kernel.hpp
Logging.hpp
TLOG_DEBUG
#define TLOG_DEBUG(lvl,...)
Definition
Logging.hpp:116
TLOG
#define TLOG(...)
Definition
macro.hpp:21
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