61std::vector<const confmodel::Resource*>
63 std::vector<const confmodel::Resource*> resources;
69std::vector<const confmodel::DaqModule*>
72 std::vector<const confmodel::DaqModule*> modules;
77 auto dlhClass = dlhConf->get_template_for();
82 auto destination_class = rule->get_destination_class();
83 auto data_type = rule->get_descriptor()->get_data_type();
84 if (destination_class ==
"DataHandlerModule" || destination_class == dlhClass) {
85 dlhInputQDesc = rule->get_descriptor();
94 auto endpoint_class = rule->get_endpoint_class();
95 auto data_type = rule->get_descriptor()->get_data_type();
97 if (endpoint_class ==
"DataHandlerModule" || endpoint_class == dlhClass) {
98 if (data_type ==
"TimeSync") {
99 tsNetDesc = rule->get_descriptor();
101 if (data_type ==
"DataRequest") {
102 dlhReqInputNetDesc = rule->get_descriptor();
105 if (data_type ==
"HSIEvent") {
106 hsiNetDesc = rule->get_descriptor();
111 if (ctb_conf ==
nullptr) {
112 throw(BadConf(
ERS_HERE,
"No CTBModule configuration given"));
114 if (dlhInputQDesc ==
nullptr) {
115 throw(BadConf(
ERS_HERE,
"No DLH data input queue descriptor given"));
117 if (dlhReqInputNetDesc ==
nullptr) {
118 throw(BadConf(
ERS_HERE,
"No DLH request input network descriptor given"));
120 if (hsiNetDesc ==
nullptr) {
121 throw(BadConf(
ERS_HERE,
"No HSIEvent output network descriptor given"));
126 auto sessionApps =
session->enabled_applications();
127 std::vector<conffwk::ConfigObject> fragOutObjs;
128 for (
auto app : sessionApps) {
130 if (dfapp ==
nullptr)
134 for (
auto rule : dfNRules) {
135 auto descriptor = rule->get_descriptor();
136 auto data_type = descriptor->get_data_type();
137 if (data_type ==
"Fragment") {
138 std::string dreqNetUid(descriptor->get_uid_base() + dfapp->UID());
140 fragOutObjs.push_back(frag_conn);
146 std::vector<const conffwk::ConfigObject*> fh_output_objs;
147 for (
auto& fNet : fragOutObjs) {
148 fh_output_objs.push_back(&fNet);
151 std::vector<conffwk::ConfigObject> ctb_module_outputs;
154 for (
const auto & s : sources ) {
155 if (s.second ==
nullptr) {
156 throw(BadConf(
ERS_HERE,
"No SourceIDConf given for " + s.first));
159 auto id = s.second->get_sid();
164 TLOG() <<
"creating OKS configuration object for " + s.first +
" Data Link Handler class " << dlhClass <<
", id " << id;
165 std::string uid(
"DLH-" + s.first);
168 dlhObj.
set_by_val<uint32_t>(
"detector_id", det_id);
169 dlhObj.
set_by_val<
bool>(
"post_processing_enabled",
false);
170 dlhObj.
set_obj(
"module_configuration", &dlhConf->config_object());
172 auto net_objc(fh_output_objs);
175 if (dlhConf->get_generate_timesync()) {
176 std::string tsStreamUid = tsNetDesc->
get_uid_base() + std::to_string(
id);
178 net_objc.push_back(&tsNetObj);
181 dlhObj.
set_objs(
"outputs", net_objc);
184 std::string dataQueueUid(dlhInputQDesc->
get_uid_base() + s.first);
186 queueObj.
rename(dataQueueUid);
188 ctb_module_outputs.push_back(queueObj);
191 std::string faNetUid = dlhReqInputNetDesc->
get_uid_base() +
UID() +
'_' + s.first;
194 dlhObj.
set_objs(
"inputs", { &queueObj, &faNetObj });
202 ctb_module_outputs.push_back(hsiNetObj);
210 std::vector<const conffwk::ConfigObject*> ctb_module_output_ptrs;
211 for (
const auto & o : ctb_module_outputs ) {
212 ctb_module_output_ptrs.push_back( & o );
215 module_obj.
set_objs(
"outputs", ctb_module_output_ptrs);
217 auto module = obj_fac.get_dal<appmodel::CTBModule>(module_obj.UID());
219 modules.push_back(module);
226std::vector<const confmodel::Resource*>
228 std::vector<const confmodel::Resource*> resources;
232 resources.insert(resources.end(), hlts.begin(), hlts.end());
235 resources.insert(resources.end(), crt_llts.begin(), crt_llts.end());
238 resources.insert(resources.end(), llts.begin(), llts.end());
253 auto & mask = hlt[
"command_mask"];
261 std::list<nlohmann::json> json_hlts;
262 for (
const auto & hlt : hlts ) {
263 json_hlts.push_back(hlt->get_ctb_json(
session));
266 hlt[
"trigger"] = nlohmann::json(json_hlts);
274 auto & subsystems = json[
"subsystems"];
278 auto & beam_block = subsystems[
"beam"] =
get_beam() -> to_json(
false,
true);
279 std::list<nlohmann::json> json_beam_llts;
281 for (
const auto & llt : beam_llts ) {
282 json_beam_llts.push_back(llt->get_ctb_json(
session));
285 beam_block[
"triggers"] = nlohmann::json(json_beam_llts);
289 auto & crt_block = subsystems[
"crt"] =
get_CRT() -> to_json(
false,
true);
290 std::list<nlohmann::json> json_crt_llts;
292 for (
const auto & llt : crt_llts ) {
293 json_crt_llts.push_back(llt->get_ctb_json(
session));
295 crt_block[
"triggers"] = nlohmann::json(json_crt_llts);
299 subsystems[
"pds"] =
get_pds() -> to_json(
false,
true);
319 ret[
"pulser"] =
get_pulser() -> to_json(
false,
true);
320 ret[
"timing"] =
get_timing() -> to_json(
false,
true);
322 static std::string ch_status_flag =
"ch_status";
324 else ret[ch_status_flag] =
false;
326 static std::string standalong_flag =
"standalone_enable";
327 ret[standalong_flag] =
false;
336 auto json =
this ->
to_json(
false,
true);
337 static std::string enable_tag =
"enable";
339 json[enable_tag] =
false;
342 json[enable_tag] =
true;
345 json[
"id"] =
this ->
UID();
363 auto json =
to_json(
false,
true);
365 json[
"host"] = socket_host.value();
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.
std::vector< const dunedaq::confmodel::DaqModule * > generate_modules(const confmodel::Session *) const override
virtual std::vector< const Resource * > contained_resources() const override
virtual std::vector< const Resource * > contained_resources() const override
nlohmann::json get_ctb_json(const dunedaq::confmodel::Session &session) const
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 Resource * > contained_resources() 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.
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 ConfigObject & config_object() const
const std::string & UID() const noexcept
nlohmann::json to_json(bool direct=false, bool skip_name=false) const
bool is_disabled(const dunedaq::confmodel::ResourceTree &session) const