59std::vector<const confmodel::ExcludableEntity*>
62 std::vector<const confmodel::ExcludableEntity*> resources;
70 std::vector<const confmodel::DaqModule*> modules;
75 auto dlhClass = dlhConf->get_template_for();
80 auto destination_class = rule->get_destination_class();
81 auto data_type = rule->get_descriptor()->get_data_type();
82 if (destination_class ==
"DataHandlerModule" || destination_class == dlhClass) {
83 dlhInputQDesc = rule->get_descriptor();
92 auto endpoint_class = rule->get_endpoint_class();
93 auto data_type = rule->get_descriptor()->get_data_type();
95 if (endpoint_class ==
"DataHandlerModule" || endpoint_class == dlhClass) {
96 if (data_type ==
"TimeSync") {
97 tsNetDesc = rule->get_descriptor();
99 if (data_type ==
"DataRequest") {
100 dlhReqInputNetDesc = rule->get_descriptor();
103 if (data_type ==
"HSIEvent") {
104 hsiNetDesc = rule->get_descriptor();
109 if (ctb_conf ==
nullptr) {
110 throw(BadConf(
ERS_HERE,
"No CTBModule configuration given"));
112 if (dlhInputQDesc ==
nullptr) {
113 throw(BadConf(
ERS_HERE,
"No DLH data input queue descriptor given"));
115 if (dlhReqInputNetDesc ==
nullptr) {
116 throw(BadConf(
ERS_HERE,
"No DLH request input network descriptor given"));
118 if (hsiNetDesc ==
nullptr) {
119 throw(BadConf(
ERS_HERE,
"No HSIEvent output network descriptor given"));
124 std::vector<conffwk::ConfigObject> fragOutObjs;
125 for (
auto [uid,
descriptor] : helper->get_netdescriptors(
"Fragment",
"DFApplication")) {
130 std::vector<const conffwk::ConfigObject*> fh_output_objs;
131 for (
auto& fNet : fragOutObjs) {
132 fh_output_objs.push_back(&fNet);
135 std::vector<conffwk::ConfigObject> ctb_module_outputs;
138 for (
const auto& s : sources) {
139 if (s.second ==
nullptr) {
140 throw(BadConf(
ERS_HERE,
"No SourceIDConf given for " + s.first));
143 auto id = s.second->get_sid();
149 TLOG() <<
"creating OKS configuration object for " + s.first +
" Data Link Handler class " << dlhClass <<
", id "
151 std::string uid(
"DLH-" + s.first);
154 dlhObj.
set_by_val<uint32_t>(
"detector_id", det_id);
155 dlhObj.
set_by_val<
bool>(
"post_processing_enabled",
false);
156 dlhObj.
set_obj(
"module_configuration", &dlhConf->config_object());
158 auto net_objc(fh_output_objs);
161 if (dlhConf->get_generate_timesync()) {
162 std::string tsStreamUid = tsNetDesc->
get_uid_base() + std::to_string(
id);
164 net_objc.push_back(&tsNetObj);
167 dlhObj.
set_objs(
"outputs", net_objc);
170 std::string dataQueueUid(dlhInputQDesc->
get_uid_base() + s.first);
172 queueObj.
rename(dataQueueUid);
174 ctb_module_outputs.push_back(queueObj);
179 dlhObj.
set_objs(
"inputs", { &queueObj, &faNetObj });
186 ctb_module_outputs.push_back(hsiNetObj);
191 module_obj.
set_obj(
"configuration", &ctb_conf->config_object());
192 module_obj.
set_obj(
"board", &board->config_object());
194 std::vector<const conffwk::ConfigObject*> ctb_module_output_ptrs;
195 for (
const auto& o : ctb_module_outputs) {
196 ctb_module_output_ptrs.push_back(&o);
199 module_obj.
set_objs(
"outputs", ctb_module_output_ptrs);
201 auto module = obj_fac.get_dal<appmodel::CTBModule>(module_obj.UID());
203 modules.push_back(module);
208std::vector<const confmodel::ExcludableEntity*>
211 std::vector<const confmodel::ExcludableEntity*> resources;
215 resources.insert(resources.end(), hlts.begin(), hlts.end());
218 resources.insert(resources.end(), crt_llts.begin(), crt_llts.end());
221 resources.insert(resources.end(), llts.begin(), llts.end());
237 auto& mask = hlt[
"command_mask"];
245 std::list<nlohmann::json> json_hlts;
246 for (
const auto& hlt : hlts) {
247 json_hlts.push_back(hlt->get_ctb_json(
session));
250 hlt[
"trigger"] = nlohmann::json(json_hlts);
258 auto& subsystems = json[
"subsystems"];
262 auto& beam_block = subsystems[
"beam"] =
get_beam()->
to_json(
false,
true);
263 std::list<nlohmann::json> json_beam_llts;
265 for (
const auto& llt : beam_llts) {
266 json_beam_llts.push_back(llt->get_ctb_json(
session));
269 beam_block[
"triggers"] = nlohmann::json(json_beam_llts);
273 auto& crt_block = subsystems[
"crt"] =
get_CRT()->
to_json(
false,
true);
274 std::list<nlohmann::json> json_crt_llts;
276 for (
const auto& llt : crt_llts) {
277 json_crt_llts.push_back(llt->get_ctb_json(
session));
279 crt_block[
"triggers"] = nlohmann::json(json_crt_llts);
291std::vector<const confmodel::ExcludableEntity*>
307 static std::string ch_status_flag =
"ch_status";
309 ret[ch_status_flag] =
true;
311 ret[ch_status_flag] =
false;
313 static std::string standalong_flag =
"standalone_enable";
314 ret[standalong_flag] =
false;
323 auto json = this->
to_json(
false,
true);
324 static std::string enable_tag =
"enable";
326 json[enable_tag] =
false;
328 json[enable_tag] =
true;
331 json[
"id"] = this->
UID();
351 auto json =
to_json(
false,
true);
353 json[
"host"] = socket_host.value();
virtual std::vector< const ExcludableEntity * > contained_excludable_entities() const override
const dunedaq::appmodel::CTBConf * get_generator() const
Get "generator" relationship value.
std::vector< std::pair< std::string, const appmodel::SourceIDConf * > > get_sources() const
const dunedaq::appmodel::CTBoardConf * get_board() const
Get "board" relationship value.
const dunedaq::appmodel::DataHandlerConf * get_link_handler() const
Get "link_handler" relationship value.
void generate_modules(std::shared_ptr< appmodel::ConfigurationHelper >) const override
nlohmann::json get_ctb_json(const dunedaq::confmodel::Session &session) const
virtual std::vector< const ExcludableEntity * > contained_excludable_entities() const override
const dunedaq::appmodel::CTBTiming * get_timing() const
Get "timing" relationship value.
bool get_ch_status() const
Get "ch_status" attribute value.
const dunedaq::appmodel::CTBRandomTrigger * get_randomtrigger_2() const
Get "randomtrigger_2" relationship value.
const dunedaq::appmodel::CTBRandomTrigger * get_randomtrigger_1() const
Get "randomtrigger_1" relationship value.
const dunedaq::appmodel::CTBPulser * get_pulser() const
Get "pulser" relationship value.
nlohmann::json get_ctb_json(std::optional< std::string > socket_host=std::nullopt) const
const dunedaq::appmodel::CTBReceiverSocket * get_receiver() const
Get "receiver" relationship value.
const dunedaq::appmodel::CTBStatisticsSocket * get_statistics() const
Get "statistics" relationship value.
const dunedaq::appmodel::CTBMonitorSocket * get_monitor() const
Get "monitor" relationship value.
nlohmann::json get_ctb_json(std::optional< std::string > socket_host=std::nullopt) const
nlohmann::json get_ctb_json(const dunedaq::confmodel::Session &session) const
nlohmann::json get_ctb_json(const dunedaq::confmodel::Session &session, std::optional< std::string > socket_host=std::nullopt) const
const dunedaq::appmodel::CTBMisc * get_misc() const
Get "misc" relationship value.
const std::vector< const dunedaq::appmodel::CTBHLT * > & get_HLTs() const
Get "HLTs" relationship value.
const dunedaq::appmodel::CTBSubsystem * get_beam() const
Get "beam" relationship value.
const dunedaq::appmodel::CTBCRTSubsystem * get_CRT() const
Get "CRT" relationship value.
const dunedaq::appmodel::CTBSockets * get_sockets() const
Get "sockets" relationship value.
virtual std::vector< const ExcludableEntity * > contained_excludable_entities() const override
const dunedaq::appmodel::CTBPDSSubsystem * get_pds() const
Get "pds" relationship value.
const std::vector< const dunedaq::appmodel::CTBCountLLT * > & get_CRT_LLTs() const
Get "CRT_LLTs" relationship value.
const std::vector< const dunedaq::appmodel::CTBLLT * > & get_beam_LLTs() const
Get "beam_LLTs" relationship value.
void update_modules(const std::vector< const confmodel::DaqModule * > &modules)
conffwk::ConfigObject create_queue_sid_obj(const QueueDescriptor *qdesc, uint32_t src_id) const
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
const std::string & get_uid_base() const
Get "uid_base" attribute value. Base for UID string. To be combined with a source id.
const std::string & get_uid_base() const
Get "uid_base" attribute value. Base for UID string. May be combined with a source id.
const std::vector< const dunedaq::appmodel::NetworkConnectionRule * > & get_network_rules() const
Get "network_rules" relationship value.
const std::vector< const dunedaq::appmodel::QueueConnectionRule * > & get_queue_rules() const
Get "queue_rules" relationship value.
void set_by_val(const std::string &name, T value)
Set attribute value.
void set_objs(const std::string &name, const std::vector< const ConfigObject * > &o, bool skip_non_null_check=false)
Set relationship multi-value.
void set_obj(const std::string &name, const ConfigObject *o, bool skip_non_null_check=false)
Set relationship single-value.
void rename(const std::string &new_id)
Rename object.
const std::string & UID() const noexcept
bool is_excluded(const dunedaq::confmodel::ExcludableEntityTree &session) const
nlohmann::json to_json(bool direct=false, bool skip_name=false) const
CIB Buffer std::string descriptor Message from std::string descriptor CIB process std::string descriptor descriptor