1 #include "otsdaq/TablePlugins/ARTDAQTableBase/ARTDAQTableBase.h"
7 #include "otsdaq/Macros/CoutMacros.h"
8 #define TRACE_NAME "ARTDAQTableBase"
10 #include <fhiclcpp/ParameterSet.h>
11 #include <fhiclcpp/detail/print_mode.h>
12 #include <fhiclcpp/intermediate_table.h>
13 #include <fhiclcpp/parse.h>
15 #include "otsdaq/ProgressBar/ProgressBar.h"
16 #include "otsdaq/TablePlugins/XDAQContextTable/XDAQContextTable.h"
21 #define __MF_SUBJECT__ "ARTDAQTableBase"
25 const std::string ARTDAQTableBase::ARTDAQ_FCL_PATH = std::string(__ENV__(
"USER_DATA")) +
"/" +
"ARTDAQConfigurations/";
27 const std::string ARTDAQTableBase::ARTDAQ_SUPERVISOR_CLASS =
"ots::ARTDAQSupervisor";
28 const std::string ARTDAQTableBase::ARTDAQ_SUPERVISOR_TABLE =
"ARTDAQSupervisorTable";
30 const std::string ARTDAQTableBase::ARTDAQ_READER_TABLE =
"ARTDAQBoardReaderTable";
31 const std::string ARTDAQTableBase::ARTDAQ_BUILDER_TABLE =
"ARTDAQEventBuilderTable";
32 const std::string ARTDAQTableBase::ARTDAQ_LOGGER_TABLE =
"ARTDAQDataLoggerTable";
33 const std::string ARTDAQTableBase::ARTDAQ_DISPATCHER_TABLE =
"ARTDAQDispatcherTable";
34 const std::string ARTDAQTableBase::ARTDAQ_MONITOR_TABLE =
"ARTDAQMonitorTable";
35 const std::string ARTDAQTableBase::ARTDAQ_ROUTER_TABLE =
"ARTDAQRoutingManagerTable";
37 const std::string ARTDAQTableBase::ARTDAQ_SUBSYSTEM_TABLE =
"ARTDAQSubsystemTable";
38 const std::string ARTDAQTableBase::ARTDAQ_DAQ_TABLE =
"ARTDAQDaqTable";
39 const std::string ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE =
"ARTDAQDaqParameterTable";
41 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME =
"ExecutionHostname";
42 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS =
"AllowedProcessors";
43 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK =
"SubsystemLink";
44 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID =
"SubsystemLinkUID";
47 const int ARTDAQTableBase::NULL_SUBSYSTEM_DESTINATION = 0;
48 const std::string ARTDAQTableBase::NULL_SUBSYSTEM_DESTINATION_LABEL =
"nullDestinationSubsystem";
71 std::string* accumulatedExceptions )
72 :
TableBase(tableName, accumulatedExceptions)
75 mkdir((ARTDAQ_FCL_PATH).c_str(), 0755);
84 std::cout <<
"ARTDAQTableBase Before traceTID=" << traceTID << __E__;
86 traceInit(trace_name(TRACE_NAME, __TRACE_FILE__, buf,
sizeof(buf)), 0);
87 std::cout <<
"ARTDAQTableBase After traceTID=" << traceTID << __E__;
88 __COUT__ <<
"ARTDAQTableBase TRACE reinit and Constructed." << __E__;
98 __SS__ <<
"Should not call void constructor, table type is lost!" << __E__;
103 ARTDAQTableBase::~ARTDAQTableBase(
void) {}
106 const std::string& ARTDAQTableBase::getTypeString(ARTDAQAppType type)
110 case ARTDAQAppType::EventBuilder:
112 case ARTDAQAppType::DataLogger:
114 case ARTDAQAppType::Dispatcher:
116 case ARTDAQAppType::BoardReader:
118 case ARTDAQAppType::Monitor:
120 case ARTDAQAppType::RoutingManager:
124 __SS__ <<
"Illegal translation attempt for type '" << (
unsigned int)type <<
"'"
130 std::string ARTDAQTableBase::getFHICLFilename(ARTDAQAppType type,
const std::string& name)
134 std::string filename = ARTDAQ_FCL_PATH + getTypeString(type) +
"-";
135 std::string uid = name;
136 for(
unsigned int i = 0; i < uid.size(); ++i)
137 if((uid[i] >=
'a' && uid[i] <=
'z') || (uid[i] >=
'A' && uid[i] <=
'Z') ||
138 (uid[i] >=
'0' && uid[i] <=
'9'))
149 std::string ARTDAQTableBase::getFlatFHICLFilename(ARTDAQAppType type,
150 const std::string& name)
154 std::string filename = ARTDAQ_FCL_PATH + getTypeString(type) +
"-";
155 std::string uid = name;
156 for(
unsigned int i = 0; i < uid.size(); ++i)
157 if((uid[i] >=
'a' && uid[i] <=
'z') || (uid[i] >=
'A' && uid[i] <=
'Z') ||
158 (uid[i] >=
'0' && uid[i] <=
'9'))
161 filename +=
"_flattened.fcl";
169 void ARTDAQTableBase::flattenFHICL(ARTDAQAppType type,
const std::string& name)
171 std::chrono::steady_clock::time_point startClock = std::chrono::steady_clock::now();
174 std::string inFile = getFHICLFilename(type, name);
175 std::string outFile = getFlatFHICLFilename(type, name);
180 cet::filepath_lookup_nonabsolute policy(
"FHICL_FILE_PATH");
181 fhicl::ParameterSet pset;
185 TLOG(TLVL_INFO) <<
"parsing document: " << inFile;
188 pset = fhicl::ParameterSet::make(inFile, policy);
189 TLOG(TLVL_TRACE) <<
"document: " << inFile <<
" parsed";
190 TLOG(TLVL_TRACE) <<
"got pset from table:";
192 std::ofstream ofs{outFile};
193 ofs << pset.to_indented_string(
195 __COUTT__ << name <<
" Flatten Clock time = "
196 << artdaq::TimeUtils::GetElapsedTime(startClock) << __E__;
198 catch(cet::exception
const& e)
200 __SS__ <<
"Failed to parse fhicl: " << e.what() << __E__;
214 std::string& commentStr,
216 const std::string& parameterPreamble,
217 bool onlyInsertAtTableParameters ,
218 bool includeAtTableParameters )
224 auto otherParameters = parameterGroupLink.
getChildren();
228 for(
auto& parameter : otherParameters)
230 key = parameter.second.getNode(parameterPreamble +
"Key").getValue();
234 if(key.find(
"@table::") != std::string::npos)
237 if(onlyInsertAtTableParameters || includeAtTableParameters)
239 if(!parameter.second.status())
245 OUT << parameter.second.getNode(parameterPreamble +
"Value")
249 if(!parameter.second.status())
258 if(onlyInsertAtTableParameters)
261 if(!parameter.second.status())
267 if(key.find(
"#include") == std::string::npos)
269 OUT << parameter.second.getNode(parameterPreamble +
"Value").getValue()
272 if(!parameter.second.status())
286 std::string& commentStr,
289 std::string value = moduleTypeNode.
getValue();
292 if(value.find(
"@table::") == std::string::npos)
293 out <<
"module_type: ";
294 out << value <<
"\n";
303 std::string& commentStr,
306 OUT <<
"\n\nmetrics: {\n";
309 auto metricsGroup = daqNode.
getNode(
"daqMetricsLink");
310 if(!metricsGroup.isDisconnected())
314 for(
auto& metric : metrics)
316 if(!metric.second.status())
319 OUT << metric.second.getNode(
"metricKey").getValue() <<
": {\n";
322 OUT <<
"metricPluginType: "
323 << metric.second.getNode(
"metricPluginType").getValue() <<
"\n";
324 OUT <<
"level: " << metric.second.getNode(
"metricLevel").getValue() <<
"\n";
326 auto metricParametersGroup = metric.second.getNode(
"metricParametersLink");
327 if(!metricParametersGroup.isDisconnected())
329 auto metricParameters = metricParametersGroup.getChildren();
330 for(
auto& metricParameter : metricParameters)
332 if(!metricParameter.second.status())
335 OUT << metricParameter.second.getNode(
"metricParameterKey").getValue()
337 << metricParameter.second.getNode(
"metricParameterValue")
341 if(!metricParameter.second.status())
348 if(!metric.second.status())
357 void ARTDAQTableBase::outputBoardReaderFHICL(
360 size_t routingTimeoutMs ,
361 size_t routingRetryCount )
488 std::string filename =
489 getFHICLFilename(ARTDAQAppType::BoardReader, boardReaderNode.
getValue());
495 std::string tabStr =
"";
496 std::string commentStr =
"";
498 out.open(filename, std::fstream::out | std::fstream::trunc);
501 __SS__ <<
"Failed to open ARTDAQ BoardReader fcl file: " << filename << __E__;
507 OUT <<
"###########################################################" << __E__;
509 OUT <<
"# artdaq reader fcl configuration file produced by otsdaq." << __E__;
512 OUT <<
"# Original filename: \t" << filename << __E__;
513 OUT <<
"# otsdaq-ARTDAQ Reader UID:\t" << boardReaderNode.
getValue() << __E__;
515 OUT <<
"###########################################################" << __E__;
529 catch(
const std::runtime_error&)
542 boardReaderNode.
getNode(
"preambleParametersLink"),
553 OUT <<
"fragment_receiver: {\n";
559 <<
": " << boardReaderNode.
getNode(
"daqGeneratorPluginType").
getValue()
560 << (
"\t #daq generator plug-in type") <<
"\n";
561 OUT <<
"fragment_type"
562 <<
": " << boardReaderNode.
getNode(
"daqGeneratorFragmentType").
getValue()
563 << (
"\t #generator data fragment type") <<
"\n\n";
566 auto parametersLink = boardReaderNode.
getNode(
"daqParametersLink");
567 if(!parametersLink.isDisconnected())
570 for(
auto& parameter : parameters)
572 if(!parameter.second.status())
583 parameter.second.getNode(TableViewColumnInfo::COL_NAME_COMMENT);
584 OUT << parameter.second.getNode(
"daqParameterKey").getValue() <<
": "
585 << parameter.second.getNode(
"daqParameterValue").getValue()
586 << (comment.isDefaultValue() ?
"" : (
"\t # " + comment.getValue()))
589 if(!parameter.second.status())
596 OUT <<
"destinations: {\n";
600 OUT <<
"routing_table_config: {\n";
603 auto readerSubsystemID = 1;
604 auto readerSubsystemLink = boardReaderNode.
getNode(
"SubsystemLink");
605 if(!readerSubsystemLink.isDisconnected())
607 readerSubsystemID = getSubsytemId(readerSubsystemLink);
609 if(info_.subsystems[readerSubsystemID].hasRoutingManager)
611 OUT <<
"use_routing_manager: true\n";
612 OUT <<
"routing_manager_hostname: \""
613 << info_.subsystems[readerSubsystemID].routingManagerHost <<
"\"\n";
614 OUT <<
"table_update_port: 0\n";
615 OUT <<
"table_update_address: \"0.0.0.0\"\n";
616 OUT <<
"table_update_multicast_interface: \"0.0.0.0\"\n";
617 OUT <<
"table_acknowledge_port : 0\n";
618 OUT <<
"routing_timeout_ms: " << routingTimeoutMs <<
"\n";
619 OUT <<
"routing_retry_count: " << routingRetryCount <<
"\n";
623 OUT <<
"use_routing_manager: false\n";
643 boardReaderNode.
getNode(
"addOnParametersLink"),
656 ARTDAQAppType appType,
658 size_t routingTimeoutMs ,
659 size_t routingRetryCount )
661 std::string filename = getFHICLFilename(appType, receiverNode.
getValue());
667 std::string tabStr =
"";
668 std::string commentStr =
"";
670 out.open(filename, std::fstream::out | std::fstream::trunc);
673 __SS__ <<
"Failed to open ARTDAQ fcl file: " << filename << __E__;
679 OUT <<
"###########################################################" << __E__;
681 OUT <<
"# artdaq " << getTypeString(appType)
682 <<
" fcl configuration file produced by otsdaq." << __E__;
685 OUT <<
"# Original filename: \t" << filename << __E__;
686 OUT <<
"# otsdaq-ARTDAQ " << getTypeString(appType) <<
" UID:\t"
687 << receiverNode.
getValue() << __E__;
689 OUT <<
"###########################################################" << __E__;
703 catch(
const std::runtime_error&)
716 receiverNode.
getNode(
"preambleParametersLink"),
724 auto daq = receiverNode.
getNode(
"daqLink");
725 if(!daq.isDisconnected())
731 if(appType == ARTDAQAppType::EventBuilder)
734 OUT <<
"event_builder: {\n";
739 OUT <<
"aggregator: {\n";
744 if(appType == ARTDAQAppType::DataLogger)
746 OUT <<
"is_datalogger: true\n";
748 else if(appType == ARTDAQAppType::Dispatcher)
750 OUT <<
"is_dispatcher: true\n";
759 daq.getNode(
"daqParametersLink"),
764 if(appType == ARTDAQAppType::EventBuilder)
766 OUT <<
"routing_token_config: {\n";
769 auto builderSubsystemID = 1;
770 auto builderSubsystemLink = receiverNode.
getNode(
"SubsystemLink");
771 if(!builderSubsystemLink.isDisconnected())
773 builderSubsystemID = getSubsytemId(builderSubsystemLink);
776 if(info_.subsystems[builderSubsystemID].hasRoutingManager)
778 OUT <<
"use_routing_manager: true\n";
779 OUT <<
"routing_manager_hostname: \""
780 << info_.subsystems[builderSubsystemID].routingManagerHost <<
"\"\n";
781 OUT <<
"routing_token_port: 0\n";
785 OUT <<
"use_routing_manager: false\n";
792 OUT <<
"sources: {\n"
807 auto art = receiverNode.
getNode(
"artLink");
808 if(!art.isDisconnected())
818 receiverNode.
getNode(
"SubsystemLink"),
832 receiverNode.
getNode(
"addOnParametersLink"),
846 std::string filename =
847 getFHICLFilename(ARTDAQAppType::Monitor, monitorNode.
getValue());
853 std::string tabStr =
"";
854 std::string commentStr =
"";
856 out.open(filename, std::fstream::out | std::fstream::trunc);
859 __SS__ <<
"Failed to open ARTDAQ fcl file: " << filename << __E__;
865 OUT <<
"###########################################################" << __E__;
867 OUT <<
"# artdaq " << getTypeString(ARTDAQAppType::Monitor)
868 <<
" fcl configuration file produced by otsdaq." << __E__;
871 OUT <<
"# Original filename: \t" << filename << __E__;
872 OUT <<
"# otsdaq-ARTDAQ " << getTypeString(ARTDAQAppType::Monitor) <<
" UID:\t"
875 OUT <<
"###########################################################" << __E__;
889 catch(
const std::runtime_error&)
902 monitorNode.
getNode(
"preambleParametersLink"),
910 auto art = monitorNode.
getNode(
"artLink");
911 if(!art.isDisconnected())
914 OUT <<
"services.message: { "
915 << artdaq::generateMessageFacilityConfiguration(
916 mf::GetApplicationName().c_str(),
true,
false)
918 OUT <<
"services.message.destinations.file: {type: \"GenFile\" threshold: "
919 "\"INFO\" seperator: \"-\""
920 <<
" pattern: \"" << monitorNode.
getValue() <<
"-%?H%t-%p.log"
922 <<
" timestamp_pattern: \"%Y%m%d%H%M%S\""
923 <<
" directory: \"" << __ENV__(
"OTSDAQ_LOG_ROOT") <<
"/"
925 <<
" append : false }\n";
928 auto dispatcherLink = monitorNode.
getNode(
"dispatcherLink");
929 if(!dispatcherLink.isDisconnected())
931 std::string monitorHost =
932 monitorNode.
getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
934 std::string dispatcherHost =
935 dispatcherLink.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
936 .getValueWithDefault(
"localhost");
937 OUT <<
"source.dispatcherHost: \"" << dispatcherHost <<
"\"\n";
938 int dispatcherPort = dispatcherLink.getNode(
"DispatcherPort").getValue<
int>();
939 OUT <<
"source.dispatcherPort: " << dispatcherPort <<
"\n";
940 OUT <<
"source.commanderPluginType: xmlrpc\n";
944 dispatcherLink.getNode(
"DispatcherID").getValueWithDefault<
int>(200);
946 size_t max_fragment_size =
948 std::string transfer_plugin_type =
951 OUT <<
"TransferPluginConfig: {\n";
953 OUT <<
"transferPluginType: " << transfer_plugin_type <<
"\n";
954 OUT <<
"host_map: [{ rank: " << disp_fake_rank <<
" host: \"" << dispatcherHost
955 <<
"\"}, { rank: " << om_rank <<
" host: \"" << monitorHost <<
"\"}]\n";
956 OUT <<
"max_fragment_size_words: " << max_fragment_size <<
"\n";
957 OUT <<
"source_rank: " << disp_fake_rank <<
"\n";
958 OUT <<
"destination_rank: " << om_rank <<
"\n";
959 OUT <<
"unique_label: " << monitorNode.
getValue() <<
"_to_"
960 << dispatcherLink.getValue() <<
"\n";
963 OUT <<
"source.transfer_plugin: @local::TransferPluginConfig \n";
964 auto dispatcherArt = monitorNode.
getNode(
"dispatcherArtLink");
965 if(!dispatcherArt.isDisconnected())
967 OUT <<
"source.dispatcher_config: {\n";
971 OUT <<
"path: " << monitorNode.
getNode(
"dispatcher_path").
getValue() <<
"\n";
972 OUT <<
"filter_paths: [\n";
976 auto filterPathsLink = monitorNode.
getNode(
"filterPathsLink");
977 if(!filterPathsLink.isDisconnected())
984 for(
auto& filterPath : filterPaths)
990 if(!filterPath.second.status())
993 OUT <<
"name: " << filterPath.second.getNode(
"Name").getValue()
995 OUT <<
"path: " << filterPath.second.getNode(
"Path").getValue()
999 if(!filterPath.second.status())
1008 OUT <<
"unique_label: " << monitorNode.
getValue() <<
"\n";
1022 monitorNode.
getNode(
"addOnParametersLink"),
1035 std::string& tabStr,
1036 std::string& commentStr,
1039 size_t routingTimeoutMs,
1040 size_t routingRetryCount)
1045 auto services = art.
getNode(
"servicesLink");
1046 if(!services.isDisconnected())
1048 OUT <<
"services: {\n";
1057 services.getNode(
"ServicesParametersLink"),
1062 OUT <<
"ArtdaqSharedMemoryServiceInterface: { service_provider: "
1063 "ArtdaqSharedMemoryService \n";
1065 OUT <<
"waiting_time: " << services.getNode(
"sharedMemoryWaitingTime").getValue()
1067 OUT <<
"resume_after_timeout: "
1068 << (services.getNode(
"sharedMemoryResumeAfterTimeout").getValue<
bool>()
1074 OUT <<
"ArtdaqFragmentNamingServiceInterface: { service_provider: "
1075 "ArtdaqFragmentNamingService helper_plugin: "
1076 << (services.getNode(
"fragmentNamingServiceProvider").getValue<std::string>())
1084 services.getNode(
"ServicesParametersLink"),
1096 auto outputs = art.
getNode(
"outputsLink");
1097 if(!outputs.isDisconnected())
1099 OUT <<
"outputs: {\n";
1103 auto outputPlugins = outputs.getChildren();
1104 for(
auto& outputPlugin : outputPlugins)
1106 if(!outputPlugin.second.status())
1109 OUT << outputPlugin.second.getNode(
"outputKey").getValue() <<
": {\n";
1113 out, tabStr, commentStr, outputPlugin.second.getNode(
"outputModuleType"));
1120 outputPlugin.second.getNode(
"outputModuleParameterLink"),
1125 if(outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1126 "BinaryNetOutput" ||
1127 outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1130 OUT <<
"destinations: {\n";
1132 OUT <<
"routing_table_config: {\n";
1135 auto mySubsystemID = 1;
1136 auto destinationSubsystemID = 1;
1139 mySubsystemID = getSubsytemId(subsystemLink);
1141 destinationSubsystemID = info_.subsystems[mySubsystemID].destination;
1142 if(info_.subsystems[destinationSubsystemID].hasRoutingManager)
1144 OUT <<
"use_routing_manager: true\n";
1145 OUT <<
"routing_manager_hostname: \""
1146 << info_.subsystems[destinationSubsystemID].routingManagerHost
1148 OUT <<
"table_update_port: 0\n";
1149 OUT <<
"table_update_address: \"0.0.0.0\"\n";
1150 OUT <<
"table_update_multicast_interface: \"0.0.0.0\"\n";
1151 OUT <<
"table_acknowledge_port : 0\n";
1152 OUT <<
"routing_timeout_ms: " << routingTimeoutMs <<
"\n";
1153 OUT <<
"routing_retry_count: " << routingRetryCount <<
"\n";
1157 OUT <<
"use_routing_manager: false\n";
1160 if(outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1163 info_.subsystems[mySubsystemID].eventMode =
true;
1169 if(outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1171 outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1172 "TransferOutputReliable")
1174 OUT <<
"transfer_plugin: @local::TransferPluginConfig \n";
1180 if(!outputPlugin.second.status())
1191 auto physics = art.
getNode(
"physicsLink");
1192 if(!physics.isDisconnected())
1195 OUT <<
"physics: {\n";
1204 physics.getNode(
"physicsOtherParametersLink"),
1205 "physicsParameter" ,
1209 auto analyzers = physics.getNode(
"analyzersLink");
1210 if(!analyzers.isDisconnected())
1213 OUT <<
"analyzers: {\n";
1217 auto modules = analyzers.getChildren();
1218 for(
auto& module : modules)
1220 if(!module.second.status())
1228 module.second.getNode(
"analyzerModuleParameterLink"),
1229 "analyzerParameter" ,
1233 OUT << module.second.getNode(
"analyzerKey").getValue() <<
": {\n";
1236 out, tabStr, commentStr, module.second.getNode(
"analyzerModuleType"));
1243 module.second.getNode(
"analyzerModuleParameterLink"),
1244 "analyzerParameter" ,
1251 if(!module.second.status())
1258 auto producers = physics.getNode(
"producersLink");
1259 if(!producers.isDisconnected())
1262 OUT <<
"producers: {\n";
1266 auto modules = producers.getChildren();
1267 for(
auto& module : modules)
1269 if(!module.second.status())
1277 module.second.getNode(
"producerModuleParameterLink"),
1278 "producerParameter" ,
1282 if(module.second.status() &&
1283 module.second.getNode(
"producerModuleType").getValue() ==
"")
1285 OUT << module.second.getNode(
"producerKey").getValue() <<
": {\n";
1289 out, tabStr, commentStr, module.second.getNode(
"producerModuleType"));
1296 module.second.getNode(
"producerModuleParameterLink"),
1297 "producerParameter" ,
1304 if(!module.second.status())
1311 auto filters = physics.getNode(
"filtersLink");
1312 if(!filters.isDisconnected())
1315 OUT <<
"filters: {\n";
1319 auto modules = filters.getChildren();
1320 for(
auto& module : modules)
1322 if(!module.second.status())
1330 module.second.getNode(
"filterModuleParameterLink"),
1334 if(module.second.status() &&
1335 module.second.getNode(
"filterModuleType").getValue() ==
"")
1337 OUT << module.second.getNode(
"filterKey").getValue() <<
": {\n";
1341 out, tabStr, commentStr, module.second.getNode(
"filterModuleType"));
1348 module.second.getNode(
"filterModuleParameterLink"),
1356 if(!module.second.status())
1368 physics.getNode(
"physicsOtherParametersLink"),
1369 "physicsParameter" ,
1380 auto source = art.
getNode(
"sourceLink");
1381 if(!source.isDisconnected())
1383 OUT <<
"source: {\n";
1385 insertModuleType(out, tabStr, commentStr, source.getNode(
"sourceModuleType"));
1391 OUT <<
"source: {\n";
1393 OUT <<
"module_type: ArtdaqInput";
1401 OUT <<
"process_name: " << art.
getNode(
"ProcessName") <<
"\n";
1408 art.
getNode(
"AddOnParametersLink"),
1416 void ARTDAQTableBase::outputRoutingManagerFHICL(
1418 size_t routingTimeoutMs ,
1419 size_t routingRetryCount )
1421 std::string filename =
1422 getFHICLFilename(ARTDAQAppType::RoutingManager, routingManagerNode.
getValue());
1428 std::string tabStr =
"";
1429 std::string commentStr =
"";
1431 out.open(filename, std::fstream::out | std::fstream::trunc);
1434 __SS__ <<
"Failed to open ARTDAQ RoutingManager fcl file: " << filename << __E__;
1440 OUT <<
"###########################################################" << __E__;
1441 OUT <<
"#" << __E__;
1442 OUT <<
"# artdaq routingManager fcl configuration file produced by otsdaq." << __E__;
1445 OUT <<
"# Original filename: \t" << filename << __E__;
1446 OUT <<
"# otsdaq-ARTDAQ RoutingManager UID:\t" << routingManagerNode.
getValue()
1448 OUT <<
"#" << __E__;
1449 OUT <<
"###########################################################" << __E__;
1463 catch(
const std::runtime_error&)
1475 OUT <<
"policy: {\n";
1477 auto policyName = routingManagerNode.
getNode(
"routingPolicyPluginType").
getValue();
1478 if(policyName ==
"DEFAULT")
1479 policyName =
"NoOp";
1480 OUT <<
"policy: " << policyName <<
"\n";
1481 OUT <<
"receiver_ranks: []\n";
1484 auto parametersLink = routingManagerNode.
getNode(
"routingPolicyParametersLink");
1485 if(!parametersLink.isDisconnected())
1488 for(
auto& parameter : parameters)
1490 if(!parameter.second.status())
1501 parameter.second.getNode(TableViewColumnInfo::COL_NAME_COMMENT);
1502 OUT << parameter.second.getNode(
"daqParameterKey").getValue() <<
": "
1503 << parameter.second.getNode(
"daqParameterValue").getValue()
1504 << (comment.isDefaultValue() ?
"" : (
"\t # " + comment.getValue()))
1507 if(!parameter.second.status())
1515 OUT <<
"use_routing_manager: true\n";
1517 auto routingManagerSubsystemID = 1;
1518 auto routingManagerSubsystemLink = routingManagerNode.
getNode(
"SubsystemLink");
1519 std::string rmHost =
"localhost";
1520 if(!routingManagerSubsystemLink.isDisconnected())
1522 routingManagerSubsystemID = getSubsytemId(routingManagerSubsystemLink);
1523 rmHost = info_.subsystems[routingManagerSubsystemID].routingManagerHost;
1525 if(rmHost ==
"localhost" || rmHost ==
"127.0.0.1")
1527 char hostbuf[HOST_NAME_MAX + 1];
1528 gethostname(hostbuf, HOST_NAME_MAX);
1529 rmHost = std::string(hostbuf);
1533 OUT <<
"routing_manager_hostname: \"" << rmHost <<
"\"\n";
1534 OUT <<
"sender_ranks: []\n";
1535 OUT <<
"table_update_port: 0\n";
1536 OUT <<
"table_update_address: \"0.0.0.0\"\n";
1537 OUT <<
"table_acknowledge_port: 0\n";
1538 OUT <<
"token_receiver: {\n";
1541 OUT <<
"routing_token_port: 0\n";
1547 auto tableUpdateIntervalMs =
1549 if(tableUpdateIntervalMs !=
"DEFAULT")
1551 OUT <<
"table_update_interval_ms: " << tableUpdateIntervalMs <<
"\n";
1553 auto tableAckRetryCount = routingManagerNode.
getNode(
"tableAckRetryCount").
getValue();
1554 if(tableAckRetryCount !=
"DEFAULT")
1556 OUT <<
"table_ack_retry_count: " << tableAckRetryCount <<
"\n";
1559 OUT <<
"routing_timeout_ms: " << routingTimeoutMs <<
"\n";
1560 OUT <<
"routing_retry_count: " << routingRetryCount <<
"\n";
1573 bool getStatusFalseNodes ,
1575 size_t maxFragmentSizeBytes ,
1576 size_t routingTimeoutMs ,
1577 size_t routingRetryCount ,
1581 progressBar->
step();
1584 info_.subsystems.clear();
1585 info_.processes.clear();
1588 progressBar->
step();
1590 info_.subsystems[NULL_SUBSYSTEM_DESTINATION].id = NULL_SUBSYSTEM_DESTINATION;
1591 info_.subsystems[NULL_SUBSYSTEM_DESTINATION].label = NULL_SUBSYSTEM_DESTINATION_LABEL;
1598 extractRoutingManagersInfo(artdaqSupervisorNode,
1599 getStatusFalseNodes,
1605 progressBar->
step();
1607 extractBoardReadersInfo(artdaqSupervisorNode,
1608 getStatusFalseNodes,
1610 maxFragmentSizeBytes,
1615 progressBar->
step();
1617 extractEventBuildersInfo(
1618 artdaqSupervisorNode, getStatusFalseNodes, doWriteFHiCL, maxFragmentSizeBytes);
1621 progressBar->
step();
1623 extractDataLoggersInfo(
1624 artdaqSupervisorNode, getStatusFalseNodes, doWriteFHiCL, maxFragmentSizeBytes);
1627 progressBar->
step();
1629 extractDispatchersInfo(
1630 artdaqSupervisorNode, getStatusFalseNodes, doWriteFHiCL, maxFragmentSizeBytes);
1633 progressBar->
step();
1639 void ARTDAQTableBase::extractRoutingManagersInfo(
ConfigurationTree artdaqSupervisorNode,
1640 bool getStatusFalseNodes,
1642 size_t routingTimeoutMs,
1643 size_t routingRetryCount)
1645 __COUT__ <<
"Checking for Routing Managers..." << __E__;
1647 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToRoutingManagers_);
1650 std::vector<std::pair<std::string, ConfigurationTree>> routingManagers =
1653 __COUT__ <<
"There are " << routingManagers.size()
1654 <<
" configured Routing Managers" << __E__;
1656 for(
auto& routingManager : routingManagers)
1658 const std::string& rmUID = routingManager.first;
1660 if(getStatusFalseNodes || routingManager.second.status())
1662 std::string rmHost =
1663 routingManager.second
1664 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
1665 .getValueWithDefault(
"localhost");
1666 if(rmHost ==
"localhost" || rmHost ==
"127.0.0.1")
1668 char hostbuf[HOST_NAME_MAX + 1];
1669 gethostname(hostbuf, HOST_NAME_MAX);
1670 rmHost = std::string(hostbuf);
1674 routingManager.second
1675 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
1676 .getValueWithDefault(
"");
1678 int routingManagerSubsystemID = 1;
1680 routingManager.second.
getNode(
1681 ARTDAQTableBase::ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
1684 routingManagerSubsystemID =
1685 getSubsytemId(routingManagerSubsystemLink);
1688 info_.subsystems[routingManagerSubsystemID].id =
1689 routingManagerSubsystemID;
1691 const std::string& routingManagerSubsystemName =
1695 info_.subsystems[routingManagerSubsystemID].label =
1696 routingManagerSubsystemName;
1698 if(info_.subsystems[routingManagerSubsystemID].hasRoutingManager)
1700 __SS__ <<
"Error: You cannot have multiple Routing Managers in a "
1706 auto routingManagerSubsystemDestinationLink =
1707 routingManagerSubsystemLink.
getNode(
1708 colARTDAQSubsystem_.colLinkToDestination_);
1709 if(routingManagerSubsystemDestinationLink.isDisconnected())
1712 info_.subsystems[routingManagerSubsystemID].destination = 0;
1717 info_.subsystems[routingManagerSubsystemID].destination =
1718 getSubsytemId(routingManagerSubsystemDestinationLink);
1724 if(!info_.subsystems.count(
1725 info_.subsystems[routingManagerSubsystemID].destination) ||
1727 .subsystems[info_.subsystems[routingManagerSubsystemID]
1729 .sources.count(routingManagerSubsystemID))
1732 .subsystems[info_.subsystems[routingManagerSubsystemID]
1734 .sources.insert(routingManagerSubsystemID);
1739 __COUT__ <<
"Found Routing Manager with UID " << rmUID
1740 <<
", DAQInterface Hostname " << rmHost <<
", and Subsystem "
1741 << routingManagerSubsystemID << __E__;
1742 info_.processes[ARTDAQAppType::RoutingManager].emplace_back(
1746 routingManagerSubsystemID,
1747 ARTDAQAppType::RoutingManager,
1748 routingManager.second.status());
1750 info_.subsystems[routingManagerSubsystemID].hasRoutingManager =
true;
1751 info_.subsystems[routingManagerSubsystemID].routingManagerHost = rmHost;
1755 outputRoutingManagerFHICL(
1756 routingManager.second, routingTimeoutMs, routingRetryCount);
1758 flattenFHICL(ARTDAQAppType::RoutingManager,
1759 routingManager.second.getValue());
1764 __COUT__ <<
"Routing Manager " << rmUID <<
" is disabled." << __E__;
1771 void ARTDAQTableBase::extractBoardReadersInfo(
ConfigurationTree artdaqSupervisorNode,
1772 bool getStatusFalseNodes,
1774 size_t maxFragmentSizeBytes,
1775 size_t routingTimeoutMs,
1776 size_t routingRetryCount)
1778 __COUT__ <<
"Checking for Board Readers..." << __E__;
1780 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToBoardReaders_);
1783 std::vector<std::pair<std::string, ConfigurationTree>> readers =
1785 __COUT__ <<
"There are " << readers.size() <<
" configured Board Readers."
1788 for(
auto& reader : readers)
1790 const std::string& readerUID = reader.first;
1792 if(getStatusFalseNodes || reader.second.status())
1794 std::string readerHost =
1795 reader.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
1796 .getValueWithDefault(
"localhost");
1797 std::string readerAP =
1799 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
1800 .getValueWithDefault(
"");
1802 int readerSubsystemID = 1;
1804 reader.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
1807 readerSubsystemID = getSubsytemId(readerSubsystemLink);
1809 info_.subsystems[readerSubsystemID].id = readerSubsystemID;
1811 const std::string& readerSubsystemName =
1815 info_.subsystems[readerSubsystemID].label = readerSubsystemName;
1817 auto readerSubsystemDestinationLink = readerSubsystemLink.
getNode(
1818 colARTDAQSubsystem_.colLinkToDestination_);
1819 if(readerSubsystemDestinationLink.isDisconnected())
1822 info_.subsystems[readerSubsystemID].destination = 0;
1827 info_.subsystems[readerSubsystemID].destination =
1828 getSubsytemId(readerSubsystemDestinationLink);
1834 if(!info_.subsystems.count(
1835 info_.subsystems[readerSubsystemID].destination) ||
1836 !info_.subsystems[info_.subsystems[readerSubsystemID].destination]
1837 .sources.count(readerSubsystemID))
1839 info_.subsystems[info_.subsystems[readerSubsystemID].destination]
1840 .sources.insert(readerSubsystemID);
1845 __COUT__ <<
"Found Board Reader with UID " << readerUID
1846 <<
", DAQInterface Hostname " << readerHost <<
", and Subsystem "
1847 << readerSubsystemID << __E__;
1848 info_.processes[ARTDAQAppType::BoardReader].emplace_back(
1853 ARTDAQAppType::BoardReader,
1854 reader.second.status());
1858 outputBoardReaderFHICL(reader.second,
1859 maxFragmentSizeBytes,
1863 flattenFHICL(ARTDAQAppType::BoardReader, reader.second.getValue());
1868 __COUT__ <<
"Board Reader " << readerUID <<
" is disabled." << __E__;
1874 __COUT_WARN__ <<
"There should be at least one Board Reader!";
1881 void ARTDAQTableBase::extractEventBuildersInfo(
ConfigurationTree artdaqSupervisorNode,
1882 bool getStatusFalseNodes,
1884 size_t maxFragmentSizeBytes)
1886 __COUT__ <<
"Checking for Event Builders..." << __E__;
1888 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToEventBuilders_);
1891 std::vector<std::pair<std::string, ConfigurationTree>> builders =
1894 for(
auto& builder : builders)
1896 const std::string& builderUID = builder.first;
1898 if(getStatusFalseNodes || builder.second.status())
1900 std::string builderHost =
1901 builder.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
1902 .getValueWithDefault(
"localhost");
1903 std::string builderAP =
1905 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
1906 .getValueWithDefault(
"");
1908 int builderSubsystemID = 1;
1910 builder.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
1913 builderSubsystemID = getSubsytemId(builderSubsystemLink);
1916 info_.subsystems[builderSubsystemID].id = builderSubsystemID;
1918 const std::string& builderSubsystemName =
1922 info_.subsystems[builderSubsystemID].label = builderSubsystemName;
1924 auto builderSubsystemDestinationLink = builderSubsystemLink.
getNode(
1925 colARTDAQSubsystem_.colLinkToDestination_);
1926 if(builderSubsystemDestinationLink.isDisconnected())
1929 info_.subsystems[builderSubsystemID].destination = 0;
1934 info_.subsystems[builderSubsystemID].destination =
1935 getSubsytemId(builderSubsystemDestinationLink);
1941 if(!info_.subsystems.count(
1942 info_.subsystems[builderSubsystemID].destination) ||
1943 !info_.subsystems[info_.subsystems[builderSubsystemID].destination]
1944 .sources.count(builderSubsystemID))
1946 info_.subsystems[info_.subsystems[builderSubsystemID].destination]
1947 .sources.insert(builderSubsystemID);
1952 __COUT__ <<
"Found Event Builder with UID " << builderUID
1953 <<
", on Hostname " << builderHost <<
", in Subsystem "
1954 << builderSubsystemID << __E__;
1955 info_.processes[ARTDAQAppType::EventBuilder].emplace_back(
1960 ARTDAQAppType::EventBuilder,
1961 builder.second.status());
1966 ARTDAQAppType::EventBuilder,
1967 maxFragmentSizeBytes);
1969 flattenFHICL(ARTDAQAppType::EventBuilder, builder.second.getValue());
1974 __COUT__ <<
"Event Builder " << builderUID <<
" is disabled." << __E__;
1980 __COUT_WARN__ <<
"There should be at least one Event Builder!";
1987 void ARTDAQTableBase::extractDataLoggersInfo(
ConfigurationTree artdaqSupervisorNode,
1988 bool getStatusFalseNodes,
1990 size_t maxFragmentSizeBytes)
1992 __COUT__ <<
"Checking for Data Loggers..." << __E__;
1994 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToDataLoggers_);
1997 std::vector<std::pair<std::string, ConfigurationTree>> dataloggers =
2000 for(
auto& datalogger : dataloggers)
2002 const std::string& loggerUID = datalogger.first;
2004 if(getStatusFalseNodes || datalogger.second.status())
2006 std::string loggerHost =
2007 datalogger.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2008 .getValueWithDefault(
"localhost");
2009 std::string loggerAP =
2011 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2012 .getValueWithDefault(
"");
2014 int loggerSubsystemID = 1;
2016 datalogger.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2019 loggerSubsystemID = getSubsytemId(loggerSubsystemLink);
2021 info_.subsystems[loggerSubsystemID].id = loggerSubsystemID;
2023 const std::string& loggerSubsystemName =
2027 info_.subsystems[loggerSubsystemID].label = loggerSubsystemName;
2029 auto loggerSubsystemDestinationLink = loggerSubsystemLink.
getNode(
2030 colARTDAQSubsystem_.colLinkToDestination_);
2031 if(loggerSubsystemDestinationLink.isDisconnected())
2034 info_.subsystems[loggerSubsystemID].destination = 0;
2039 info_.subsystems[loggerSubsystemID].destination =
2040 getSubsytemId(loggerSubsystemDestinationLink);
2046 if(!info_.subsystems.count(
2047 info_.subsystems[loggerSubsystemID].destination) ||
2048 !info_.subsystems[info_.subsystems[loggerSubsystemID].destination]
2049 .sources.count(loggerSubsystemID))
2051 info_.subsystems[info_.subsystems[loggerSubsystemID].destination]
2052 .sources.insert(loggerSubsystemID);
2057 __COUT__ <<
"Found Data Logger with UID " << loggerUID
2058 <<
", DAQInterface Hostname " << loggerHost <<
", and Subsystem "
2059 << loggerSubsystemID << __E__;
2060 info_.processes[ARTDAQAppType::DataLogger].emplace_back(
2065 ARTDAQAppType::DataLogger,
2066 datalogger.second.status());
2071 ARTDAQAppType::DataLogger,
2072 maxFragmentSizeBytes);
2074 flattenFHICL(ARTDAQAppType::DataLogger, datalogger.second.getValue());
2079 __COUT__ <<
"Data Logger " << loggerUID <<
" is disabled." << __E__;
2085 __COUT_WARN__ <<
"There were no Data Loggers found!";
2090 void ARTDAQTableBase::extractDispatchersInfo(
ConfigurationTree artdaqSupervisorNode,
2091 bool getStatusFalseNodes,
2093 size_t maxFragmentSizeBytes)
2095 __COUT__ <<
"Checking for Dispatchers..." << __E__;
2097 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToDispatchers_);
2100 std::vector<std::pair<std::string, ConfigurationTree>> dispatchers =
2103 for(
auto& dispatcher : dispatchers)
2105 const std::string& dispatcherUID = dispatcher.first;
2107 if(getStatusFalseNodes || dispatcher.second.status())
2109 std::string dispatcherHost =
2110 dispatcher.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2111 .getValueWithDefault(
"localhost");
2112 std::string dispatcherAP =
2114 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2115 .getValueWithDefault(
"");
2116 int dispatcherPort =
2117 dispatcher.second.getNode(
"DispatcherPort").getValue<
int>();
2119 auto dispatcherSubsystemID = 1;
2121 dispatcher.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2124 dispatcherSubsystemID = getSubsytemId(dispatcherSubsystemLink);
2126 info_.subsystems[dispatcherSubsystemID].id = dispatcherSubsystemID;
2128 const std::string& dispatcherSubsystemName =
2132 info_.subsystems[dispatcherSubsystemID].label =
2133 dispatcherSubsystemName;
2135 auto dispatcherSubsystemDestinationLink =
2136 dispatcherSubsystemLink.
getNode(
2137 colARTDAQSubsystem_.colLinkToDestination_);
2138 if(dispatcherSubsystemDestinationLink.isDisconnected())
2141 info_.subsystems[dispatcherSubsystemID].destination = 0;
2146 info_.subsystems[dispatcherSubsystemID].destination =
2147 getSubsytemId(dispatcherSubsystemDestinationLink);
2153 if(!info_.subsystems.count(
2154 info_.subsystems[dispatcherSubsystemID].destination) ||
2156 .subsystems[info_.subsystems[dispatcherSubsystemID]
2158 .sources.count(dispatcherSubsystemID))
2161 .subsystems[info_.subsystems[dispatcherSubsystemID]
2163 .sources.insert(dispatcherSubsystemID);
2167 __COUT__ <<
"Found Dispatcher with UID " << dispatcherUID
2168 <<
", DAQInterface Hostname " << dispatcherHost
2169 <<
", and Subsystem " << dispatcherSubsystemID << __E__;
2170 info_.processes[ARTDAQAppType::Dispatcher].emplace_back(
2174 dispatcherSubsystemID,
2175 ARTDAQAppType::Dispatcher,
2176 dispatcher.second.status(),
2182 ARTDAQAppType::Dispatcher,
2183 maxFragmentSizeBytes);
2185 flattenFHICL(ARTDAQAppType::Dispatcher, dispatcher.second.getValue());
2190 __COUT__ <<
"Dispatcher " << dispatcherUID <<
" is disabled." << __E__;
2196 __COUT_WARN__ <<
"There were no Dispatchers found!";
2206 for(
auto context : contexts)
2208 if(!context.second.isEnabled())
2211 auto apps = context.second
2212 .getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
2214 for(
auto app : apps)
2217 if(app.second.getNode(XDAQContextTable::colApplication_.colClass_)
2218 .getValue() == ARTDAQ_SUPERVISOR_CLASS &&
2219 app.second.isEnabled())
2237 std::map<std::string ,
2238 std::map<std::string , std::vector<std::string /*property*/>>>&
2239 nodeTypeToObjectMap,
2240 std::map<std::string /*subsystemName*/, std::string /*destinationSubsystemName*/>&
2242 std::vector<std::string /*property*/>& artdaqSupervisoInfo)
2244 __COUT__ <<
"getARTDAQSystem()" << __E__;
2246 artdaqSupervisoInfo.clear();
2257 return ARTDAQTableBase::info_;
2259 __COUTV__(artdaqContext->contextUID_);
2260 __COUTV__(artdaqContext->applications_.size());
2262 for(
auto& artdaqApp : artdaqContext->applications_)
2264 if(artdaqApp.class_ != ARTDAQ_SUPERVISOR_CLASS)
2267 __COUTV__(artdaqApp.applicationUID_);
2268 artdaqSupervisoInfo.push_back(artdaqApp.applicationUID_);
2269 artdaqSupervisoInfo.push_back(
2270 (artdaqContext->status_ && artdaqApp.status_) ?
"1" :
"0");
2271 artdaqSupervisoInfo.push_back(artdaqContext->address_);
2272 artdaqSupervisoInfo.push_back(std::to_string(artdaqContext->port_));
2275 XDAQContextTable::getSupervisorConfigNode(
2277 artdaqContext->contextUID_,
2278 artdaqApp.applicationUID_),
2281 __COUT__ <<
"========== "
2282 <<
"Found " << info.subsystems.size() <<
" subsystems." << __E__;
2285 for(
auto& subsystem : info.subsystems)
2286 subsystemObjectMap.emplace(std::make_pair(
2287 subsystem.second.label, std::to_string(subsystem.second.destination)));
2289 __COUT__ <<
"========== "
2290 <<
"Found " << info.processes.size() <<
" process types." << __E__;
2294 const std::string& typeString = nameTypePair.first;
2295 __COUTV__(typeString);
2297 nodeTypeToObjectMap.emplace(
2298 std::make_pair(typeString,
2299 std::map<std::string ,
2300 std::vector<std::string /*property*/>>()));
2302 auto it = info.processes.find(nameTypePair.second);
2303 if(it == info.processes.end())
2306 <<
"Found 0 " << typeString << __E__;
2310 <<
"Found " << it->second.size() <<
" " << typeString <<
"(s)"
2316 __SS__ <<
"Invalid artdaq node type '" << typeString <<
"' attempted!"
2320 __COUTV__(tableIt->second);
2324 std::set<std::string >
2327 const std::set<std::string > skipColumns(
2328 {ARTDAQ_TYPE_TABLE_HOSTNAME,
2329 ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS,
2330 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK,
2331 TableViewColumnInfo::COL_NAME_COMMENT,
2332 TableViewColumnInfo::COL_NAME_AUTHOR,
2333 TableViewColumnInfo::
2334 COL_NAME_CREATION});
2337 for(
auto& artdaqNode : it->second)
2340 if(skipSet.find(StringMacros::encodeURIComponent(artdaqNode.label)) !=
2345 <<
"Found '" << artdaqNode.label <<
"' " << typeString << __E__;
2347 std::string nodeName = artdaqNode.label;
2348 bool status = artdaqNode.status;
2349 std::string hostname = artdaqNode.hostname;
2350 std::string subsystemId = std::to_string(artdaqNode.subsystem);
2351 std::string subsystemName =
2352 info.subsystems.at(artdaqNode.subsystem).label;
2362 std::vector<std::string> multiNodeNames, hostnameArray;
2365 __COUTV__(allNodes.size());
2366 for(
auto& otherNode : allNodes)
2368 if(otherNode.first == nodeName ||
2369 skipSet.find(StringMacros::encodeURIComponent(otherNode.first)) !=
2371 otherNode.second.status() != status)
2378 otherNode.second.getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID)
2387 auto otherNodeColumns = otherNode.second.getChildren();
2389 bool isMultiNode =
true;
2390 for(
unsigned int i = 0;
2391 i < thisNodeColumns.size() && i < otherNodeColumns.size();
2395 if(skipColumns.find(thisNodeColumns[i].first) !=
2396 skipColumns.end() ||
2397 thisNodeColumns[i].second.isLinkNode())
2408 if(thisNodeColumns[i].second.getValue() !=
2409 otherNodeColumns[i].second.getValue())
2411 __COUT__ <<
"Mismatch, not multi-node member." << __E__;
2412 isMultiNode =
false;
2419 __COUT__ <<
"Found '" << nodeName
2420 <<
"' multi-node member candidate '"
2421 << otherNode.first <<
"'" << __E__;
2424 if(!multiNodeNames.size())
2426 multiNodeNames.push_back(
2427 StringMacros::encodeURIComponent(nodeName));
2428 hostnameArray.push_back(
2429 StringMacros::encodeURIComponent(hostname));
2431 multiNodeNames.push_back(
2432 StringMacros::encodeURIComponent(otherNode.first));
2433 hostnameArray.push_back(StringMacros::encodeURIComponent(
2434 otherNode.second.getNode(ARTDAQ_TYPE_TABLE_HOSTNAME)
2437 __COUTV__(hostnameArray.back());
2439 StringMacros::encodeURIComponent(otherNode.first));
2444 unsigned int nodeFixedWildcardLength = 0, hostFixedWildcardLength = 0;
2445 std::string multiNodeString =
"", hostArrayString =
"";
2447 if(multiNodeNames.size() > 1)
2449 __COUT__ <<
"Handling multi-node printer syntax" << __E__;
2457 unsigned int maxScore = 0;
2459 unsigned int minScore = -1;
2460 std::vector<unsigned int> scoreVector;
2461 scoreVector.push_back(-1);
2462 for(
unsigned int i = 1; i < multiNodeNames.size(); ++i)
2469 for(
unsigned int j = 0, k = 0; j < multiNodeNames[0].size() &&
2470 k < multiNodeNames[i].size();
2473 while(j < multiNodeNames[0].size() &&
2474 !(multiNodeNames[0][j] >=
'a' &&
2475 multiNodeNames[0][j] <=
'z') &&
2476 !(multiNodeNames[0][j] >=
'A' &&
2477 multiNodeNames[0][j] <=
'Z'))
2479 while(k < multiNodeNames[i].size() &&
2480 !(multiNodeNames[i][k] >=
'a' &&
2481 multiNodeNames[i][k] <=
'z') &&
2482 !(multiNodeNames[i][k] >=
'A' &&
2483 multiNodeNames[i][k] <=
'Z'))
2486 while(k < multiNodeNames[i].size() &&
2487 multiNodeNames[0][j] != multiNodeNames[i][k])
2494 if(j < multiNodeNames[0].size() &&
2495 k < multiNodeNames[i].size())
2502 for(
unsigned int j = multiNodeNames[0].size() - 1,
2503 k = multiNodeNames[i].size() - 1;
2504 j < multiNodeNames[0].size() &&
2505 k < multiNodeNames[i].size();
2508 while(j < multiNodeNames[0].size() &&
2509 !(multiNodeNames[0][j] >=
'a' &&
2510 multiNodeNames[0][j] <=
'z') &&
2511 !(multiNodeNames[0][j] >=
'A' &&
2512 multiNodeNames[0][j] <=
'Z'))
2514 while(k < multiNodeNames[i].size() &&
2515 !(multiNodeNames[i][k] >=
'a' &&
2516 multiNodeNames[i][k] <=
'z') &&
2517 !(multiNodeNames[i][k] >=
'A' &&
2518 multiNodeNames[i][k] <=
'Z'))
2521 while(k < multiNodeNames[i].size() &&
2522 multiNodeNames[0][j] != multiNodeNames[i][k])
2529 if(j < multiNodeNames[0].size() &&
2530 k < multiNodeNames[i].size())
2536 scoreVector.push_back(score);
2538 if(score > maxScore)
2543 if(score < minScore)
2553 __COUT__ <<
"Trimming multi-node members with low match score..."
2558 for(
unsigned int i = multiNodeNames.size() - 1;
2559 i > 0 && i < multiNodeNames.size();
2564 if(maxScore > multiNodeNames[0].size() &&
2565 scoreVector[i] >= maxScore)
2569 __COUT__ <<
"Trimming " << multiNodeNames[i] << __E__;
2571 skipSet.erase(multiNodeNames[i]);
2572 multiNodeNames.erase(multiNodeNames.begin() + i);
2573 hostnameArray.erase(hostnameArray.begin() + i);
2584 if(multiNodeNames.size() > 1)
2586 std::vector<std::string> commonChunks;
2587 std::vector<std::string> wildcards;
2591 bool wildcardsNeeded =
2595 nodeFixedWildcardLength);
2597 if(!wildcardsNeeded || wildcards.size() != multiNodeNames.size())
2600 <<
"Impossible extractCommonChunks result! Please notify "
2601 "admins or try to simplify record naming convention."
2610 for(
auto& commonChunk : commonChunks)
2612 nodeName += (!first ?
"*" :
"") + commonChunk;
2616 if(commonChunks.size() == 1)
2619 __COUTV__(nodeName);
2626 bool allIntegers =
true;
2627 for(
auto& wildcard : wildcards)
2630 else if(wildcard.size() == 0)
2632 allIntegers =
false;
2636 for(
unsigned int i = 0; i < wildcard.size(); ++i)
2637 if(!(wildcard[i] >=
'0' && wildcard[i] <=
'9'))
2639 allIntegers =
false;
2643 __COUTV__(allIntegers);
2649 std::vector<unsigned int> intWildcards;
2650 for(
auto& wildcard : wildcards)
2651 intWildcards.push_back(strtol(wildcard.c_str(), 0, 10));
2655 unsigned int hyphenLo = -1;
2656 bool isFirst =
true;
2657 for(
unsigned int i = 0; i < intWildcards.size(); ++i)
2659 if(i + 1 < intWildcards.size() &&
2660 intWildcards[i] + 1 == intWildcards[i + 1])
2672 (isFirst ?
"" :
",") +
2673 std::to_string(intWildcards[i]);
2678 if(intWildcards[hyphenLo] + 1 == intWildcards[i])
2680 (isFirst ?
"" :
",") +
2681 std::to_string(intWildcards[hyphenLo]) +
2682 "," + std::to_string(intWildcards[i]);
2685 (isFirst ?
"" :
",") +
2686 std::to_string(intWildcards[hyphenLo]) +
2687 "-" + std::to_string(intWildcards[i]);
2699 __COUTV__(multiNodeString);
2700 __COUTV__(nodeFixedWildcardLength);
2703 if(hostnameArray.size() > 1)
2705 std::vector<std::string> commonChunks;
2706 std::vector<std::string> wildcards;
2710 bool wildcardsNeeded =
2714 hostFixedWildcardLength);
2716 __COUTV__(wildcardsNeeded);
2721 for(
auto& commonChunk : commonChunks)
2723 hostname += (!first ?
"*" :
"") + commonChunk;
2727 if(wildcardsNeeded && commonChunks.size() == 1)
2730 __COUTV__(hostname);
2740 bool allIntegers =
true;
2741 for(
auto& wildcard : wildcards)
2742 for(
unsigned int i = 0; i < wildcard.size(); ++i)
2743 if(!(wildcard[i] >=
'0' && wildcard[i] <=
'9'))
2745 allIntegers =
false;
2749 __COUTV__(allIntegers);
2756 std::vector<unsigned int> intWildcards;
2757 for(
auto& wildcard : wildcards)
2758 intWildcards.push_back(
2759 strtol(wildcard.c_str(), 0, 10));
2763 unsigned int hyphenLo = -1;
2764 bool isFirst =
true;
2765 for(
unsigned int i = 0; i < intWildcards.size(); ++i)
2767 if(i + 1 < intWildcards.size() &&
2768 intWildcards[i] + 1 == intWildcards[i + 1])
2780 (isFirst ?
"" :
",") +
2781 std::to_string(intWildcards[i]);
2786 if(intWildcards[hyphenLo] + 1 ==
2789 (isFirst ?
"" :
",") +
2791 intWildcards[hyphenLo]) +
2792 "," + std::to_string(intWildcards[i]);
2795 (isFirst ?
"" :
",") +
2797 intWildcards[hyphenLo]) +
2798 "-" + std::to_string(intWildcards[i]);
2810 __COUTV__(hostArrayString);
2811 __COUTV__(hostFixedWildcardLength);
2816 nodeTypeToObjectMap.at(typeString)
2817 .emplace(std::make_pair(nodeName,
2818 std::vector<std::string /*property*/>()));
2820 nodeTypeToObjectMap.at(typeString)
2822 .push_back(status ?
"1" :
"0");
2824 nodeTypeToObjectMap.at(typeString).at(nodeName).push_back(hostname);
2826 nodeTypeToObjectMap.at(typeString).at(nodeName).push_back(subsystemId);
2827 if(multiNodeNames.size() > 1)
2829 nodeTypeToObjectMap.at(typeString)
2831 .push_back(multiNodeString);
2833 nodeTypeToObjectMap.at(typeString)
2835 .push_back(std::to_string(nodeFixedWildcardLength));
2837 if(hostnameArray.size() > 1)
2839 nodeTypeToObjectMap.at(typeString)
2841 .push_back(hostArrayString);
2843 nodeTypeToObjectMap.at(typeString)
2845 .push_back(std::to_string(hostFixedWildcardLength));
2853 __COUT__ <<
"Done getting artdaq nodes." << __E__;
2855 return ARTDAQTableBase::info_;
2869 const std::map<std::string ,
2870 std::map<std::string ,
2871 std::vector<std::string /*property*/>>>& nodeTypeToObjectMap,
2872 const std::map<std::string ,
2873 std::string >& subsystemObjectMap)
2875 __COUT__ <<
"setAndActivateARTDAQSystem()" << __E__;
2877 const std::string& author = cfgMgr->
getUsername();
2888 GroupEditStruct configGroupEdit(ConfigurationManager::GroupType::CONFIGURATION_TYPE,
2891 unsigned int artdaqSupervisorRow = TableView::INVALID;
2898 bool needArtdaqSupervisorParents =
true;
2899 bool needArtdaqSupervisorCreation =
false;
2906 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
2907 .
getNode(artdaqContext->contextUID_)
2908 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
2909 .
getNode(artdaqContext->applications_[0].applicationUID_)
2910 .
getNode(XDAQContextTable::colApplication_.colLinkToSupervisorTable_);
2913 needArtdaqSupervisorCreation =
true;
2915 artdaqSupervisorRow = artdaqSupervisorNode.
getRow();
2917 needArtdaqSupervisorParents =
false;
2921 needArtdaqSupervisorCreation =
true;
2925 if(!artdaqContext || needArtdaqSupervisorCreation)
2927 __COUT__ <<
"No artdaq Supervisor found! Creating..." << __E__;
2928 __COUTV__(needArtdaqSupervisorParents);
2930 std::string artdaqSupervisorUID;
2939 ARTDAQ_SUPERVISOR_TABLE,
true );
2942 row = artdaqSupervisorTable.tableView_->
addRow(
2943 author,
true ,
"artdaqSupervisor");
2946 artdaqSupervisorUID =
2947 artdaqSupervisorTable.tableView_
2948 ->getDataView()[row][artdaqSupervisorTable.tableView_->
getColUID()];
2949 artdaqSupervisorRow = row;
2951 __COUTV__(artdaqSupervisorRow);
2952 __COUTV__(artdaqSupervisorUID);
2958 artdaqSupervisorTable.tableView_->
findCol(
2959 colARTDAQSupervisor_.colDAQInterfaceDebugLevel_));
2962 "${MRB_BUILDDIR}/../setup_ots.sh",
2964 artdaqSupervisorTable.tableView_->
findCol(
2965 colARTDAQSupervisor_.colDAQSetupScript_));
2969 ARTDAQ_READER_TABLE,
2971 artdaqSupervisorTable.tableView_->
findCol(
2972 colARTDAQSupervisor_.colLinkToBoardReaders_));
2976 artdaqSupervisorTable.tableView_->
findCol(
2977 colARTDAQSupervisor_.colLinkToBoardReadersGroupID_),
2978 artdaqSupervisorUID +
2982 ARTDAQ_BUILDER_TABLE,
2984 artdaqSupervisorTable.tableView_->
findCol(
2985 colARTDAQSupervisor_.colLinkToEventBuilders_));
2988 artdaqSupervisorTable.tableView_->
findCol(
2989 colARTDAQSupervisor_.colLinkToEventBuildersGroupID_),
2990 artdaqSupervisorUID +
2994 ARTDAQ_LOGGER_TABLE,
2996 artdaqSupervisorTable.tableView_->
findCol(
2997 colARTDAQSupervisor_.colLinkToDataLoggers_));
3000 artdaqSupervisorTable.tableView_->
findCol(
3001 colARTDAQSupervisor_.colLinkToDataLoggersGroupID_),
3002 artdaqSupervisorUID +
3006 ARTDAQ_DISPATCHER_TABLE,
3008 artdaqSupervisorTable.tableView_->
findCol(
3009 colARTDAQSupervisor_.colLinkToDispatchers_));
3012 artdaqSupervisorTable.tableView_->
findCol(
3013 colARTDAQSupervisor_.colLinkToDispatchersGroupID_),
3014 artdaqSupervisorUID +
3019 ARTDAQ_ROUTER_TABLE,
3021 artdaqSupervisorTable.tableView_->
findCol(
3022 colARTDAQSupervisor_.colLinkToRoutingManagers_));
3025 artdaqSupervisorTable.tableView_->
findCol(
3026 colARTDAQSupervisor_.colLinkToRoutingManagersGroupID_),
3027 artdaqSupervisorUID +
3031 std::stringstream ss;
3032 artdaqSupervisorTable.tableView_->print(ss);
3033 __COUT__ << ss.str();
3040 ConfigurationManager::GroupType::CONTEXT_TYPE, cfgMgr);
3043 ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME,
true );
3045 ConfigurationManager::XDAQ_APPLICATION_TABLE_NAME,
true );
3047 ConfigurationManager::XDAQ_APP_PROPERTY_TABLE_NAME,
3053 std::string contextUID;
3054 std::string contextAppGroupID;
3056 if(needArtdaqSupervisorParents)
3059 row = contextTable.tableView_->
addRow(
3060 author,
true ,
"artdaqContext");
3066 contextTable.tableView_
3067 ->getDataView()[row][contextTable.tableView_->
getColUID()];
3070 __COUTV__(contextUID);
3074 "http://${HOSTNAME}",
3076 contextTable.tableView_->
findCol(
3077 XDAQContextTable::colContext_.colAddress_));
3080 contextTable.tableView_->
findCol(
3081 XDAQContextTable::colContext_.colPort_),
3087 ConfigurationManager::XDAQ_APPLICATION_TABLE_NAME,
3089 contextTable.tableView_->
findCol(
3090 XDAQContextTable::colContext_.colLinkToApplicationTable_));
3093 contextTable.tableView_->
findCol(
3094 XDAQContextTable::colContext_.colLinkToApplicationGroupID_),
3095 "artdaqContextApps");
3097 __COUTV__(contextAppGroupID);
3102 std::string appPropertiesGroupID;
3108 if(needArtdaqSupervisorParents)
3112 unsigned int c = appTable.tableView_->
findCol(
3113 XDAQContextTable::colApplication_.colClass_);
3114 for(
unsigned int r = 0;
3115 r < appTable.tableView_->getNumberOfRows();
3117 if(appTable.tableView_->getDataView()[r][c] ==
3118 ARTDAQ_SUPERVISOR_CLASS)
3121 <<
"Found partially existing artdaq Supervisor "
3123 << appTable.tableView_->getDataView()
3125 <<
"'... Disabling it." << __E__;
3132 row = appTable.tableView_->
addRow(
3133 author,
true ,
"artdaqSupervisor");
3140 ->getDataView()[row][appTable.tableView_->
getColUID()];
3147 ARTDAQ_SUPERVISOR_CLASS,
3150 XDAQContextTable::colApplication_.colClass_));
3153 "${OTSDAQ_LIB}/libARTDAQSupervisor.so",
3156 XDAQContextTable::colApplication_.colModule_));
3161 appTable.tableView_->
findCol(XDAQContextTable::colApplication_
3162 .colApplicationGroupID_));
3166 ConfigurationManager::XDAQ_APP_PROPERTY_TABLE_NAME,
3168 appTable.tableView_->
findCol(XDAQContextTable::colApplication_
3169 .colLinkToPropertyTable_));
3172 appTable.tableView_->
findCol(XDAQContextTable::colApplication_
3173 .colLinkToPropertyGroupID_),
3174 appUID +
"Properties");
3176 __COUTV__(appPropertiesGroupID);
3180 __COUT__ <<
"Getting row of existing parent supervisor." << __E__;
3184 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
3185 .
getNode(artdaqContext->contextUID_)
3186 .
getNode(XDAQContextTable::colContext_
3187 .colLinkToApplicationTable_)
3188 .
getNode(artdaqContext->applications_[0].applicationUID_)
3197 ARTDAQ_SUPERVISOR_TABLE,
3200 XDAQContextTable::colApplication_.colLinkToSupervisorTable_));
3202 artdaqSupervisorUID,
3205 XDAQContextTable::colApplication_.colLinkToSupervisorUID_));
3210 if(needArtdaqSupervisorParents)
3214 const std::vector<std::string> propertyUIDs = {
"Partition0",
3217 "BoardReaderTimeout",
3218 "EventBuilderTimeout",
3219 "DataLoggerTimeout",
3220 "DispatcherTimeout"};
3221 const std::vector<std::string> propertyNames = {
3223 "productsdir_for_bash_scripts",
3224 "max_fragment_size_bytes",
3225 "boardreader_timeout",
3226 "eventbuilder_timeout",
3227 "datalogger_timeout",
3228 "dispatcher_timeout"
3230 const std::vector<std::string> propertyValues = {
3240 for(
unsigned int i = 0; i < propertyNames.size(); ++i)
3243 row = appPropertyTable.tableView_->
addRow(
3246 appUID + propertyUIDs[i]);
3249 "1", row, appPropertyTable.tableView_->
getColStatus());
3253 "ots::SupervisorProperty",
3255 appPropertyTable.tableView_->
findCol(
3256 XDAQContextTable::colAppProperty_.colPropertyType_));
3261 appPropertyTable.tableView_->
findCol(
3262 XDAQContextTable::colAppProperty_.colPropertyName_));
3267 appPropertyTable.tableView_->
findCol(
3268 XDAQContextTable::colAppProperty_.colPropertyValue_));
3271 appPropertiesGroupID,
3273 appPropertyTable.tableView_->
findCol(
3274 XDAQContextTable::colAppProperty_.colPropertyGroupID_));
3279 std::stringstream ss;
3280 contextTable.tableView_->print(ss);
3281 __COUT__ << ss.str();
3284 std::stringstream ss;
3285 appTable.tableView_->print(ss);
3286 __COUT__ << ss.str();
3289 std::stringstream ss;
3290 appPropertyTable.tableView_->print(ss);
3291 __COUT__ << ss.str();
3294 contextTable.tableView_
3296 appTable.tableView_->
init();
3297 appPropertyTable.tableView_
3303 <<
"Table errors while creating ARTDAQ Supervisor. Erasing all newly "
3304 "created table versions."
3309 __COUT__ <<
"Edits complete for new artdaq Supervisor!" << __E__;
3312 contextGroupEdit.saveChanges(contextGroupEdit.originalGroupName_,
3324 artdaqSupervisorRow =
3325 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
3326 .
getNode(artdaqContext->contextUID_)
3327 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
3328 .
getNode(artdaqContext->applications_[0].applicationUID_)
3329 .
getNode(XDAQContextTable::colApplication_.colLinkToSupervisorTable_)
3333 __COUT__ <<
"------------------------- artdaq nodes to save:" << __E__;
3334 for(
auto& subsystemPair : subsystemObjectMap)
3336 __COUTV__(subsystemPair.first);
3340 for(
auto& nodeTypePair : nodeTypeToObjectMap)
3342 __COUTV__(nodeTypePair.first);
3344 for(
auto& nodePair : nodeTypePair.second)
3346 __COUTV__(nodePair.first);
3350 __COUT__ <<
"------------------------- end artdaq nodes to save." << __E__;
3354 __COUTV__(artdaqSupervisorRow);
3355 if(artdaqSupervisorRow >= TableView::INVALID)
3357 __SS__ <<
"Invalid artdaq Supervisor row " << artdaqSupervisorRow <<
" found!"
3372 ARTDAQ_SUPERVISOR_TABLE,
true );
3376 std::string artdaqSupervisorUID =
3377 artdaqSupervisorTable.tableView_
3378 ->getDataView()[artdaqSupervisorRow]
3379 [artdaqSupervisorTable.tableView_->
getColUID()];
3382 if(artdaqSupervisorTable.tableView_
3383 ->getDataView()[artdaqSupervisorRow]
3384 [artdaqSupervisorTable.tableView_->
findCol(
3385 colARTDAQSupervisor_.colLinkToBoardReaders_)] ==
3386 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
3388 __COUT__ <<
"Fixing missing link to Readers" << __E__;
3390 ARTDAQ_READER_TABLE,
3391 artdaqSupervisorRow,
3392 artdaqSupervisorTable.tableView_->
findCol(
3393 colARTDAQSupervisor_.colLinkToBoardReaders_));
3395 artdaqSupervisorRow,
3396 artdaqSupervisorTable.tableView_->
findCol(
3397 colARTDAQSupervisor_.colLinkToBoardReadersGroupID_),
3398 artdaqSupervisorUID +
3403 if(artdaqSupervisorTable.tableView_
3404 ->getDataView()[artdaqSupervisorRow]
3405 [artdaqSupervisorTable.tableView_->
findCol(
3406 colARTDAQSupervisor_.colLinkToEventBuilders_)] ==
3407 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
3409 __COUT__ <<
"Fixing missing link to Builders" << __E__;
3411 ARTDAQ_BUILDER_TABLE,
3412 artdaqSupervisorRow,
3413 artdaqSupervisorTable.tableView_->
findCol(
3414 colARTDAQSupervisor_.colLinkToEventBuilders_));
3416 artdaqSupervisorRow,
3417 artdaqSupervisorTable.tableView_->
findCol(
3418 colARTDAQSupervisor_.colLinkToEventBuildersGroupID_),
3419 artdaqSupervisorUID +
3424 if(artdaqSupervisorTable.tableView_
3425 ->getDataView()[artdaqSupervisorRow]
3426 [artdaqSupervisorTable.tableView_->
findCol(
3427 colARTDAQSupervisor_.colLinkToDataLoggers_)] ==
3428 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
3430 __COUT__ <<
"Fixing missing link to Loggers" << __E__;
3432 ARTDAQ_LOGGER_TABLE,
3433 artdaqSupervisorRow,
3434 artdaqSupervisorTable.tableView_->
findCol(
3435 colARTDAQSupervisor_.colLinkToDataLoggers_));
3437 artdaqSupervisorRow,
3438 artdaqSupervisorTable.tableView_->
findCol(
3439 colARTDAQSupervisor_.colLinkToDataLoggersGroupID_),
3440 artdaqSupervisorUID +
3445 if(artdaqSupervisorTable.tableView_
3446 ->getDataView()[artdaqSupervisorRow]
3447 [artdaqSupervisorTable.tableView_->
findCol(
3448 colARTDAQSupervisor_.colLinkToDispatchers_)] ==
3449 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
3451 __COUT__ <<
"Fixing missing link to Dispatchers" << __E__;
3453 ARTDAQ_DISPATCHER_TABLE,
3454 artdaqSupervisorRow,
3455 artdaqSupervisorTable.tableView_->
findCol(
3456 colARTDAQSupervisor_.colLinkToDispatchers_));
3458 artdaqSupervisorRow,
3459 artdaqSupervisorTable.tableView_->
findCol(
3460 colARTDAQSupervisor_.colLinkToDispatchersGroupID_),
3461 artdaqSupervisorUID +
3466 if(artdaqSupervisorTable.tableView_
3467 ->getDataView()[artdaqSupervisorRow]
3468 [artdaqSupervisorTable.tableView_->
findCol(
3469 colARTDAQSupervisor_.colLinkToRoutingManagers_)] ==
3470 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
3472 __COUT__ <<
"Fixing missing link to Routers" << __E__;
3474 ARTDAQ_ROUTER_TABLE,
3475 artdaqSupervisorRow,
3476 artdaqSupervisorTable.tableView_->
findCol(
3477 colARTDAQSupervisor_.colLinkToRoutingManagers_));
3479 artdaqSupervisorRow,
3480 artdaqSupervisorTable.tableView_->
findCol(
3481 colARTDAQSupervisor_.colLinkToRoutingManagersGroupID_),
3482 artdaqSupervisorUID +
3487 std::stringstream ss;
3488 artdaqSupervisorTable.tableView_->print(ss);
3489 __COUT__ << ss.str();
3495 ARTDAQ_SUBSYSTEM_TABLE,
true );
3498 artdaqSubsystemTable.tableView_->deleteAllRows();
3500 for(
auto& subsystemPair : subsystemObjectMap)
3502 __COUTV__(subsystemPair.first);
3503 __COUTV__(subsystemPair.second);
3506 row = artdaqSubsystemTable.tableView_->
addRow(
3507 author,
true , subsystemPair.first);
3509 if(subsystemPair.second !=
"" &&
3510 subsystemPair.second != TableViewColumnInfo::DATATYPE_STRING_DEFAULT &&
3511 subsystemPair.second != NULL_SUBSYSTEM_DESTINATION_LABEL)
3515 ARTDAQ_SUBSYSTEM_TABLE,
3517 artdaqSubsystemTable.tableView_->
findCol(
3518 colARTDAQSubsystem_.colLinkToDestination_));
3520 subsystemPair.second,
3522 artdaqSubsystemTable.tableView_->
findCol(
3523 colARTDAQSubsystem_.colLinkToDestinationUID_));
3530 for(
auto& nodeTypePair : nodeTypeToObjectMap)
3532 __COUTV__(nodeTypePair.first);
3536 auto it =
processTypes_.mapToTable_.find(nodeTypePair.first);
3539 __SS__ <<
"Invalid artdaq node type '" << nodeTypePair.first
3540 <<
"' attempted!" << __E__;
3543 __COUTV__(it->second);
3553 if(nodeTypePair.second.size())
3556 __COUT__ <<
"Ignoring missing table '" << it->second
3557 <<
"' since there were no user records attempted of type '"
3558 << nodeTypePair.first <<
".'" << __E__;
3565 std::map<
unsigned int ,
bool > deleteRecordMap;
3566 for(
unsigned int r = 0; r < typeTable.tableView_->getNumberOfRows(); ++r)
3567 deleteRecordMap.emplace(std::make_pair(
3572 for(
auto& nodePair : nodeTypePair.second)
3574 __COUTV__(nodePair.first);
3577 std::vector<std::string> nodeIndices, hostnameIndices;
3578 unsigned int hostnameFixedWidth = 0, nodeNameFixedWidth = 0;
3579 std::string hostname;
3583 std::map<std::string ,
3584 std::map<
unsigned int , std::string >>
3585 originalMultinodeValues;
3592 for(
unsigned int i = 0; i < nodePair.second.size(); ++i)
3594 __COUTV__(nodePair.second[i]);
3598 std::string nodeName;
3604 if(nodePair.second[i][0] ==
':')
3606 __COUT__ <<
"Handling original multi-node." << __E__;
3611 std::vector<std::string> originalParameterArr =
3613 &(nodePair.second[i].c_str()[1]),
3616 if(originalParameterArr.size() != 3)
3618 __SS__ <<
"Illegal original name parameter string '"
3619 << nodePair.second[i] <<
"!'" << __E__;
3623 unsigned int fixedWidth;
3624 sscanf(originalParameterArr[0].c_str(),
"%u", &fixedWidth);
3625 __COUTV__(fixedWidth);
3627 std::vector<std::string> printerSyntaxArr =
3632 std::vector<std::string> originalNodeIndices;
3633 for(
auto& printerSyntaxValue : printerSyntaxArr)
3635 __COUTV__(printerSyntaxValue);
3637 std::vector<std::string> printerSyntaxRange =
3639 printerSyntaxValue, {
'-'} );
3641 if(printerSyntaxRange.size() == 0 ||
3642 printerSyntaxRange.size() > 2)
3644 __SS__ <<
"Illegal multi-node printer syntax string '"
3645 << printerSyntaxValue <<
"!'" << __E__;
3648 else if(printerSyntaxRange.size() == 1)
3650 __COUTV__(printerSyntaxRange[0]);
3651 originalNodeIndices.push_back(printerSyntaxRange[0]);
3655 unsigned int lo, hi;
3656 sscanf(printerSyntaxRange[0].c_str(),
"%u", &lo);
3657 sscanf(printerSyntaxRange[1].c_str(),
"%u", &hi);
3661 sscanf(printerSyntaxRange[0].c_str(),
"%u", &hi);
3663 for(; lo <= hi; ++lo)
3666 originalNodeIndices.push_back(std::to_string(lo));
3671 std::vector<std::string> originalNamePieces =
3676 if(originalNamePieces.size() < 2)
3678 __SS__ <<
"Illegal original multi-node name template - "
3679 "please use * to indicate where the multi-node "
3680 "index should be inserted!"
3686 unsigned int originalRow = TableView::INVALID,
3687 lastOriginalRow = TableView::INVALID;
3688 for(
unsigned int i = 0; i < originalNodeIndices.size(); ++i)
3690 std::string originalName = originalNamePieces[0];
3691 std::string nodeNameIndex;
3692 for(
unsigned int p = 1; p < originalNamePieces.size();
3695 nodeNameIndex = originalNodeIndices[i];
3698 if(nodeNameIndex.size() > fixedWidth)
3700 __SS__ <<
"Illegal original node name index '"
3702 <<
"' - length is longer than fixed "
3703 "width requirement of "
3704 << fixedWidth <<
"!" << __E__;
3709 while(nodeNameIndex.size() < fixedWidth)
3710 nodeNameIndex =
"0" + nodeNameIndex;
3713 originalName += nodeNameIndex + originalNamePieces[p];
3715 __COUTV__(originalName);
3716 originalRow = typeTable.tableView_->
findRow(
3721 __COUTV__(originalRow);
3724 if(originalRow != TableView::INVALID &&
3725 lastOriginalRow != TableView::INVALID)
3728 originalMultinodeValues.emplace(std::make_pair(
3730 std::map<
unsigned int ,
3733 __COUT__ <<
"Saving multinode value " << nodeName
3734 <<
"[" << lastOriginalRow
3735 <<
"][*] with row count = "
3736 << typeTable.tableView_->getNumberOfRows()
3740 for(
unsigned int col = 0;
3741 col < typeTable.tableView_->getNumberOfColumns();
3743 if(typeTable.tableView_->getColumnInfo(col)
3746 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK ||
3747 typeTable.tableView_->getColumnInfo(col)
3750 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID)
3752 else if(typeTable.tableView_->getColumnInfo(col)
3754 typeTable.tableView_->getColumnInfo(col)
3756 typeTable.tableView_->getColumnInfo(col)
3758 originalMultinodeValues.at(nodeName).emplace(
3761 typeTable.tableView_
3762 ->getDataView()[lastOriginalRow]
3765 typeTable.tableView_->
deleteRow(lastOriginalRow);
3766 if(originalRow > lastOriginalRow)
3770 if(originalRow != TableView::INVALID)
3774 nodeName = originalName;
3779 row = lastOriginalRow;
3781 __COUTV__(nodeName);
3788 row = typeTable.tableView_->
findRow(
3795 nodeName = nodePair.first;
3798 __COUTV__(nodeName);
3799 if(row == TableView::INVALID)
3802 row = typeTable.tableView_->
addRow(
3803 author,
true , nodeName);
3808 __COUT__ <<
"Handling new " << nodeTypePair.first
3809 <<
" defaults!" << __E__;
3812 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
3817 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
3819 typeTable.tableView_->
findCol(
3820 ARTDAQTableBase::colARTDAQReader_
3821 .colLinkToDaqParameters_));
3822 std::string daqParameterGroupID =
3825 typeTable.tableView_->
findCol(
3826 ARTDAQTableBase::colARTDAQReader_
3827 .colLinkToDaqParametersGroupID_),
3828 nodeName +
"DaqParameters");
3830 typeTable.tableView_->print();
3833 const std::vector<std::string> parameterUIDs = {
3834 "BoardID",
"FragmentID"};
3836 const std::vector<std::string> parameterNames = {
3840 const std::vector<std::string> parameterValues = {
3845 unsigned int parameterRow;
3846 for(
unsigned int i = 0; i < parameterNames.size(); ++i)
3849 parameterRow = daqParameterTable.tableView_->
addRow(
3852 nodeName + parameterUIDs[i]);
3863 daqParameterTable.tableView_->
findCol(
3864 ARTDAQTableBase::colARTDAQDaqParameter_
3865 .colDaqParameterKey_));
3870 daqParameterTable.tableView_->
findCol(
3871 ARTDAQTableBase::colARTDAQDaqParameter_
3872 .colDaqParameterValue_));
3875 daqParameterGroupID,
3877 daqParameterTable.tableView_->
findCol(
3878 ARTDAQTableBase::colARTDAQDaqParameter_
3879 .colDaqParameterGroupID_));
3883 daqParameterTable.tableView_
3891 __COUT__ <<
"Handling new " << nodeTypePair.first
3892 <<
" defaults!" << __E__;
3897 ARTDAQTableBase::ARTDAQ_DAQ_TABLE,
3900 unsigned int daqRecordRow = daqTable.tableView_->
addRow(
3904 std::string daqRecordUID =
3906 ->getDataView()[daqRecordRow]
3911 ARTDAQTableBase::ARTDAQ_DAQ_TABLE,
3913 typeTable.tableView_->
findCol(
3914 ARTDAQTableBase::colARTDAQNotReader_
3919 typeTable.tableView_->
findCol(
3920 ARTDAQTableBase::colARTDAQNotReader_
3921 .colLinkToDaqUID_));
3925 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
3929 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
3932 ARTDAQTableBase::colARTDAQDaq_
3933 .colLinkToDaqParameters_));
3934 std::string daqParameterGroupID =
3938 ARTDAQTableBase::colARTDAQDaq_
3939 .colLinkToDaqParametersGroupID_),
3940 nodeName +
"DaqParameters");
3943 const std::vector<std::string> parameterUIDs = {
3944 "BufferCount",
"FragmentsPerEvent"};
3946 const std::vector<std::string> parameterNames = {
3948 "expected_fragments_per_event"
3950 const std::vector<std::string> parameterValues = {
3955 unsigned int parameterRow;
3956 for(
unsigned int i = 0; i < parameterNames.size(); ++i)
3959 parameterRow = daqParameterTable.tableView_->
addRow(
3962 nodeName + parameterUIDs[i]);
3973 daqParameterTable.tableView_->
findCol(
3974 ARTDAQTableBase::colARTDAQDaqParameter_
3975 .colDaqParameterKey_));
3980 daqParameterTable.tableView_->
findCol(
3981 ARTDAQTableBase::colARTDAQDaqParameter_
3982 .colDaqParameterValue_));
3985 daqParameterGroupID,
3987 daqParameterTable.tableView_->
findCol(
3988 ARTDAQTableBase::colARTDAQDaqParameter_
3989 .colDaqParameterGroupID_));
3995 daqParameterTable.tableView_
4003 nodeName, row, typeTable.tableView_->
getColUID());
4008 deleteRecordMap[row] =
false;
4015 artdaqSupervisorTable.tableView_
4016 ->getDataView()[artdaqSupervisorRow]
4017 [artdaqSupervisorTable.tableView_->
findCol(
4019 .at(nodeTypePair.first))],
4021 typeTable.tableView_->
findCol(
4023 nodeTypePair.first)));
4036 hostname = nodePair.second[i];
4040 typeTable.tableView_->
findCol(ARTDAQ_TYPE_TABLE_HOSTNAME));
4045 if(nodePair.second[i] !=
"" &&
4046 nodePair.second[i] !=
4047 TableViewColumnInfo::DATATYPE_STRING_DEFAULT)
4050 if(subsystemObjectMap.find(nodePair.second[i]) ==
4051 subsystemObjectMap.end())
4053 __SS__ <<
"Illegal subsystem '" << nodePair.second[i]
4054 <<
"' mismatch!" << __E__;
4059 ARTDAQ_SUBSYSTEM_TABLE,
4061 typeTable.tableView_->
findCol(
4062 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK));
4066 typeTable.tableView_->
findCol(
4067 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID));
4072 TableViewColumnInfo::DATATYPE_LINK_DEFAULT,
4074 typeTable.tableView_->
findCol(
4075 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK));
4079 i == 4 || i == 5 || i == 6 ||
4086 __COUT__ <<
"Handling printer syntax i=" << i << __E__;
4088 std::vector<std::string> printerSyntaxArr =
4092 if(printerSyntaxArr.size() == 2)
4094 if(printerSyntaxArr[0] ==
4097 sscanf(printerSyntaxArr[1].c_str(),
4099 &nodeNameFixedWidth);
4100 __COUTV__(nodeNameFixedWidth);
4103 else if(printerSyntaxArr[0] ==
4106 sscanf(printerSyntaxArr[1].c_str(),
4108 &hostnameFixedWidth);
4109 __COUTV__(hostnameFixedWidth);
4115 for(
auto& printerSyntaxValue : printerSyntaxArr)
4117 __COUTV__(printerSyntaxValue);
4119 std::vector<std::string> printerSyntaxRange =
4122 if(printerSyntaxRange.size() == 0 ||
4123 printerSyntaxRange.size() > 2)
4125 __SS__ <<
"Illegal multi-node printer syntax string '"
4126 << printerSyntaxValue <<
"!'" << __E__;
4129 else if(printerSyntaxRange.size() == 1)
4132 __COUTV__(printerSyntaxRange[0]);
4137 nodeIndices.push_back(printerSyntaxRange[0]);
4139 hostnameIndices.push_back(printerSyntaxRange[0]);
4143 unsigned int lo, hi;
4144 sscanf(printerSyntaxRange[0].c_str(),
"%u", &lo);
4145 sscanf(printerSyntaxRange[1].c_str(),
"%u", &hi);
4149 sscanf(printerSyntaxRange[0].c_str(),
"%u", &hi);
4151 for(; lo <= hi; ++lo)
4155 nodeIndices.push_back(std::to_string(lo));
4157 hostnameIndices.push_back(std::to_string(lo));
4164 __SS__ <<
"Unexpected parameter[" << i <<
" '"
4165 << nodePair.second[i] <<
"' for node " << nodePair.first
4171 __COUTV__(nodeIndices.size());
4172 __COUTV__(hostnameIndices.size());
4174 if(hostnameIndices.size())
4176 if(hostnameIndices.size() != nodeIndices.size())
4178 __SS__ <<
"Illegal associated hostname array has count "
4179 << hostnameIndices.size()
4180 <<
" which is not equal to the node count "
4181 << nodeIndices.size() <<
"!" << __E__;
4186 if(nodeIndices.size())
4188 unsigned int hostnameCol =
4189 typeTable.tableView_->
findCol(ARTDAQ_TYPE_TABLE_HOSTNAME);
4194 std::vector<std::string> namePieces =
4199 if(namePieces.size() < 2)
4202 <<
"Illegal multi-node name template - please use * to "
4203 "indicate where the multi-node index should be inserted!"
4208 std::vector<std::string> hostnamePieces;
4209 if(hostnameIndices.size())
4215 if(hostnamePieces.size() < 2)
4218 <<
"Illegal hostname array template - please use * to "
4219 "indicate where the hostname index should be inserted!"
4225 bool isFirst =
true;
4226 for(
unsigned int i = 0; i < nodeIndices.size(); ++i)
4228 std::string name = namePieces[0];
4229 std::string nodeNameIndex;
4230 for(
unsigned int p = 1; p < namePieces.size(); ++p)
4232 nodeNameIndex = nodeIndices[i];
4233 if(nodeNameFixedWidth > 1)
4235 if(nodeNameIndex.size() > nodeNameFixedWidth)
4237 __SS__ <<
"Illegal node name index '" << nodeNameIndex
4238 <<
"' - length is longer than fixed width "
4240 << nodeNameFixedWidth <<
"!" << __E__;
4245 while(nodeNameIndex.size() < nodeNameFixedWidth)
4246 nodeNameIndex =
"0" + nodeNameIndex;
4249 name += nodeNameIndex + namePieces[p];
4253 if(hostnamePieces.size())
4255 hostname = hostnamePieces[0];
4256 std::string hostnameIndex;
4257 for(
unsigned int p = 1; p < hostnamePieces.size(); ++p)
4259 hostnameIndex = hostnameIndices[i];
4260 if(hostnameFixedWidth > 1)
4262 if(hostnameIndex.size() > hostnameFixedWidth)
4264 __SS__ <<
"Illegal hostname index '"
4266 <<
"' - length is longer than fixed width "
4268 << hostnameFixedWidth <<
"!" << __E__;
4273 while(hostnameIndex.size() < hostnameFixedWidth)
4274 hostnameIndex =
"0" + hostnameIndex;
4277 hostname += hostnameIndex + hostnamePieces[p];
4279 __COUTV__(hostname);
4286 name, row, typeTable.tableView_->
getColUID());
4289 hostname, row, hostnameCol);
4292 deleteRecordMap[row] =
false;
4296 unsigned int copyRow = typeTable.tableView_->
copyRows(
4298 *(typeTable.tableView_),
4304 name, copyRow, typeTable.tableView_->
getColUID());
4306 hostname, copyRow, hostnameCol);
4309 if(originalMultinodeValues.find(name) !=
4310 originalMultinodeValues.end())
4312 for(
const auto& valuePair :
4313 originalMultinodeValues.at(name))
4315 __COUT__ <<
"Customizing node: " << name <<
"["
4316 << copyRow <<
"][" << valuePair.first
4317 <<
"] = " << valuePair.second << __E__;
4319 valuePair.second, copyRow, valuePair.first);
4324 deleteRecordMap[copyRow] =
false;
4333 __COUT__ <<
"Deleting '" << nodeTypePair.first
4334 <<
"' records not specified..." << __E__;
4337 std::set<unsigned int> orderedRowSet;
4338 for(
auto& deletePair : deleteRecordMap)
4340 __COUTV__(deletePair.first);
4341 if(!deletePair.second)
4344 __COUTV__(deletePair.first);
4345 orderedRowSet.emplace(deletePair.first);
4349 for(std::set<unsigned int>::reverse_iterator rit = orderedRowSet.rbegin();
4350 rit != orderedRowSet.rend();
4357 std::stringstream ss;
4358 typeTable.tableView_->print(ss);
4359 __COUT__ << ss.str();
4362 typeTable.tableView_->
init();
4367 std::stringstream ss;
4368 artdaqSupervisorTable.tableView_->print(ss);
4369 __COUT__ << ss.str();
4372 std::stringstream ss;
4373 artdaqSubsystemTable.tableView_->print(ss);
4374 __COUT__ << ss.str();
4377 artdaqSupervisorTable.tableView_
4379 artdaqSubsystemTable.tableView_
4384 __COUT__ <<
"Table errors while creating ARTDAQ nodes. Erasing all newly "
4385 "created table versions."
4390 __COUT__ <<
"Edits complete for artdaq nodes and subsystems.. now save and activate "
4391 "groups, and update aliases!"
4396 std::string localAccumulatedWarnings;
4397 configGroupEdit.saveChanges(configGroupEdit.originalGroupName_,
4398 newConfigurationGroupKey,
4405 &localAccumulatedWarnings);
<virtual so future plugins can inherit from multiple table base classes
static std::string insertModuleType(std::ostream &out, std::string &tabStr, std::string &commentStr, ConfigurationTree moduleTypeNode)
static bool isARTDAQEnabled(const ConfigurationManager *cfgMgr)
isARTDAQEnabled
static void setAndActivateARTDAQSystem(ConfigurationManagerRW *cfgMgr, const std::map< std::string, std::map< std::string, std::vector< std::string >>> &nodeTypeToObjectMap, const std::map< std::string, std::string > &subsystemObjectMap)
static struct ots::ARTDAQTableBase::ProcessTypes processTypes_
Note!!!! processTypes_ must be instantiate after the static artdaq table names (to construct map in c...
static void outputOnlineMonitorFHICL(const ConfigurationTree &onlineMonitorNode)
static void insertParameters(std::ostream &out, std::string &tabStr, std::string &commentStr, ConfigurationTree parameterLink, const std::string ¶meterPreamble, bool onlyInsertAtTableParameters=false, bool includeAtTableParameters=false)
static const ARTDAQInfo & getARTDAQSystem(ConfigurationManagerRW *cfgMgr, std::map< std::string, std::map< std::string, std::vector< std::string >>> &nodeTypeToObjectMap, std::map< std::string, std::string > &subsystemObjectMap, std::vector< std::string > &artdaqSupervisoInfo)
static void insertMetricsBlock(std::ostream &out, std::string &tabStr, std::string &commentStr, ConfigurationTree daqNode)
insertMetricsBlock
static void insertArtProcessBlock(std::ostream &out, std::string &tabStr, std::string &commentStr, ConfigurationTree art, ConfigurationTree subsystemLink=ConfigurationTree(), size_t routingTimeoutMs=DEFAULT_ROUTING_TIMEOUT_MS, size_t routingRetryCount=DEFAULT_ROUTING_RETRY_COUNT)
static void outputDataReceiverFHICL(const ConfigurationTree &receiverNode, ARTDAQAppType appType, size_t maxFragmentSizeBytes=DEFAULT_MAX_FRAGMENT_SIZE, size_t routingTimeoutMs=DEFAULT_ROUTING_TIMEOUT_MS, size_t routingRetryCount=DEFAULT_ROUTING_RETRY_COUNT)
ConfigurationTree getNode(const std::string &nodeString, bool doNotThrowOnBrokenUIDLinks=false) const
"root/parent/parent/"
const std::string & getUsername(void) const
Getters.
const unsigned int & getRow(void) const
getRow
bool isDisconnected(void) const
ConfigurationTree getNode(const std::string &nodeName, bool doNotThrowOnBrokenUIDLinks=false) const
navigating between nodes
T getValueWithDefault(const T &defaultValue) const
void getValue(T &value) const
std::vector< std::pair< std::string, ConfigurationTree > > getChildren(std::map< std::string, std::string > filterMap=std::map< std::string, std::string >(), bool byPriority=false, bool onlyStatusTrue=false) const
const std::string & getUIDAsString(void) const
const unsigned int & getNodeRow(void) const
getNodeRow
bool isChildLinkUID(void) const
bool isChildLink(void) const
bool isChildLinkGroupID(void) const
unsigned int findRow(unsigned int col, const T &value, unsigned int offsetRow=0, bool doNotThrow=false) const
< in included .icc source
void setValueAsString(const std::string &value, unsigned int row, unsigned int col)
unsigned int getColStatus(void) const
unsigned int copyRows(const std::string &author, const TableView &src, unsigned int srcOffsetRow=0, unsigned int srcRowsToCopy=(unsigned int) -1, unsigned int destOffsetRow=(unsigned int) -1, unsigned char generateUniqueDataColumns=false, const std::string &baseNameAutoUID="")
const std::string & setUniqueColumnValue(unsigned int row, unsigned int col, std::string baseValueAsString="", bool doMathAppendStrategy=false, std::string childLinkIndex="", std::string groupId="")
unsigned int getColUID(void) const
unsigned int findCol(const std::string &name) const
unsigned int addRow(const std::string &author="", unsigned char incrementUniqueData=false, const std::string &baseNameAutoUID="", unsigned int rowToAdd=(unsigned int) -1, std::string childLinkIndex="", std::string groupId="")
const XDAQContext * getTheARTDAQSupervisorContext(void) const
artdaq specific get methods
ARTDAQ DAQ Parameter Column names.
ARTDAQ Builder/Logger/Dispatcher Column names.
ARTDAQ Reader Column names.
ARTDAQ Subsystem Column names.
ARTDAQ Supervisor Column names.
TableEditStruct & getTableEditStruct(const std::string &tableName, bool markModified=false)
Note: if markModified, and table not found in group, this function will try to add it to group.
static std::string getTimestampString(const std::string &linuxTimeInSeconds)
static void getVectorFromString(const std::string &inputString, std::vector< std::string > &listToReturn, const std::set< char > &delimiter={',', '|', '&'}, const std::set< char > &whitespace={' ', '\t', '\n', '\r'}, std::vector< char > *listOfDelimiters=0, bool decodeURIComponents=false)
static std::string setToString(const std::set< T > &setToReturn, const std::string &delimeter=", ")
setToString ~
static std::string vectorToString(const std::vector< T > &setToReturn, const std::string &delimeter=", ")
vectorToString ~
static bool extractCommonChunks(const std::vector< std::string > &haystack, std::vector< std::string > &commonChunksToReturn, std::vector< std::string > &wildcardStrings, unsigned int &fixedWildcardLength)
static std::string mapToString(const std::map< std::string, T > &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ")