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