63 std::vector<const confmodel::DaqModule*> modules;
67 std::map<std::string, const DaphneV2BoardConf*> conf_map;
68 auto confs = daphne_conf->get_boards();
69 for (
const auto& c : confs) {
70 conf_map[c->get_key()] = c->get_conf();
74 std::map<std::string, bool> v3_map;
75 std::map<std::string, const confmodel::NetworkInterface*> interfaces;
76 std::map<std::string, std::string> ctrl_hosts;
79 std::map<std::string, std::vector<const appmodel::HermesDataSender*>> hermes_senders;
85 if (helper->is_excluded(d2d_conn)) {
86 TLOG_DEBUG(7) <<
"Ignoring disabled DetectorToDaqConnection " << d2d_conn->UID();
90 TLOG_DEBUG(6) <<
"Processing DetectorToDaqConnection " << d2d_conn->UID();
94 if (d2d_conn->contained_excludable_entities().empty()) {
95 throw(BadConf(
ERS_HERE,
"DetectorToDaqConnection does not contain senders or receivers"));
101 if (!net_conn && !flx_conn) {
102 throw BadConf(
ERS_HERE, d2d_conn->UID() +
" is neither felix or eth connection");
106 auto det_senders = flx_conn->get_felix_senders();
109 for (
const auto* felix_sender : det_senders) {
111 if (helper->is_excluded(felix_sender)) {
112 TLOG() <<
"Skipping disabled sender: " << felix_sender->UID();
116 auto ip = felix_sender->get_control_host();
120 auto streams = felix_sender->get_streams();
122 for (
const auto* det_s : streams) {
124 if (helper->is_excluded(det_s)) {
125 TLOG() <<
"Skipping disabled DetStream: " << det_s->UID();
129 auto geo_id = det_s->get_geo_id();
130 auto id = fmt::format(
"{}.{}.{}", geo_id->get_detector_id(), geo_id->get_crate_id(), geo_id->get_slot_id());
131 if (!v3_map.contains(
id)) {
141 auto det_senders = net_conn->get_net_senders();
143 for (
const auto* nw_sender : det_senders) {
144 if (helper->is_excluded(nw_sender)) {
145 TLOG() <<
"Skipping disabled sender: " << nw_sender->UID();
152 throw(BadConf(
ERS_HERE, fmt::format(
"DataSender {} is not a appmodel::HermesDataSender", nw_sender->UID())));
155 hermes_senders[hrms_sender->get_control_host()].push_back(hrms_sender);
157 auto streams = nw_sender->get_streams();
158 for (
const auto* det_s : streams) {
160 if (helper->is_excluded(det_s)) {
161 TLOG() <<
"Skipping disabled DetStream: " << det_s->UID();
165 auto geo_id = det_s->get_geo_id();
166 auto id = fmt::format(
"{}.{}.{}", geo_id->get_detector_id(), geo_id->get_crate_id(), geo_id->get_slot_id());
167 if (!v3_map.contains(
id)) {
169 interfaces[id] = net_conn->get_net_receiver()->get_uses();
170 ctrl_hosts[id] = hrms_sender->get_control_host();
181 for (
const auto& [
id, v3] : v3_map) {
183 auto conf_it = conf_map.find(
id);
184 if (conf_it == conf_map.end()) {
187 auto conf = conf_it->second;
190 obj_fac.
create((v3 ?
"DaphneV3ControllerModule" :
"DaphneV2ControllerModule"), fmt::format(
"controller-{}",
id));
191 module_obj.
set_obj(
"daphne_conf", &daphne_conf->config_object());
192 module_obj.
set_obj(
"board_conf", &conf->config_object());
194 auto module = obj_fac.get_dal<confmodel::DaqModule>(module_obj);
195 modules.push_back(module);
199 std::string hermes_uid = fmt::format(
"daphne-hermes-ctrl-{}",
id);
203 fmt::format(
"{}://{}:{}",
210 std::vector<const conffwk::ConfigObject*> links_obj;
211 const auto& senders = hermes_senders[ctrl_hosts[id]];
212 for (
const auto* sndr : senders) {
213 links_obj.push_back(&sndr->config_object());
215 hermes_obj.
set_objs(
"links", links_obj);