60std::vector<const confmodel::Resource*>
62 std::vector<const confmodel::Resource*> resources;
71 std::vector<const confmodel::DaqModule*> modules;
76 auto dlhClass = dlhConf->get_template_for();
81 auto destination_class = rule->get_destination_class();
82 auto data_type = rule->get_descriptor()->get_data_type();
83 if (destination_class ==
"DataHandlerModule" || destination_class == dlhClass) {
84 dlhInputQDesc = rule->get_descriptor();
93 auto endpoint_class = rule->get_endpoint_class();
94 auto data_type = rule->get_descriptor()->get_data_type();
96 if (endpoint_class ==
"DataHandlerModule" || endpoint_class == dlhClass) {
97 if (data_type ==
"TimeSync") {
98 tsNetDesc = rule->get_descriptor();
100 if (data_type ==
"DataRequest") {
101 dlhReqInputNetDesc = rule->get_descriptor();
104 if (data_type ==
"HSIEvent") {
105 hsiNetDesc = rule->get_descriptor();
110 if (ctb_conf ==
nullptr) {
111 throw(BadConf(
ERS_HERE,
"No CTBModule configuration given"));
113 if (dlhInputQDesc ==
nullptr) {
114 throw(BadConf(
ERS_HERE,
"No DLH data input queue descriptor given"));
116 if (dlhReqInputNetDesc ==
nullptr) {
117 throw(BadConf(
ERS_HERE,
"No DLH request input network descriptor given"));
119 if (hsiNetDesc ==
nullptr) {
120 throw(BadConf(
ERS_HERE,
"No HSIEvent output network descriptor given"));
125 std::vector<conffwk::ConfigObject> fragOutObjs;
126 for (
auto [uid, descriptor]:
127 helper->get_netdescriptors(
"Fragment",
"DFApplication")) {
128 fragOutObjs.emplace_back(obj_fac.
create_net_obj(descriptor, uid));
132 std::vector<const conffwk::ConfigObject*> fh_output_objs;
133 for (
auto& fNet : fragOutObjs) {
134 fh_output_objs.push_back(&fNet);
137 std::vector<conffwk::ConfigObject> ctb_module_outputs;
140 for (
const auto & s : sources ) {
141 if (s.second ==
nullptr) {
142 throw(BadConf(
ERS_HERE,
"No SourceIDConf given for " + s.first));
145 auto id = s.second->get_sid();
150 TLOG() <<
"creating OKS configuration object for " + s.first +
" Data Link Handler class " << dlhClass <<
", id " << 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 });
187 ctb_module_outputs.push_back(hsiNetObj);
195 std::vector<const conffwk::ConfigObject*> ctb_module_output_ptrs;
196 for (
const auto & o : ctb_module_outputs ) {
197 ctb_module_output_ptrs.push_back( & o );
200 module_obj.
set_objs(
"outputs", ctb_module_output_ptrs);
202 auto module = obj_fac.get_dal<appmodel::CTBModule>(module_obj.UID());
204 modules.push_back(module);
211std::vector<const confmodel::Resource*>
213 std::vector<const confmodel::Resource*> resources;
217 resources.insert(resources.end(), hlts.begin(), hlts.end());
220 resources.insert(resources.end(), crt_llts.begin(), crt_llts.end());
223 resources.insert(resources.end(), llts.begin(), llts.end());
238 auto & mask = hlt[
"command_mask"];
246 std::list<nlohmann::json> json_hlts;
247 for (
const auto & hlt : hlts ) {
248 json_hlts.push_back(hlt->get_ctb_json(
session));
251 hlt[
"trigger"] = nlohmann::json(json_hlts);
259 auto & subsystems = json[
"subsystems"];
263 auto & beam_block = subsystems[
"beam"] =
get_beam() -> to_json(
false,
true);
264 std::list<nlohmann::json> json_beam_llts;
266 for (
const auto & llt : beam_llts ) {
267 json_beam_llts.push_back(llt->get_ctb_json(
session));
270 beam_block[
"triggers"] = nlohmann::json(json_beam_llts);
274 auto & crt_block = subsystems[
"crt"] =
get_CRT() -> to_json(
false,
true);
275 std::list<nlohmann::json> json_crt_llts;
277 for (
const auto & llt : crt_llts ) {
278 json_crt_llts.push_back(llt->get_ctb_json(
session));
280 crt_block[
"triggers"] = nlohmann::json(json_crt_llts);
284 subsystems[
"pds"] =
get_pds() -> to_json(
false,
true);
304 ret[
"pulser"] =
get_pulser() -> to_json(
false,
true);
305 ret[
"timing"] =
get_timing() -> to_json(
false,
true);
307 static std::string ch_status_flag =
"ch_status";
309 else ret[ch_status_flag] =
false;
311 static std::string standalong_flag =
"standalone_enable";
312 ret[standalong_flag] =
false;
321 auto json =
this ->
to_json(
false,
true);
322 static std::string enable_tag =
"enable";
324 json[enable_tag] =
false;
327 json[enable_tag] =
true;
330 json[
"id"] =
this ->
UID();
348 auto json =
to_json(
false,
true);
350 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.
void generate_modules(std::shared_ptr< appmodel::ConfigurationHelper >) 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.
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 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