DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
DFOApplication.cpp
Go to the documentation of this file.
1
15#include "appmodel/DFOConf.hpp"
25#include "confmodel/Service.hpp"
26#include "logging/Logging.hpp"
27#include "oks/kernel.hpp"
28
29#include <string>
30#include <vector>
31
32namespace dunedaq {
33namespace appmodel {
34
35std::vector<const confmodel::DaqModule*>
37{
38 std::vector<const confmodel::DaqModule*> modules;
39
40 ConfigObjectFactory obj_fac(this);
41
42
43 std::string dfoUid("DFO-" + UID());
44 TLOG_DEBUG(7) << "creating OKS configuration object for DFOModule class ";
45 auto dfoObj = obj_fac.create("DFOModule", dfoUid);
46
47 auto dfoConf = get_dfo();
48 dfoObj.set_obj("configuration", &dfoConf->config_object());
49
50 if (dfoConf == 0) {
51 throw(BadConf(ERS_HERE, "No DFOConf configuration given"));
52 }
53
54 std::vector<const conffwk::ConfigObject*> output_conns;
55 std::vector<const conffwk::ConfigObject*> input_conns;
57 conffwk::ConfigObject busyOutObj;
58 conffwk::ConfigObject tokenInObj;
59
60 for (auto rule : get_network_rules()) {
61 auto endpoint_class = rule->get_endpoint_class();
62 auto descriptor = rule->get_descriptor();
63
64 auto connObj = obj_fac.create_net_obj(descriptor, "");
65
66 if (descriptor->get_data_type() == "TriggerDecision") {
67 if (endpoint_class == "DFOModule") {
68 tdInObj = connObj;
69 input_conns.push_back(&tdInObj);
70 }
71 } else if (descriptor->get_data_type() == "TriggerDecisionToken") {
72 tokenInObj = connObj;
73 input_conns.push_back(&tokenInObj);
74 }
75
76 else if (descriptor->get_data_type() == "TriggerInhibit") {
77 busyOutObj = connObj;
78 output_conns.push_back(&busyOutObj);
79 }
80 }
81
82 if (tdInObj == nullptr) {
83 throw(BadConf(ERS_HERE, "No TriggerDecision input connection descriptor given"));
84 }
85 if (busyOutObj == nullptr) {
86 throw(BadConf(ERS_HERE, "No TriggerInhibit output connection descriptor given"));
87 }
88 if (tokenInObj == nullptr) {
89 throw(BadConf(ERS_HERE, "No TriggerDecisionToken input connection descriptor given"));
90 }
91
92 // Process special Network rules!
93 // Looking for DataRequest rules from ReadoutAppplications in current Session
94 auto sessionApps = session->get_enabled_applications();
95 std::vector<conffwk::ConfigObject> tdOutObjs;
96 for (auto app : sessionApps) {
97 auto dfapp = app->cast<appmodel::DFApplication>();
98 if (dfapp == nullptr)
99 continue;
100
101 auto dfNRules = dfapp->get_network_rules();
102 for (auto rule : dfNRules) {
103 auto descriptor = rule->get_descriptor();
104 auto data_type = descriptor->get_data_type();
105 if (data_type == "TriggerDecision") {
106 tdOutObjs.emplace_back(obj_fac.create_net_obj(descriptor, dfapp->UID()));
107 } // If network rule has TriggerDecision type of data
108 } // Loop over Apps network rules
109 } // loop over Session specific Apps
110
111 for (auto& tdOut : tdOutObjs) {
112 output_conns.push_back(&tdOut);
113 }
114
115 dfoObj.set_objs("inputs", input_conns);
116 dfoObj.set_objs("outputs", output_conns);
117
118 // Add to our list of modules to return
119 modules.push_back(obj_fac.get_dal<DFOModule>(dfoUid));
120
121 return modules;
122}
123
124} // namespace appmodel
125} // namespace dunedaq
#define ERS_HERE
conffwk::ConfigObject create_net_obj(const NetworkConnectionDescriptor *ndesc, std::string uid) const
Helper function that gets a network connection config.
const T * get_dal(std::string uid) const
conffwk::ConfigObject create(const std::string &class_name, const std::string &id) const
std::vector< const dunedaq::confmodel::DaqModule * > generate_modules(const confmodel::Session *) const override
const dunedaq::appmodel::DFOConf * get_dfo() const
Get "dfo" relationship value.
const std::vector< const dunedaq::appmodel::NetworkConnectionRule * > & get_network_rules() const
Get "network_rules" relationship value.
const std::string & UID() const noexcept
conffwk entry point
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112
Including Qt Headers.