1 #include <fhiclcpp/ParameterSet.h>
2 #include <fhiclcpp/detail/print_mode.h>
3 #include <fhiclcpp/intermediate_table.h>
4 #include <fhiclcpp/make_ParameterSet.h>
5 #include <fhiclcpp/parse.h>
7 #include "otsdaq/TablePlugins/ARTDAQTableBase/ARTDAQTableBase.h"
13 #include "otsdaq/ProgressBar/ProgressBar.h"
19 #define ARTDAQ_FCL_PATH std::string(__ENV__("USER_DATA")) + "/" + "ARTDAQConfigurations/"
24 const std::string ARTDAQTableBase::ARTDAQ_SUPERVISOR_TABLE =
"ARTDAQSupervisorTable";
25 const int ARTDAQTableBase::NULL_SUBSYSTEM_DESTINATION = 0;
33 ARTDAQTableBase::ARTDAQTableBase(std::string tableName,
34 std::string* accumulatedExceptions )
35 :
TableBase(tableName, accumulatedExceptions)
38 mkdir((ARTDAQ_FCL_PATH).c_str(), 0755);
44 ARTDAQTableBase::ARTDAQTableBase(
void) :
TableBase(
"ARTDAQTableBase")
46 __SS__ <<
"Should not call void constructor, table type is lost!" << __E__;
51 ARTDAQTableBase::~ARTDAQTableBase(
void) {}
54 const std::string& ARTDAQTableBase::getTypeString(ARTDAQTableBase::ARTDAQAppType type)
58 case ARTDAQTableBase::ARTDAQAppType::EventBuilder:
59 return processTypes_.BUILDER;
60 case ARTDAQTableBase::ARTDAQAppType::DataLogger:
61 return processTypes_.LOGGER;
62 case ARTDAQTableBase::ARTDAQAppType::Dispatcher:
63 return processTypes_.DISPATCHER;
64 case ARTDAQTableBase::ARTDAQAppType::BoardReader:
65 return processTypes_.READER;
68 __SS__ <<
"Illegal translation attempt for type '" << (
unsigned int)type <<
"'"
74 std::string ARTDAQTableBase::getFHICLFilename(ARTDAQTableBase::ARTDAQAppType type,
75 const std::string& name)
77 __COUT__ <<
"Type: " << ARTDAQTableBase::getTypeString(type) <<
" Name: " << name
79 std::string filename = ARTDAQ_FCL_PATH + ARTDAQTableBase::getTypeString(type) +
"-";
80 std::string uid = name;
81 for(
unsigned int i = 0; i < uid.size(); ++i)
82 if((uid[i] >=
'a' && uid[i] <=
'z') || (uid[i] >=
'A' && uid[i] <=
'Z') ||
83 (uid[i] >=
'0' && uid[i] <=
'9'))
88 __COUT__ <<
"fcl: " << filename << __E__;
94 std::string ARTDAQTableBase::getFlatFHICLFilename(ARTDAQTableBase::ARTDAQAppType type,
95 const std::string& name)
97 __COUT__ <<
"Type: " << ARTDAQTableBase::getTypeString(type) <<
" Name: " << name
99 std::string filename = ARTDAQ_FCL_PATH + ARTDAQTableBase::getTypeString(type) +
"-";
100 std::string uid = name;
101 for(
unsigned int i = 0; i < uid.size(); ++i)
102 if((uid[i] >=
'a' && uid[i] <=
'z') || (uid[i] >=
'A' && uid[i] <=
'Z') ||
103 (uid[i] >=
'0' && uid[i] <=
'9'))
106 filename +=
"_flattened.fcl";
108 __COUT__ <<
"fcl: " << filename << __E__;
114 void ARTDAQTableBase::flattenFHICL(ARTDAQTableBase::ARTDAQAppType type,
115 const std::string& name)
117 __COUT__ <<
"flattenFHICL()" << __E__;
118 std::string inFile = getFHICLFilename(type, name);
119 std::string outFile = getFlatFHICLFilename(type, name);
121 __COUTV__(__ENV__(
"FHICL_FILE_PATH"));
123 cet::filepath_lookup_nonabsolute policy(
"FHICL_FILE_PATH");
125 fhicl::ParameterSet pset;
129 fhicl::intermediate_table tbl;
130 fhicl::parse_document(inFile, policy, tbl);
131 fhicl::ParameterSet pset;
132 fhicl::make_ParameterSet(tbl, pset);
134 std::ofstream ofs{outFile};
135 ofs << pset.to_indented_string(0, fhicl::detail::print_mode::annotated);
137 catch(cet::exception
const& e)
139 __SS__ <<
"Failed to parse fhicl: " << e.what() << __E__;
151 void ARTDAQTableBase::insertParameters(std::ostream& out,
153 std::string& commentStr,
155 const std::string& parameterPreamble,
156 bool onlyInsertAtTableParameters ,
157 bool includeAtTableParameters )
160 if(!parameterGroupLink.isDisconnected())
163 auto otherParameters = parameterGroupLink.getChildren();
167 for(
auto& parameter : otherParameters)
169 key = parameter.second.getNode(parameterPreamble +
"Key").getValue();
173 if(key.find(
"@table::") != std::string::npos)
176 if(onlyInsertAtTableParameters || includeAtTableParameters)
178 if(!parameter.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
185 OUT << parameter.second.getNode(parameterPreamble +
"Value")
189 if(!parameter.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
199 if(onlyInsertAtTableParameters)
202 if(!parameter.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
209 if(key.find(
"#include") == std::string::npos)
211 OUT << parameter.second.getNode(parameterPreamble +
"Value").getValue()
214 if(!parameter.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
227 std::string ARTDAQTableBase::insertModuleType(std::ostream& out,
229 std::string& commentStr,
232 std::string value = moduleTypeNode.getValue();
235 if(value.find(
"@table::") == std::string::npos)
236 out <<
"module_type: ";
237 out << value <<
"\n";
243 void ARTDAQTableBase::outputReaderFHICL(
246 const std::string& selfHost,
249 size_t maxFragmentSizeBytes)
376 std::string filename = ARTDAQTableBase::getFHICLFilename(
377 ARTDAQTableBase::ARTDAQAppType::BoardReader, boardReaderNode.getValue());
383 std::string tabStr =
"";
384 std::string commentStr =
"";
386 out.open(filename, std::fstream::out | std::fstream::trunc);
389 __SS__ <<
"Failed to open ARTDAQ Builder fcl file: " << filename << __E__;
395 OUT <<
"###########################################################" << __E__;
397 OUT <<
"# artdaq reader fcl configuration file produced by otsdaq." << __E__;
398 OUT <<
"# Creation timestamp: " << StringMacros::getTimestampString() << __E__;
399 OUT <<
"# Original filename: " << filename << __E__;
400 OUT <<
"# otsdaq-ARTDAQ Reader UID: " << boardReaderNode.getValue() << __E__;
402 OUT <<
"###########################################################" << __E__;
408 if(boardReaderNode.isDisconnected())
416 catch(
const std::runtime_error&)
418 __COUT__ <<
"Ignoring error, assume this a valid UID node." << __E__;
429 OUT <<
"fragment_receiver: {\n";
432 OUT <<
"max_fragment_size_bytes: " << maxFragmentSizeBytes <<
"\n";
436 <<
": " << boardReaderNode.getNode(
"daqGeneratorPluginType").getValue()
437 << (
"\t #daq generator plug-in type") <<
"\n";
438 OUT <<
"fragment_type"
439 <<
": " << boardReaderNode.getNode(
"daqGeneratorFragmentType").getValue()
440 << (
"\t #generator data fragment type") <<
"\n\n";
443 auto parametersLink = boardReaderNode.getNode(
"daqParametersLink");
444 if(!parametersLink.isDisconnected())
446 auto parameters = parametersLink.getChildren();
447 for(
auto& parameter : parameters)
449 if(!parameter.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
461 parameter.second.getNode(TableViewColumnInfo::COL_NAME_COMMENT);
462 OUT << parameter.second.getNode(
"daqParameterKey").getValue() <<
": "
463 << parameter.second.getNode(
"daqParameterValue").getValue()
464 << (comment.isDefaultValue() ?
"" : (
"\t # " + comment.getValue()))
467 if(!parameter.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
475 OUT <<
"destinations: {\n";
482 OUT <<
"metrics: {\n";
485 auto metricsGroup = boardReaderNode.getNode(
"daqMetricsLink");
486 if(!metricsGroup.isDisconnected())
488 auto metrics = metricsGroup.getChildren();
490 for(
auto& metric : metrics)
492 if(!metric.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
496 OUT << metric.second.getNode(
"metricKey").getValue() <<
": {\n";
499 OUT <<
"metricPluginType: "
500 << metric.second.getNode(
"metricPluginType").getValue() <<
"\n";
501 OUT <<
"level: " << metric.second.getNode(
"metricLevel").getValue() <<
"\n";
503 auto metricParametersGroup = metric.second.getNode(
"metricParametersLink");
504 if(!metricParametersGroup.isDisconnected())
506 auto metricParameters = metricParametersGroup.getChildren();
507 for(
auto& metricParameter : metricParameters)
509 if(!metricParameter.second
510 .getNode(TableViewColumnInfo::COL_NAME_STATUS)
514 OUT << metricParameter.second.getNode(
"metricParameterKey").getValue()
516 << metricParameter.second.getNode(
"metricParameterValue")
520 if(!metricParameter.second
521 .getNode(TableViewColumnInfo::COL_NAME_STATUS)
529 if(!metric.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
546 void ARTDAQTableBase::outputDataReceiverFHICL(
const ConfigurationTree& receiverNode,
548 const std::string& selfHost,
550 ARTDAQTableBase::ARTDAQAppType appType,
551 size_t maxFragmentSizeBytes)
553 std::string filename = getFHICLFilename(appType, receiverNode.getValue());
559 std::string tabStr =
"";
560 std::string commentStr =
"";
562 out.open(filename, std::fstream::out | std::fstream::trunc);
565 __SS__ <<
"Failed to open ARTDAQ fcl file: " << filename << __E__;
571 OUT <<
"###########################################################" << __E__;
573 OUT <<
"# artdaq " << getTypeString(appType)
574 <<
" fcl configuration file produced by otsdaq." << __E__;
575 OUT <<
"# Creation timestamp: " << StringMacros::getTimestampString() << __E__;
576 OUT <<
"# Original filename: " << filename << __E__;
577 OUT <<
"# otsdaq-ARTDAQ " << getTypeString(appType)
578 <<
" UID: " << receiverNode.getValue() << __E__;
580 OUT <<
"###########################################################" << __E__;
586 if(receiverNode.isDisconnected())
594 catch(
const std::runtime_error&)
596 __COUT__ <<
"Ignoring error, assume this a valid UID node." << __E__;
603 __COUT__ <<
"Inserting preamble parameters..." << __E__;
604 ARTDAQTableBase::insertParameters(out,
607 receiverNode.getNode(
"preambleParametersLink"),
614 __COUT__ <<
"Generating daq block..." << __E__;
615 auto daq = receiverNode.getNode(
"daqLink");
616 if(!daq.isDisconnected())
622 if(appType == ARTDAQAppType::EventBuilder)
625 OUT <<
"event_builder: {\n";
630 OUT <<
"aggregator: {\n";
635 OUT <<
"max_fragment_size_bytes: " << maxFragmentSizeBytes <<
"\n";
636 if(appType == ARTDAQAppType::DataLogger)
638 OUT <<
"is_datalogger: true\n";
640 else if(appType == ARTDAQAppType::Dispatcher)
642 OUT <<
"is_dispatcher: true\n";
647 __COUT__ <<
"Inserting DAQ Parameters..." << __E__;
648 ARTDAQTableBase::insertParameters(out,
651 daq.getNode(
"daqParametersLink"),
656 __COUT__ <<
"Adding sources placeholder" << __E__;
657 OUT <<
"sources: {\n"
663 __COUT__ <<
"Filling in metrics" << __E__;
664 OUT <<
"metrics: {\n";
667 auto metricsGroup = daq.getNode(
"daqMetricsLink");
668 if(!metricsGroup.isDisconnected())
670 auto metrics = metricsGroup.getChildren();
672 for(
auto& metric : metrics)
674 if(!metric.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
678 OUT << metric.second.getNode(
"metricKey").getValue() <<
": {\n";
681 OUT <<
"metricPluginType: "
682 << metric.second.getNode(
"metricPluginType").getValue() <<
"\n";
683 OUT <<
"level: " << metric.second.getNode(
"metricLevel").getValue()
688 ARTDAQTableBase::insertParameters(
692 metric.second.getNode(
"metricParametersLink"),
700 if(!metric.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
714 __COUT__ <<
"Filling art block..." << __E__;
715 auto art = receiverNode.getNode(
"artLink");
716 if(!art.isDisconnected())
724 __COUT__ <<
"Filling art.services" << __E__;
725 auto services = art.getNode(
"servicesLink");
726 if(!services.isDisconnected())
728 OUT <<
"services: {\n";
734 ARTDAQTableBase::insertParameters(out,
737 services.getNode(
"ServicesParametersLink"),
743 OUT <<
"scheduler: {\n";
745 #if ART_HEX_VERSION < 0x30200
751 OUT <<
"errorOnFailureToPut: "
752 << (services.getNode(
"schedulerErrorOnFailtureToPut").getValue<
bool>()
761 OUT <<
"NetMonTransportServiceInterface: {\n";
764 OUT <<
"service_provider: " <<
766 services.getNode(
"NetMonTrasportServiceInterfaceServiceProvider")
770 OUT <<
"destinations: {\n"
778 ARTDAQTableBase::insertParameters(out,
781 services.getNode(
"ServicesParametersLink"),
792 __COUT__ <<
"Filling art.outputs" << __E__;
793 auto outputs = art.getNode(
"outputsLink");
794 if(!outputs.isDisconnected())
796 OUT <<
"outputs: {\n";
800 auto outputPlugins = outputs.getChildren();
801 for(
auto& outputPlugin : outputPlugins)
803 if(!outputPlugin.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
807 OUT << outputPlugin.second.getNode(
"outputKey").getValue() <<
": {\n";
810 std::string moduleType = ARTDAQTableBase::insertModuleType(
814 outputPlugin.second.getNode(
"outputModuleType"));
818 ARTDAQTableBase::insertParameters(
822 outputPlugin.second.getNode(
"outputModuleParameterLink"),
827 if(outputPlugin.second.getNode(
"outputModuleType").getValue() ==
830 OUT <<
"destinations: {\n"
837 if(!outputPlugin.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
848 __COUT__ <<
"Filling art.physics" << __E__;
849 auto physics = art.getNode(
"physicsLink");
850 if(!physics.isDisconnected())
853 OUT <<
"physics: {\n";
859 ARTDAQTableBase::insertParameters(
863 physics.getNode(
"physicsOtherParametersLink"),
868 auto analyzers = physics.getNode(
"analyzersLink");
869 if(!analyzers.isDisconnected())
872 OUT <<
"analyzers: {\n";
876 auto modules = analyzers.getChildren();
877 for(
auto& module : modules)
879 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
885 ARTDAQTableBase::insertParameters(
889 module.second.getNode(
"analyzerModuleParameterLink"),
890 "analyzerParameter" ,
894 OUT << module.second.getNode(
"analyzerKey").getValue() <<
": {\n";
896 ARTDAQTableBase::insertModuleType(
900 module.second.getNode(
"analyzerModuleType"));
904 ARTDAQTableBase::insertParameters(
908 module.second.getNode(
"analyzerModuleParameterLink"),
909 "analyzerParameter" ,
916 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
924 auto producers = physics.getNode(
"producersLink");
925 if(!producers.isDisconnected())
928 OUT <<
"producers: {\n";
932 auto modules = producers.getChildren();
933 for(
auto& module : modules)
935 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
941 ARTDAQTableBase::insertParameters(
945 module.second.getNode(
"producerModuleParameterLink"),
946 "producerParameter" ,
950 OUT << module.second.getNode(
"producerKey").getValue() <<
": {\n";
953 ARTDAQTableBase::insertModuleType(
957 module.second.getNode(
"producerModuleType"));
961 ARTDAQTableBase::insertParameters(
965 module.second.getNode(
"producerModuleParameterLink"),
966 "producerParameter" ,
973 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
981 auto filters = physics.getNode(
"filtersLink");
982 if(!filters.isDisconnected())
985 OUT <<
"filters: {\n";
989 auto modules = filters.getChildren();
990 for(
auto& module : modules)
992 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
998 ARTDAQTableBase::insertParameters(
1002 module.second.getNode(
"filterModuleParameterLink"),
1007 OUT << module.second.getNode(
"filterKey").getValue() <<
": {\n";
1010 ARTDAQTableBase::insertModuleType(
1014 module.second.getNode(
"filterModuleType"));
1018 ARTDAQTableBase::insertParameters(
1022 module.second.getNode(
"filterModuleParameterLink"),
1030 if(!module.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
1040 ARTDAQTableBase::insertParameters(
1044 physics.getNode(
"physicsOtherParametersLink"),
1045 "physicsParameter" ,
1055 __COUT__ <<
"Filling art.source" << __E__;
1056 auto source = art.getNode(
"sourceLink");
1057 if(!source.isDisconnected())
1059 OUT <<
"source: {\n";
1063 ARTDAQTableBase::insertModuleType(
1064 out, tabStr, commentStr, source.getNode(
"sourceModuleType"));
1066 OUT <<
"waiting_time: " << source.getNode(
"sourceWaitingTime").getValue()
1068 OUT <<
"resume_after_timeout: "
1069 << (source.getNode(
"sourceResumeAfterTimeout").getValue<
bool>() ?
"true"
1078 __COUT__ <<
"Writing art.process_name" << __E__;
1079 OUT <<
"process_name: " << art.getNode(
"ProcessName") <<
"\n";
1087 __COUT__ <<
"Inserting add-on parameters" << __E__;
1088 ARTDAQTableBase::insertParameters(out,
1091 receiverNode.getNode(
"addOnParametersLink"),
1096 __COUT__ <<
"outputDataReceiverFHICL DONE" << __E__;
1101 void ARTDAQTableBase::extractArtdaqInfo(
1103 std::map<int /*subsystem ID*/, ARTDAQTableBase::SubsystemInfo>& subsystems,
1104 std::map<ARTDAQTableBase::ARTDAQAppType, std::list<ARTDAQTableBase::ProcessInfo>>& processes,
1106 size_t maxFragmentSizeBytes ,
1110 progressBar->step();
1112 subsystems[ARTDAQTableBase::NULL_SUBSYSTEM_DESTINATION].id = ARTDAQTableBase::NULL_SUBSYSTEM_DESTINATION;
1113 subsystems[ARTDAQTableBase::NULL_SUBSYSTEM_DESTINATION].label =
"nullDestinationSubsystem";
1115 std::list<ARTDAQTableBase::ProcessInfo>& readerInfo =
1116 processes[ARTDAQTableBase::ARTDAQAppType::BoardReader];
1118 __COUT__ <<
"Checking for BoardReaders" << __E__;
1119 auto readersLink = artdaqSupervisorNode.getNode(
"boardreadersLink");
1120 if(!readersLink.isDisconnected() && readersLink.getChildren().size() > 0)
1122 auto readers = readersLink.getChildren();
1123 __COUT__ <<
"There are " << readers.size() <<
" configured BoardReaders"
1126 for(
auto& reader : readers)
1128 if(reader.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
1131 auto readerUID = reader.second.getNode(
"SupervisorUID").getValue();
1133 reader.second.getNode(
"DAQInterfaceHostname").getValue();
1135 auto readerSubsystemID = 1;
1136 auto readerSubsystemLink = reader.second.getNode(
"SubsystemLink");
1137 if(!readerSubsystemLink.isDisconnected())
1139 readerSubsystemID = ARTDAQTableBase::getSubsytemId(readerSubsystemLink);
1140 __COUTV__(readerSubsystemID);
1141 subsystems[readerSubsystemID].id = readerSubsystemID;
1143 const std::string& readerSubsystemName =
1144 readerSubsystemLink.getUIDAsString();
1145 __COUTV__(readerSubsystemName);
1147 subsystems[readerSubsystemID].label = readerSubsystemName;
1149 auto readerSubsystemDestinationLink =
1150 readerSubsystemLink.getNode(
"SubsystemDestinationLink");
1151 if(readerSubsystemDestinationLink.isDisconnected())
1154 subsystems[readerSubsystemID].destination = 0;
1159 subsystems[readerSubsystemID].destination =
1160 ARTDAQTableBase::getSubsytemId(readerSubsystemDestinationLink);
1162 __COUTV__(subsystems[readerSubsystemID].destination);
1165 if(!subsystems.count(subsystems[readerSubsystemID].destination) ||
1166 !subsystems[subsystems[readerSubsystemID].destination]
1167 .sources.count(readerSubsystemID))
1169 subsystems[subsystems[readerSubsystemID].destination]
1170 .sources.insert(readerSubsystemID);
1175 __COUT__ <<
"Found BoardReader with UID " << readerUID
1176 <<
", DAQInterface Hostname " << readerHost
1177 <<
", and Subsystem " << readerSubsystemID << __E__;
1178 readerInfo.emplace_back(readerUID, readerHost, readerSubsystemID);
1181 ARTDAQTableBase::outputReaderFHICL(
1184 maxFragmentSizeBytes);
1188 __COUT__ <<
"BoardReader "
1189 << reader.second.getNode(
"SupervisorUID").getValue()
1190 <<
" is disabled." << __E__;
1196 __SS__ <<
"Error: There should be at least one BoardReader!";
1203 progressBar->step();
1205 std::list<ARTDAQTableBase::ProcessInfo>& builderInfo =
1206 processes[ARTDAQTableBase::ARTDAQAppType::EventBuilder];
1208 auto buildersLink = artdaqSupervisorNode.getNode(
"eventbuildersLink");
1209 if(!buildersLink.isDisconnected() && buildersLink.getChildren().size() > 0)
1211 auto builders = buildersLink.getChildren();
1213 for(
auto& builder : builders)
1215 if(builder.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
1218 auto builderUID = builder.second.getNode(
"SupervisorUID").getValue();
1220 builder.second.getNode(
"DAQInterfaceHostname").getValue();
1222 auto builderSubsystemID = 1;
1223 auto builderSubsystemLink = builder.second.getNode(
"SubsystemLink");
1224 if(!builderSubsystemLink.isDisconnected())
1226 builderSubsystemID = ARTDAQTableBase::getSubsytemId(builderSubsystemLink);
1227 __COUTV__(builderSubsystemID);
1229 subsystems[builderSubsystemID].id = builderSubsystemID;
1231 const std::string& builderSubsystemName =
1232 builderSubsystemLink.getUIDAsString();
1233 __COUTV__(builderSubsystemName);
1235 subsystems[builderSubsystemID].label = builderSubsystemName;
1237 auto builderSubsystemDestinationLink =
1238 builderSubsystemLink.getNode(
"SubsystemDestinationLink");
1239 if(builderSubsystemDestinationLink.isDisconnected())
1242 subsystems[builderSubsystemID].destination = 0;
1247 subsystems[builderSubsystemID].destination =
1248 ARTDAQTableBase::getSubsytemId(builderSubsystemDestinationLink);
1250 __COUTV__(subsystems[builderSubsystemID].destination);
1253 if(!subsystems.count(subsystems[builderSubsystemID].destination) ||
1254 !subsystems[subsystems[builderSubsystemID].destination]
1255 .sources.count(builderSubsystemID))
1257 subsystems[subsystems[builderSubsystemID].destination]
1258 .sources.insert(builderSubsystemID);
1263 __COUT__ <<
"Found EventBuilder with UID " << builderUID
1264 <<
", DAQInterface Hostname " << builderHost
1265 <<
", and Subsystem " << builderSubsystemID << __E__;
1266 builderInfo.emplace_back(builderUID, builderHost, builderSubsystemID);
1269 ARTDAQTableBase::outputDataReceiverFHICL(
1272 ARTDAQTableBase::ARTDAQAppType::EventBuilder,
1273 maxFragmentSizeBytes);
1277 __COUT__ <<
"EventBuilder "
1278 << builder.second.getNode(
"SupervisorUID").getValue()
1279 <<
" is disabled." << __E__;
1285 __SS__ <<
"Error: There should be at least one EventBuilder!";
1292 progressBar->step();
1294 std::list<ARTDAQTableBase::ProcessInfo>& loggerInfo =
1295 processes[ARTDAQTableBase::ARTDAQAppType::DataLogger];
1297 auto dataloggersLink = artdaqSupervisorNode.getNode(
"dataloggersLink");
1298 if(!dataloggersLink.isDisconnected())
1300 auto dataloggers = dataloggersLink.getChildren();
1302 for(
auto& datalogger : dataloggers)
1304 if(datalogger.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
1308 datalogger.second.getNode(
"DAQInterfaceHostname").getValue();
1310 datalogger.second.getNode(
"SupervisorUID").getValue();
1312 auto loggerSubsystemID = 1;
1313 auto loggerSubsystemLink = datalogger.second.getNode(
"SubsystemLink");
1314 if(!loggerSubsystemLink.isDisconnected())
1316 loggerSubsystemID = ARTDAQTableBase::getSubsytemId(loggerSubsystemLink);
1317 __COUTV__(loggerSubsystemID);
1318 subsystems[loggerSubsystemID].id = loggerSubsystemID;
1320 const std::string& loggerSubsystemName =
1321 loggerSubsystemLink.getUIDAsString();
1322 __COUTV__(loggerSubsystemName);
1324 subsystems[loggerSubsystemID].label = loggerSubsystemName;
1326 auto loggerSubsystemDestinationLink =
1327 loggerSubsystemLink.getNode(
"SubsystemDestinationLink");
1328 if(loggerSubsystemDestinationLink.isDisconnected())
1331 subsystems[loggerSubsystemID].destination = 0;
1336 subsystems[loggerSubsystemID].destination =
1337 ARTDAQTableBase::getSubsytemId(loggerSubsystemDestinationLink);
1339 __COUTV__(subsystems[loggerSubsystemID].destination);
1342 if(!subsystems.count(subsystems[loggerSubsystemID].destination) ||
1343 !subsystems[subsystems[loggerSubsystemID].destination]
1344 .sources.count(loggerSubsystemID))
1346 subsystems[subsystems[loggerSubsystemID].destination]
1347 .sources.insert(loggerSubsystemID);
1352 __COUT__ <<
"Found DataLogger with UID " << loggerUID
1353 <<
", DAQInterface Hostname " << loggerHost
1354 <<
", and Subsystem " << loggerSubsystemID << __E__;
1355 loggerInfo.emplace_back(loggerUID, loggerHost, loggerSubsystemID);
1358 ARTDAQTableBase::outputDataReceiverFHICL(
1361 ARTDAQTableBase::ARTDAQAppType::DataLogger,
1362 maxFragmentSizeBytes);
1366 __COUT__ <<
"DataLogger "
1367 << datalogger.second.getNode(
"SupervisorUID").getValue()
1368 <<
" is disabled." << __E__;
1374 std::list<ARTDAQTableBase::ProcessInfo>& dispatcherInfo =
1375 processes[ARTDAQTableBase::ARTDAQAppType::Dispatcher];
1377 auto dispatchersLink = artdaqSupervisorNode.getNode(
"dispatchersLink");
1378 if(!dispatchersLink.isDisconnected())
1380 auto dispatchers = dispatchersLink.getChildren();
1382 for(
auto& dispatcher : dispatchers)
1384 if(dispatcher.second.getNode(TableViewColumnInfo::COL_NAME_STATUS)
1387 auto dispatcherHost =
1388 dispatcher.second.getNode(
"DAQInterfaceHostname").getValue();
1389 auto dispatcherUID = dispatcher.second.getNode(
"SupervisorUID").getValue();
1391 auto dispatcherSubsystemID = 1;
1392 auto dispatcherSubsystemLink = dispatcher.second.getNode(
"SubsystemLink");
1393 if(!dispatcherSubsystemLink.isDisconnected())
1395 dispatcherSubsystemID = ARTDAQTableBase::getSubsytemId(dispatcherSubsystemLink);
1396 __COUTV__(dispatcherSubsystemID);
1397 subsystems[dispatcherSubsystemID].id = dispatcherSubsystemID;
1399 const std::string& dispatcherSubsystemName =
1400 dispatcherSubsystemLink.getUIDAsString();
1401 __COUTV__(dispatcherSubsystemName);
1403 subsystems[dispatcherSubsystemID].label = dispatcherSubsystemName;
1405 auto dispatcherSubsystemDestinationLink =
1406 dispatcherSubsystemLink.getNode(
"SubsystemDestinationLink");
1407 if(dispatcherSubsystemDestinationLink.isDisconnected())
1410 subsystems[dispatcherSubsystemID].destination = 0;
1415 subsystems[dispatcherSubsystemID].destination =
1416 ARTDAQTableBase::getSubsytemId(dispatcherSubsystemDestinationLink);
1418 __COUTV__(subsystems[dispatcherSubsystemID].destination);
1421 if(!subsystems.count(subsystems[dispatcherSubsystemID].destination) ||
1422 !subsystems[subsystems[dispatcherSubsystemID].destination]
1423 .sources.count(dispatcherSubsystemID))
1425 subsystems[subsystems[dispatcherSubsystemID].destination]
1426 .sources.insert(dispatcherSubsystemID);
1430 __COUT__ <<
"Found Dispatcher with UID " << dispatcherUID
1431 <<
", DAQInterface Hostname " << dispatcherHost
1432 <<
", and Subsystem " << dispatcherSubsystemID << __E__;
1433 dispatcherInfo.emplace_back(dispatcherUID, dispatcherHost, dispatcherSubsystemID);
1436 ARTDAQTableBase::outputDataReceiverFHICL(
1439 ARTDAQTableBase::ARTDAQAppType::Dispatcher,
1440 maxFragmentSizeBytes);
1444 __COUT__ <<
"Dispatcher "
1445 << dispatcher.second.getNode(
"SupervisorUID").getValue()
1446 <<
" is disabled." << __E__;
1460 return subsystemNode.getNodeRow() + 2;