62std::vector<const confmodel::DaqModule*>
65 std::vector<const confmodel::DaqModule*> modules;
70 auto dlhClass = dlhConf->get_template_for();
75 auto destination_class = rule->get_destination_class();
76 auto data_type = rule->get_descriptor()->get_data_type();
77 if (destination_class ==
"DataHandlerModule" || destination_class == dlhClass) {
78 dlhInputQDesc = rule->get_descriptor();
87 auto endpoint_class = rule->get_endpoint_class();
88 auto data_type = rule->get_descriptor()->get_data_type();
90 if (endpoint_class ==
"DataHandlerModule" || endpoint_class == dlhClass) {
91 if (data_type ==
"TimeSync") {
92 tsNetDesc = rule->get_descriptor();
94 if (data_type ==
"DataRequest") {
95 dlhReqInputNetDesc = rule->get_descriptor();
98 if (data_type ==
"HSIEvent") {
99 hsiNetDesc = rule->get_descriptor();
104 if (ctb_conf ==
nullptr) {
105 throw(BadConf(
ERS_HERE,
"No CTBModule configuration given"));
107 if (dlhInputQDesc ==
nullptr) {
108 throw(BadConf(
ERS_HERE,
"No DLH data input queue descriptor given"));
110 if (dlhReqInputNetDesc ==
nullptr) {
111 throw(BadConf(
ERS_HERE,
"No DLH request input network descriptor given"));
113 if (hsiNetDesc ==
nullptr) {
114 throw(BadConf(
ERS_HERE,
"No HSIEvent output network descriptor given"));
119 auto sessionApps =
session->get_enabled_applications();
120 std::vector<conffwk::ConfigObject> fragOutObjs;
121 for (
auto app : sessionApps) {
123 if (dfapp ==
nullptr)
127 for (
auto rule : dfNRules) {
128 auto descriptor = rule->get_descriptor();
129 auto data_type = descriptor->get_data_type();
130 if (data_type ==
"Fragment") {
131 std::string dreqNetUid(descriptor->get_uid_base() + dfapp->UID());
133 fragOutObjs.push_back(frag_conn);
139 std::vector<const conffwk::ConfigObject*> fh_output_objs;
140 for (
auto& fNet : fragOutObjs) {
141 fh_output_objs.push_back(&fNet);
144 std::vector<conffwk::ConfigObject> ctb_module_outputs;
147 for (
const auto & s : sources ) {
148 if (s.second ==
nullptr) {
149 throw(BadConf(
ERS_HERE,
"No SourceIDConf given for " + s.first));
152 auto id = s.second->get_sid();
157 TLOG() <<
"creating OKS configuration object for " + s.first +
" Data Link Handler class " << dlhClass <<
", id " << id;
158 std::string uid(
"DLH-" + s.first);
161 dlhObj.
set_by_val<uint32_t>(
"detector_id", det_id);
162 dlhObj.
set_by_val<
bool>(
"post_processing_enabled",
false);
163 dlhObj.
set_obj(
"module_configuration", &dlhConf->config_object());
165 auto net_objc(fh_output_objs);
168 if (dlhConf->get_generate_timesync()) {
169 std::string tsStreamUid = tsNetDesc->
get_uid_base() + std::to_string(
id);
171 net_objc.push_back(&tsNetObj);
174 dlhObj.
set_objs(
"outputs", net_objc);
177 std::string dataQueueUid(dlhInputQDesc->
get_uid_base() + s.first);
179 queueObj.
rename(dataQueueUid);
181 ctb_module_outputs.push_back(queueObj);
184 std::string faNetUid = dlhReqInputNetDesc->
get_uid_base() +
UID() +
'_' + s.first;
187 dlhObj.
set_objs(
"inputs", { &queueObj, &faNetObj });
195 ctb_module_outputs.push_back(hsiNetObj);
203 std::vector<const conffwk::ConfigObject*> ctb_module_output_ptrs;
204 for (
const auto & o : ctb_module_outputs ) {
205 ctb_module_output_ptrs.push_back( & o );
208 module_obj.
set_objs(
"outputs", ctb_module_output_ptrs);
210 auto module = obj_fac.get_dal<appmodel::CTBModule>(module_obj.UID());
212 modules.push_back(module);
221 for (
auto & t : vec) {
222 auto misc = t->cast<
CTBMisc>();
228 throw BadConf(
ERS_HERE,
"Missing Misc");
235 std::vector<const CTBHLT*> ret;
239 for (
auto & t : vec ) {
240 auto hlt = t->cast<
CTBHLT>();
252 std::vector<const CTBCountLLT*> ret;
256 for (
auto & t : vec ) {
269 std::vector<const CTBLLT*> ret;
273 for (
auto & t : vec ) {
274 auto llt = t->cast<
CTBLLT>();
276 if ( (!count_llt) && (llt) ) {
294 auto & mask = hlt[
"command_mask"];
302 std::list<nlohmann::json> json_hlts;
303 for (
const auto & hlt : hlts ) {
304 json_hlts.push_back(hlt->get_ctb_json(
session));
307 hlt[
"trigger"] = nlohmann::json(json_hlts);
315 auto & subsystems = json[
"subsystems"];
319 auto & beam_block = subsystems[
"beam"] =
get_beam() -> to_json(
false,
true);
320 std::list<nlohmann::json> json_beam_llts;
322 for (
const auto & llt : beam_llts ) {
323 json_beam_llts.push_back(llt->get_ctb_json(
session));
326 beam_block[
"triggers"] = nlohmann::json(json_beam_llts);
330 auto & crt_block = subsystems[
"crt"] =
get_CRT() -> to_json(
false,
true);
331 std::list<nlohmann::json> json_crt_llts;
333 for (
const auto & llt : crt_llts ) {
334 json_crt_llts.push_back(llt->get_ctb_json(
session));
336 crt_block[
"triggers"] = nlohmann::json(json_crt_llts);
340 subsystems[
"pds"] =
get_pds() -> to_json(
false,
true);
353 for (
auto & t : vec) {
354 if ( t->UID().find(
"HLT") != std::string::npos ) {
360 throw BadConf(
ERS_HERE,
"Missing HLT_0");
366 for (
auto & t : vec) {
367 if ( t->UID().find(
"LLT") != std::string::npos ) {
373 throw BadConf(
ERS_HERE,
"Missing LLT_0");
384 ret[
"pulser"] =
get_pulser() -> to_json(
false,
true);
385 ret[
"timing"] =
get_timing() -> to_json(
false,
true);
387 static std::string ch_status_flag =
"ch_status";
389 else ret[ch_status_flag] =
false;
391 static std::string standalong_flag =
"standalone_enable";
392 ret[standalong_flag] =
false;
401 auto json =
this ->
to_json(
false,
true);
402 static std::string enable_tag =
"enable";
404 json[enable_tag] =
false;
407 json[enable_tag] =
true;
410 json[
"id"] =
this ->
UID();
428 auto json =
to_json(
false,
true);
430 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
const CTBRandomTrigger & get_randomtrigger_1() const
const CTBRandomTrigger & get_randomtrigger_2() const
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::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
std::vector< const CTBLLT * > get_beam_LLTs() const
nlohmann::json get_ctb_json(const dunedaq::confmodel::Session &session, std::optional< std::string > socket_host=std::nullopt) const
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.
std::vector< const CTBCountLLT * > get_CRT_LLTs() const
std::vector< const CTBHLT * > get_HLTs() const
const dunedaq::appmodel::CTBPDSSubsystem * get_pds() const
Get "pds" relationship value.
const CTBMisc & get_misc() const
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 TARGET * cast() const noexcept
Casts object to different class.
const ConfigObject & config_object() const
const std::string & UID() const noexcept
bool disabled(const dunedaq::confmodel::Session &session) const
nlohmann::json to_json(bool direct=false, bool skip_name=false) const
const std::vector< const dunedaq::confmodel::ResourceBase * > & get_contains() const
Get "contains" relationship value. A resource set is a container of resources to easily implement gro...