1 #include "otsdaq/TablePlugins/ARTDAQTableBase/ARTDAQTableBase.h"
8 #include "otsdaq/Macros/CoutMacros.h"
9 #define TRACE_NAME "ARTDAQTableBase"
11 #include <fhiclcpp/ParameterSet.h>
12 #include <fhiclcpp/detail/print_mode.h>
13 #include <fhiclcpp/intermediate_table.h>
14 #include <fhiclcpp/parse.h>
16 #include "otsdaq/ProgressBar/ProgressBar.h"
17 #include "otsdaq/TablePlugins/XDAQContextTable/XDAQContextTable.h"
22 #define __MF_SUBJECT__ "ARTDAQTableBase"
26 #define FCL_COMMENT_POSITION 65
30 #define OUTCF(X,C,F) { std::stringstream outSs; outSs << X; addCommentWhitespace(outSs, tabStr.size()*TABSZ + commentStr.size() + outSs.str().size()); outSs << (C) << (std::string(C).size()?" - ":"") << "from config-tree: " << parentPath << (std::string(F).size()?(std::string("/") + std::string(F)):std::string("")) << "\n"; OUT << outSs.str();}
32 #define OUTC(X,C) OUTCF(X,C,"")
34 #define OUTCLF(X,C,F) { std::stringstream outSs; outSs << X; addCommentWhitespace(outSs, tabStr.size()*TABSZ + commentStr.size() + outSs.str().size()); outSs << (C) << (std::string(C).size()?" - ":"") << "from config-tree: " << localParentPath << std::string(std::string(F).size()?("/" + std::string(F)):std::string("")) << "\n"; OUT << outSs.str();}
36 #define OUTCL(X,C) OUTCLF(X,C,"")
38 #define OUTCL2F(X,C,F) { std::stringstream outSs; outSs << X; addCommentWhitespace(outSs, tabStr.size()*TABSZ + commentStr.size() + outSs.str().size()); outSs << (C) << (std::string(C).size()?" - ":"") << "from config-tree: " << localParentPath2 << (std::string(F).size()?(std::string("/") + std::string(F)):std::string("")) << "\n"; OUT << outSs.str();}
40 #define OUTCL2(X,C) OUTCL2F(X,C,"")
45 const std::string ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH =
46 (((getenv(
"SERVICE_DATA_PATH") == NULL)
47 ? (std::string(getenv(
"USER_DATA")) +
"/ServiceData")
48 : std::string(getenv(
"SERVICE_DATA_PATH")))) +
49 "/ConfigurationGUI_artdaqLayouts/";
50 const bool ARTDAQTableBase::ARTDAQ_DONOTWRITE_FCL = ((getenv(
"OTS_FCL_DONOTWRITE") == NULL) ?
false :
true);
52 const std::string ARTDAQTableBase::ARTDAQ_SUPERVISOR_CLASS =
"ots::ARTDAQSupervisor";
53 const std::string ARTDAQTableBase::ARTDAQ_SUPERVISOR_TABLE =
"ARTDAQSupervisorTable";
55 const std::string ARTDAQTableBase::ARTDAQ_READER_TABLE =
"ARTDAQBoardReaderTable";
56 const std::string ARTDAQTableBase::ARTDAQ_BUILDER_TABLE =
"ARTDAQEventBuilderTable";
57 const std::string ARTDAQTableBase::ARTDAQ_LOGGER_TABLE =
"ARTDAQDataLoggerTable";
58 const std::string ARTDAQTableBase::ARTDAQ_DISPATCHER_TABLE =
"ARTDAQDispatcherTable";
59 const std::string ARTDAQTableBase::ARTDAQ_MONITOR_TABLE =
"ARTDAQMonitorTable";
60 const std::string ARTDAQTableBase::ARTDAQ_ROUTER_TABLE =
"ARTDAQRoutingManagerTable";
62 const std::string ARTDAQTableBase::ARTDAQ_SUBSYSTEM_TABLE =
"ARTDAQSubsystemTable";
63 const std::string ARTDAQTableBase::ARTDAQ_DAQ_TABLE =
"ARTDAQDaqTable";
64 const std::string ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE =
"ARTDAQDaqParameterTable";
65 const std::string ARTDAQTableBase::ARTDAQ_ART_TABLE =
"ARTDAQArtTable";
67 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME =
"ExecutionHostname";
68 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS =
"AllowedProcessors";
69 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK =
"SubsystemLink";
70 const std::string ARTDAQTableBase::ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID =
"SubsystemLinkUID";
73 const int ARTDAQTableBase::NULL_SUBSYSTEM_DESTINATION = 0;
74 const std::string ARTDAQTableBase::NULL_SUBSYSTEM_DESTINATION_LABEL =
"nullDestinationSubsystem";
98 std::string* accumulatedExceptions )
99 :
TableBase(tableName, accumulatedExceptions)
111 std::cout <<
"ARTDAQTableBase Before traceTID=" << traceTID << __E__;
113 traceInit(trace_name(TRACE_NAME, __TRACE_FILE__, buf,
sizeof(buf)), 0);
114 std::cout <<
"ARTDAQTableBase After traceTID=" << traceTID << __E__;
115 __COUT__ <<
"ARTDAQTableBase TRACE reinit and Constructed." << __E__;
125 __SS__ <<
"Should not call void constructor, table type is lost!" << __E__;
130 ARTDAQTableBase::~ARTDAQTableBase(
void) {}
133 const std::string& ARTDAQTableBase::getTypeString(ARTDAQAppType type)
137 case ARTDAQAppType::EventBuilder:
139 case ARTDAQAppType::DataLogger:
141 case ARTDAQAppType::Dispatcher:
143 case ARTDAQAppType::BoardReader:
145 case ARTDAQAppType::Monitor:
147 case ARTDAQAppType::RoutingManager:
151 __SS__ <<
"Illegal translation attempt for type '" << (
unsigned int)type <<
"'"
157 std::string ARTDAQTableBase::getFHICLFilename(ARTDAQAppType type,
const std::string& name)
162 std::string uid = name;
163 for(
unsigned int i = 0; i < uid.size(); ++i)
164 if((uid[i] >=
'a' && uid[i] <=
'z') || (uid[i] >=
'A' && uid[i] <=
'Z') ||
165 (uid[i] >=
'0' && uid[i] <=
'9'))
176 std::string ARTDAQTableBase::getFlatFHICLFilename(ARTDAQAppType type,
177 const std::string& name)
182 std::string uid = name;
183 for(
unsigned int i = 0; i < uid.size(); ++i)
184 if((uid[i] >=
'a' && uid[i] <=
'z') || (uid[i] >=
'A' && uid[i] <=
'Z') ||
185 (uid[i] >=
'0' && uid[i] <=
'9'))
188 filename +=
"_flattened.fcl";
196 void ARTDAQTableBase::flattenFHICL(ARTDAQAppType type,
197 const std::string& name,
198 std::string* returnFcl )
200 std::chrono::steady_clock::time_point startClock = std::chrono::steady_clock::now();
201 __COUTS__(3) <<
"flattenFHICL()" << __ENV__(
"FHICL_FILE_PATH") << __E__;
204 std::string inFile = getFHICLFilename(type, name);
205 std::string outFile = getFlatFHICLFilename(type, name);
207 __COUTVS__(3, inFile);
208 __COUTVS__(3, outFile);
210 cet::filepath_lookup_nonabsolute policy(
"FHICL_FILE_PATH");
211 fhicl::ParameterSet pset;
215 __COUT_INFO__ <<
"parsing document: " << inFile;
218 pset = fhicl::ParameterSet::make(inFile, policy);
219 __COUTT__ <<
"document: " << inFile <<
" parsed";
220 __COUTT__ <<
"got pset from table:";
222 std::ofstream ofs{outFile};
225 __SS__ <<
"Failed to open fhicl output file '" << outFile <<
"!'" << __E__;
228 std::ostringstream out;
229 out << pset.to_indented_string(
233 *returnFcl = out.str();
234 __COUTVS__(21, returnFcl);
238 catch(cet::exception
const& e)
240 __SS__ <<
"Failed to parse fhicl into output file '" << outFile
241 <<
"' - here is the error: " << e.what() << __E__;
244 if(std::string(e.what()).find(
"TriggerEpilogs") != std::string::npos)
246 <<
"The Trigger Epilogs are located at "
247 "$USER_DATA/TriggerConfigurations/TriggerEpilogs. "
248 <<
"Please check that the Trigger Epilogs were properly generated, or "
249 "copy them from a previously working area."
255 <<
" Flatten Clock time = " << artdaq::TimeUtils::GetElapsedTime(startClock)
268 std::string& commentStr,
269 const std::string& parentPath,
271 const std::string& parameterPreamble,
272 bool onlyInsertAtTableParameters ,
273 bool includeAtTableParameters )
279 auto otherParameters = parameterGroupLink.
getChildren();
284 __COUTVS__(3, otherParameters.size());
285 __COUTVS__(3, onlyInsertAtTableParameters);
286 __COUTVS__(3, includeAtTableParameters);
288 size_t paramCount = 0;
289 for(
auto& parameter : otherParameters)
291 key = parameter.second.getNode(parameterPreamble +
"Key").getValue();
293 std::string localParentPath =
295 parameter.second.getTableName() +
":" +
297 parameterGroupLink.
getParentLinkID() +
"/" + parameter.second.getValue();
301 if(key.find(
"@table::") != std::string::npos)
304 if(onlyInsertAtTableParameters || includeAtTableParameters)
307 if(!parameter.second.status())
310 __COUTT__ <<
"Inserting parameter... " << localParentPath << __E__;
313 OUTCL(key << parameter.second.getNode(parameterPreamble +
"Value")
315 parameter.second.hasComment() ? parameter.second.getComment()
318 if(!parameter.second.status())
327 if(onlyInsertAtTableParameters)
331 if(!parameter.second.status())
334 __COUTT__ <<
"Inserting parameter... " << localParentPath << __E__;
337 if(key.find(
"#include") == std::string::npos)
340 << parameter.second.getNode(parameterPreamble +
"Value")
342 parameter.second.hasComment() ? parameter.second.getComment() :
"");
346 OUTCL(parameter.second.getNode(parameterPreamble +
"Value").getValue(),
347 parameter.second.hasComment() ? parameter.second.getComment() :
"");
351 OUTCL(
"# comment for #include below:",
352 parameter.second.hasComment() ? parameter.second.getComment() :
"");
354 << parameter.second.getNode(parameterPreamble +
"Value").getValue()
358 if(!parameter.second.status())
364 __COUTS__(3) <<
"Empty parameter set found onlyInsertAtTableParameters="
365 << onlyInsertAtTableParameters << __E__;
366 std::string localParentPath =
369 if(onlyInsertAtTableParameters)
371 OUTCL(
"# no @table parameters found",
"" );
375 OUTCL(
"# empty parameter set found",
"" );
381 __COUTS__(3) <<
"No parameters found" << __E__;
382 std::string localParentPath =
384 OUTCL(
"# no parameters inserted",
"" );
394 std::string& commentStr,
395 const std::string& parentPath,
398 std::string value = moduleTypeNode.
getValue();
399 __COUTTV__(parentPath);
400 OUTCF((value.find(
"@table::") == std::string::npos ?
"module_type: " :
"") << value,
410 std::string& commentStr,
411 const std::string& parentPath,
414 auto metricsGroup = daqNode.
getNode(
"daqMetricsLink");
417 OUTCF(
"metrics: {",
"", metricsGroup.getParentLinkColumnName());
419 if(!metricsGroup.isDisconnected())
421 auto metrics = metricsGroup.getChildren();
422 bool sendSystemMetrics(
false), sendProcessMetrics(
false);
423 for(
auto& metric : metrics)
425 if(!metric.second.status())
428 __COUTT__ <<
"Inserting metric... " << parentPath << __E__;
429 std::string localParentPath =
430 parentPath +
"/" + metricsGroup.getParentLinkColumnName() +
":" +
431 metric.second.getTableName() +
":" + metricsGroup.getParentLinkIndex() +
432 ":" + metricsGroup.getParentLinkID() +
"/" + metric.second.getValue();
433 __COUTT__ <<
"Inserting metric... " << localParentPath << __E__;
435 OUTCL(metric.second.getNode(
"metricKey").getValue() <<
": {",
436 metric.second.hasComment() ? metric.second.getComment() :
"");
439 if(metric.second.getNode(
"sendSystemMetrics").getValue<
bool>())
441 sendSystemMetrics =
true;
443 if(metric.second.getNode(
"sendProcessMetrics").getValue<
bool>())
445 sendProcessMetrics =
true;
448 OUTCLF(
"metricPluginType: "
449 << metric.second.getNode(
"metricPluginType").getValue(),
453 "level_string: " << metric.second.getNode(
"metricLevelString").getValue(),
455 "metricLevelString");
457 auto metricParametersGroup = metric.second.getNode(
"metricParametersLink");
458 if(!metricParametersGroup.isDisconnected())
460 auto metricParameters = metricParametersGroup.getChildren();
461 for(
auto& metricParameter : metricParameters)
463 if(!metricParameter.second.status())
466 __COUTT__ <<
"Inserting metric... " << localParentPath << __E__;
467 std::string localParentPath2 =
468 localParentPath +
"/" +
469 metricParametersGroup.getParentLinkColumnName() +
":" +
470 metricParameter.second.getTableName() +
":" +
471 metricParametersGroup.getParentLinkIndex() +
":" +
472 metricParametersGroup.getParentLinkID() +
"/" +
473 metricParameter.second.getValue();
474 __COUTT__ <<
"Inserting metric... " << localParentPath2 << __E__;
475 OUTCL2(metricParameter.second.getNode(
"metricParameterKey").getValue()
477 << metricParameter.second.getNode(
"metricParameterValue")
479 metricParameter.second.hasComment()
480 ? metricParameter.second.getComment()
483 if(!metricParameter.second.status())
488 OUT <<
"} # end " << metric.second.getNode(
"metricKey").getValue()
491 if(!metric.second.status())
495 __COUTT__ <<
"Inserting metric send... " << parentPath << __E__;
496 std::string localParentPath =
497 parentPath +
"/" + metricsGroup.getParentLinkColumnName() +
":" +
498 metricsGroup.getTableName() +
":" + metricsGroup.getParentLinkIndex() +
":" +
499 metricsGroup.getParentLinkID();
500 if(sendSystemMetrics)
502 __COUTT__ <<
"Inserting send_system_metrics... " << localParentPath << __E__;
503 OUTCLF(
"send_system_metrics: true ",
504 "true, if any children are true",
505 "*/sendSystemMetrics");
508 OUTCLF(
"# send_system_metrics: false ",
509 "true, if any children are true",
510 "*/sendSystemMetrics");
512 if(sendProcessMetrics)
514 __COUTT__ <<
"Inserting send_process_metrics... " << localParentPath << __E__;
515 OUTCLF(
"send_process_metrics: true ",
516 "true, if any children are true",
517 "*/sendProcessMetrics");
520 OUTCLF(
"# send_process_metrics: false ",
521 "true, if any children are true",
522 "*/sendProcessMetrics");
526 __COUTS__(3) <<
"No metrics found" << __E__;
527 std::string localParentPath =
528 parentPath +
"/" + metricsGroup.getParentLinkColumnName();
529 OUTCL(
"# no metrics found",
"" );
533 OUT <<
"} # end metrics\n\n";
537 void ARTDAQTableBase::outputBoardReaderFHICL(
540 size_t routingTimeoutMs ,
541 size_t routingRetryCount )
543 if(ARTDAQ_DONOTWRITE_FCL)
545 __COUT__ <<
"Skipping fcl generation." << __E__;
674 std::string filename =
675 getFHICLFilename(ARTDAQAppType::BoardReader, boardReaderNode.
getValue());
681 std::string tabStr =
"";
682 std::string commentStr =
"";
685 out.open(filename, std::fstream::out | std::fstream::trunc);
688 __SS__ <<
"Failed to open ARTDAQ BoardReader fcl file: " << filename << __E__;
696 OUT <<
"###########################################################" << __E__;
698 OUT <<
"# artdaq " << getTypeString(ARTDAQAppType::BoardReader)
699 <<
" fcl configuration file produced by otsdaq." << __E__;
702 OUT <<
"# Original filename: \t" << filename << __E__;
703 OUT <<
"# otsdaq-ARTDAQ " << getTypeString(ARTDAQAppType::BoardReader)
704 <<
" UID:\t" << boardReaderNode.
getValue() << __E__;
706 OUT <<
"###########################################################" << __E__;
720 catch(
const std::runtime_error&)
722 __COUTT__ <<
"Ignoring error, assume this a valid UID node." << __E__;
727 std::string parentPath =
730 OUTC(
"# start of " << getTypeString(ARTDAQAppType::BoardReader) <<
" '"
731 << boardReaderNode.
getValue() <<
"' fcl",
736 __COUTT__ <<
"Inserting " << getTypeString(ARTDAQAppType::BoardReader)
737 <<
" preamble parameters... " << parentPath << __E__;
743 boardReaderNode.
getNode(
"preambleParametersLink"),
750 __COUTT__ <<
"Generating daq block..." << __E__;
757 OUT <<
"fragment_receiver: {\n";
764 "daq generator plug-in type" ,
765 "daqGeneratorPluginType" );
766 OUTCF(
"fragment_type"
769 "generator data fragment type" ,
770 "daqGeneratorFragmentType" );
772 __COUTT__ <<
"Inserting " << getTypeString(ARTDAQAppType::BoardReader)
773 <<
" DAQ Parameters... " << parentPath << __E__;
779 boardReaderNode.
getNode(
"daqParametersLink"),
784 auto fragmentId = boardReaderNode.
getNode(
"daqFragmentIDs");
785 std::string value = fragmentId.
getValue();
786 if(value.size() < 2 || value[0] !=
'[' || value[value.size() - 1] !=
']')
788 __SS__ <<
"Invalid 'daqFragmentIDs' - the value must be a valid fcl "
789 "array with starting and ending square brackets: [ ]"
793 __COUTS__(20) <<
"fragment_ids: " << fragmentId.getValue() << __E__;
794 OUTCF(
"fragment_ids: " << fragmentId.getValue(),
801 <<
"Ignoring missing fragment_id column associated with Board Reader."
804 OUTCF(
"# fragment_ids not specified, but could be",
"",
"daqFragmentIDs");
810 OUT <<
"destinations: { # empty placeholder, '"
811 << getTypeString(ARTDAQAppType::BoardReader)
812 <<
"' destinations handled by artdaq interface\n";
815 OUT <<
"routing_table_config: {\n";
818 auto readerSubsystemID = 1;
819 auto readerSubsystemLink = boardReaderNode.
getNode(
"SubsystemLink");
820 if(!readerSubsystemLink.isDisconnected())
822 readerSubsystemID = getSubsytemId(readerSubsystemLink);
824 if(info_.subsystems[readerSubsystemID].hasRoutingManager)
826 std::string localParentPath =
827 parentPath +
"/" + readerSubsystemLink.getParentLinkColumnName() +
":" +
828 readerSubsystemLink.getTableName() +
"/" + readerSubsystemLink.getValue();
829 __COUTT__ <<
"Inserting routing manager... " << localParentPath << __E__;
830 OUTCL(
"use_routing_manager: true",
831 "auto-generated because subsystem '" +
832 std::to_string(readerSubsystemID) +
"' has Routing Manager added");
834 OUTCLF(
"routing_manager_hostname: \""
835 << info_.subsystems[readerSubsystemID].routingManagerHost <<
"\"",
837 ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME);
838 OUT <<
"table_update_port: 0\n";
839 OUT <<
"table_update_address: \"0.0.0.0\"\n";
840 OUT <<
"table_update_multicast_interface: \"0.0.0.0\"\n";
841 OUT <<
"table_acknowledge_port : 0\n";
842 OUT <<
"routing_timeout_ms: " << routingTimeoutMs <<
"\n";
843 OUT <<
"routing_retry_count: " << routingRetryCount <<
"\n";
847 OUTCF(
"use_routing_manager: false",
848 "auto-generated if subsystem '" + std::to_string(readerSubsystemID) +
849 "' has Routing Manager added",
850 readerSubsystemLink.getParentLinkColumnName());
857 OUT <<
"} # end fragment_receiver\n";
862 OUT <<
"} # end daq\n\n";
867 __COUTT__ <<
"Inserting " << getTypeString(ARTDAQAppType::BoardReader)
868 <<
" add-on parameters... " << parentPath << __E__;
873 boardReaderNode.
getNode(
"addOnParametersLink"),
878 OUTC(
"# end of " << getTypeString(ARTDAQAppType::BoardReader) <<
" '"
879 << boardReaderNode.
getValue() <<
"' fcl",
881 __COUTT__ <<
"outputBoardReaderFHICL DONE" << __E__;
885 __SS__ <<
"\n\nError while generating FHiCL for "
886 << getTypeString(ARTDAQAppType::BoardReader) <<
" node at filename '"
887 << filename <<
"'" << __E__;
892 catch(
const std::runtime_error& e)
894 ss <<
" Here is the error: " << e.what() << __E__;
896 catch(
const std::exception& e)
898 ss <<
" Here is the error: " << e.what() << __E__;
914 ARTDAQAppType appType,
916 size_t routingTimeoutMs ,
917 size_t routingRetryCount ,
918 std::string* returnFcl )
920 if(ARTDAQ_DONOTWRITE_FCL)
922 __COUT__ <<
"Skipping fcl generation." << __E__;
926 std::string filename = getFHICLFilename(appType, receiverNode.
getValue());
931 std::ostringstream out;
933 std::string tabStr =
"";
934 std::string commentStr =
"";
937 outf.open(filename, std::fstream::out | std::fstream::trunc);
940 __SS__ <<
"Failed to open ARTDAQ fcl file: " << filename << __E__;
948 OUT <<
"###########################################################" << __E__;
950 OUT <<
"# artdaq " << getTypeString(appType)
951 <<
" fcl configuration file produced by otsdaq." << __E__;
952 OUT <<
"# Creation time: \t"
954 OUT <<
"# Original filename: \t" << filename << __E__;
955 OUT <<
"# otsdaq-ARTDAQ " << getTypeString(appType) <<
" UID:\t"
956 << receiverNode.
getValue() << __E__;
958 OUT <<
"###########################################################" << __E__;
970 *returnFcl = out.str();
971 __COUTVS__(21, *returnFcl);
978 catch(
const std::runtime_error&)
980 __COUTT__ <<
"Ignoring error, assume this a valid UID node." << __E__;
985 std::string parentPath =
988 OUTC(
"# start of " << getTypeString(appType) <<
" '" << receiverNode.
getValue()
994 __COUTT__ <<
"Inserting " << getTypeString(appType) <<
" preamble parameters... "
995 << parentPath << __E__;
1001 receiverNode.
getNode(
"preambleParametersLink"),
1008 __COUTT__ <<
"Generating daq block..." << __E__;
1010 auto daq = receiverNode.
getNode(
"daqLink");
1011 if(!daq.isDisconnected())
1014 OUTCF(
"daq: {",
"" , daq.getParentLinkColumnName());
1017 if(appType == ARTDAQAppType::EventBuilder)
1018 OUT <<
"event_builder: {\n";
1020 OUT <<
"aggregator: {\n";
1025 std::stringstream outSs;
1026 if(appType == ARTDAQAppType::DataLogger)
1027 outSs <<
"is_datalogger: true";
1028 else if(appType == ARTDAQAppType::Dispatcher)
1029 outSs <<
"is_dispatcher: true";
1030 if(outSs.str().size())
1032 addCommentWhitespace(
1034 tabStr.size() * TABSZ + commentStr.size() + outSs.str().size());
1035 outSs <<
"auto-generated based on app type '"
1036 << getTypeString(appType) <<
"'\n";
1043 std::string parentPath = daq.getParentTableName() +
"/" +
1044 daq.getParentRecordName() +
"/" +
1045 daq.getParentLinkColumnName() +
":" +
1046 daq.getTableName() +
"/" + daq.getValue();
1047 __COUTT__ <<
"Inserting " << getTypeString(appType) <<
" DAQ Parameters... "
1048 << parentPath << __E__;
1053 daq.getNode(
"daqParametersLink"),
1058 if(appType == ARTDAQAppType::EventBuilder)
1061 OUT <<
"routing_token_config: {\n";
1064 auto builderSubsystemID = 1;
1065 auto builderSubsystemLink = receiverNode.
getNode(
"SubsystemLink");
1066 if(!builderSubsystemLink.isDisconnected())
1068 builderSubsystemID = getSubsytemId(builderSubsystemLink);
1070 if(info_.subsystems[builderSubsystemID].hasRoutingManager)
1072 std::string localParentPath =
1074 builderSubsystemLink.getParentLinkColumnName() +
":" +
1075 builderSubsystemLink.getTableName() +
"/" +
1076 builderSubsystemLink.getValue();
1077 __COUTT__ <<
"Inserting routing manager... " << localParentPath
1079 OUTCL(
"use_routing_manager: true",
1080 "auto-generated because subsystem '" +
1081 std::to_string(builderSubsystemID) +
1082 "' has Routing Manager added");
1084 OUTCLF(
"routing_manager_hostname: \""
1085 << info_.subsystems[builderSubsystemID].routingManagerHost
1088 ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME);
1089 OUT <<
"routing_token_port: 0\n";
1093 OUTCF(
"use_routing_manager: false",
1094 "auto-generated if subsystem '" +
1095 std::to_string(builderSubsystemID) +
1096 "' has Routing Manager added",
1097 builderSubsystemLink.getParentLinkColumnName());
1103 __COUTT__ <<
"Adding sources placeholder" << __E__;
1105 OUT <<
"sources: { # empty placeholder, '" << getTypeString(appType)
1106 <<
"' sources handled by artdaq interface\n";
1111 if(appType == ARTDAQAppType::EventBuilder)
1112 OUT <<
"} # end event_builder\n";
1114 OUT <<
"} # end aggregator\n";
1119 OUT <<
"} # end daq\n\n";
1123 __COUTS__(3) <<
"No daq found" << __E__;
1124 std::string localParentPath =
1125 parentPath +
"/" + daq.getParentLinkColumnName();
1126 OUTCL(
"# no daq found",
"" );
1131 __COUTT__ <<
"Filling art block..." << __E__;
1134 receiverNode.
getNode(ARTDAQTableBase::colARTDAQNotReader_.colLinkToArt_);
1135 if(!art.isDisconnected())
1137 std::string localParentPath = parentPath +
"/" +
1139 art.getTableName() +
"/" + art.getValue();
1140 OUTCF(
"art: {",
"" , art.getParentLinkColumnName());
1149 receiverNode.
getNode(
"SubsystemLink"),
1154 OUT <<
"} # end art\n\n";
1158 __COUTS__(3) <<
"No art found" << __E__;
1159 std::string localParentPath =
1160 parentPath +
"/" + art.getParentLinkColumnName();
1161 OUTCL(
"# no art found",
"" );
1166 __COUTT__ <<
"Inserting " << getTypeString(appType) <<
" add-on parameters... "
1167 << parentPath << __E__;
1172 receiverNode.
getNode(
"addOnParametersLink"),
1178 OUTC(
"# end of " << getTypeString(appType) <<
" '" << receiverNode.
getValue()
1181 __COUTT__ <<
"outputDataReceiverFHICL DONE" << __E__;
1185 __SS__ <<
"\n\nError while generating FHiCL for " << getTypeString(appType)
1186 <<
" node at filename '" << filename <<
"'" << __E__;
1191 catch(
const std::runtime_error& e)
1193 ss <<
" Here is the error: " << e.what() << __E__;
1195 catch(
const std::exception& e)
1197 ss <<
" Here is the error: " << e.what() << __E__;
1202 *returnFcl = out.str();
1203 __COUTVS__(21, *returnFcl);
1212 *returnFcl = out.str();
1213 __COUTVS__(21, *returnFcl);
1224 if(ARTDAQ_DONOTWRITE_FCL)
1226 __COUT__ <<
"Skipping fcl generation." << __E__;
1230 std::string filename =
1231 getFHICLFilename(ARTDAQAppType::Monitor, monitorNode.
getValue());
1237 std::string tabStr =
"";
1238 std::string commentStr =
"";
1240 __COUTV__(filename);
1241 out.open(filename, std::fstream::out | std::fstream::trunc);
1244 __SS__ <<
"Failed to open ARTDAQ fcl file: " << filename << __E__;
1252 OUT <<
"###########################################################" << __E__;
1253 OUT <<
"#" << __E__;
1254 OUT <<
"# artdaq " << getTypeString(ARTDAQAppType::Monitor)
1255 <<
" fcl configuration file produced by otsdaq." << __E__;
1256 OUT <<
"# Creation time: \t"
1258 OUT <<
"# Original filename: \t" << filename << __E__;
1259 OUT <<
"# otsdaq-ARTDAQ " << getTypeString(ARTDAQAppType::Monitor) <<
" UID:\t"
1260 << monitorNode.
getValue() << __E__;
1261 OUT <<
"#" << __E__;
1262 OUT <<
"###########################################################" << __E__;
1276 catch(
const std::runtime_error&)
1278 __COUTT__ <<
"Ignoring error, assume this a valid UID node." << __E__;
1285 std::string parentPath =
1289 __COUTT__ <<
"Inserting " << getTypeString(ARTDAQAppType::Monitor)
1290 <<
" preamble parameters... " << parentPath << __E__;
1295 monitorNode.
getNode(
"preambleParametersLink"),
1304 monitorNode.
getNode(ARTDAQTableBase::colARTDAQNotReader_.colLinkToArt_);
1305 if(!art.isDisconnected())
1308 OUT <<
"services.message: { "
1309 << artdaq::generateMessageFacilityConfiguration(
1310 mf::GetApplicationName().c_str(),
true,
false)
1312 OUT <<
"services.message.destinations.file: {type: \"GenFile\" threshold: "
1313 "\"INFO\" seperator: \"-\""
1314 <<
" pattern: \"" << monitorNode.
getValue() <<
"-%?H%t-%p.log"
1316 <<
" timestamp_pattern: \"%Y%m%d%H%M%S\""
1317 <<
" directory: \"" << __ENV__(
"OTSDAQ_LOG_ROOT") <<
"/"
1319 <<
" append : false }\n";
1322 auto dispatcherLink = monitorNode.
getNode(
"dispatcherLink");
1323 if(!dispatcherLink.isDisconnected())
1325 std::string monitorHost =
1326 monitorNode.
getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
1328 std::string dispatcherHost =
1329 dispatcherLink.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
1330 .getValueWithDefault(
"localhost");
1331 OUT <<
"source.dispatcherHost: \"" << dispatcherHost <<
"\"\n";
1332 int dispatcherPort = dispatcherLink.getNode(
"DispatcherPort").getValue<
int>();
1333 OUT <<
"source.dispatcherPort: " << dispatcherPort <<
"\n";
1334 OUT <<
"source.commanderPluginType: xmlrpc\n";
1337 int om_tcp_listen_port =
1339 int disp_fake_rank =
1340 dispatcherLink.getNode(
"DispatcherID").getValueWithDefault<
int>(200);
1342 size_t max_fragment_size = monitorNode.
getNode(
"max_fragment_size_words")
1344 std::string transfer_plugin_type = monitorNode.
getNode(
"transfer_plugin_type")
1347 OUT <<
"TransferPluginConfig: {\n";
1349 OUT <<
"transferPluginType: " << transfer_plugin_type <<
"\n";
1350 OUT <<
"host_map: [{ rank: " << disp_fake_rank <<
" host: \""
1351 << dispatcherHost <<
"\"}, { rank: " << om_rank <<
" host: \""
1352 << monitorHost <<
"\"}]\n";
1353 OUT <<
"max_fragment_size_words: " << max_fragment_size <<
"\n";
1354 OUT <<
"source_rank: " << disp_fake_rank <<
"\n";
1355 OUT <<
"destination_rank: " << om_rank <<
"\n";
1356 OUT <<
"port: " << om_tcp_listen_port <<
"\n";
1357 OUT <<
"unique_label: " << monitorNode.
getValue() <<
"_to_"
1358 << dispatcherLink.getValue() <<
"\n";
1361 OUT <<
"source.transfer_plugin: @local::TransferPluginConfig \n";
1362 auto dispatcherArt = monitorNode.
getNode(
"dispatcherArtLink");
1363 if(!dispatcherArt.isDisconnected())
1365 OUT <<
"source.dispatcher_config: {\n";
1371 OUT <<
"filter_paths: [\n";
1375 auto filterPathsLink = monitorNode.
getNode(
"filterPathsLink");
1376 if(!filterPathsLink.isDisconnected())
1383 for(
auto& filterPath : filterPaths)
1389 if(!filterPath.second.status())
1392 OUT <<
"name: " << filterPath.second.getNode(
"Name").getValue()
1394 OUT <<
"path: " << filterPath.second.getNode(
"Path").getValue()
1398 if(!filterPath.second.status())
1407 OUT <<
"unique_label: " << monitorNode.
getValue() <<
"\n";
1421 __COUTT__ <<
"Inserting " << getTypeString(ARTDAQAppType::Monitor)
1422 <<
" add-on parameters... " << parentPath << __E__;
1427 monitorNode.
getNode(
"addOnParametersLink"),
1432 __COUTT__ <<
"outputOnlineMonitorFHICL DONE" << __E__;
1436 __SS__ <<
"\n\nError while generating FHiCL for "
1437 << getTypeString(ARTDAQAppType::Monitor) <<
" node at filename '"
1438 << filename <<
"'" << __E__;
1443 catch(
const std::runtime_error& e)
1445 ss <<
" Here is the error: " << e.what() << __E__;
1447 catch(
const std::exception& e)
1449 ss <<
" Here is the error: " << e.what() << __E__;
1463 std::string& tabStr,
1464 std::string& commentStr,
1465 const std::string& parentPath,
1468 size_t routingTimeoutMs,
1469 size_t routingRetryCount)
1473 __COUTT__ <<
"Filling art.services parentPath =" << parentPath << __E__;
1474 auto services = art.
getNode(
"servicesLink");
1475 if(!services.isDisconnected())
1477 std::string localParentPath =
1479 services.getTableName() +
"/" +
1480 services.getValue();
1481 __COUTT__ <<
"Inserting services... " << localParentPath << __E__;
1482 OUTCL(
"services: {", services.hasComment() ? services.getComment() :
"");
1487 __COUTT__ <<
"Inserting services parameters... " << localParentPath << __E__;
1492 services.getNode(
"ServicesParametersLink"),
1498 OUT <<
"ArtdaqSharedMemoryServiceInterface: {\n";
1500 OUT <<
"service_provider: "
1501 "ArtdaqSharedMemoryService \n";
1503 OUTCLF(
"waiting_time: " << services.getNode(
"sharedMemoryWaitingTime").getValue(),
1505 "sharedMemoryWaitingTime");
1506 OUTCLF(
"resume_after_timeout: "
1507 << (services.getNode(
"sharedMemoryResumeAfterTimeout").getValue<
bool>()
1511 "sharedMemoryResumeAfterTimeout");
1513 OUT <<
"} # end ArtdaqSharedMemoryServiceInterface\n\n";
1515 OUT <<
"ArtdaqFragmentNamingServiceInterface: {\n";
1517 OUT <<
"service_provider: "
1518 "ArtdaqFragmentNamingService \n";
1519 OUTCLF(
"helper_plugin: "
1520 << services.getNode(
"fragmentNamingServiceProvider").getValue(),
1522 "fragmentNamingServiceProvider");
1524 OUT <<
"} # end ArtdaqFragmentNamingServiceInterface\n\n";
1528 __COUTT__ <<
"Inserting services parameters... " << localParentPath << __E__;
1533 services.getNode(
"ServicesParametersLink"),
1539 OUT <<
"} # end services\n\n";
1543 __COUTS__(3) <<
"No services found" << __E__;
1544 std::string localParentPath =
1545 parentPath +
"/" + services.getParentLinkColumnName();
1546 OUTCL(
"# no services found",
"" );
1551 __COUTT__ <<
"Filling art.outputs parentPath =" << parentPath << __E__;
1552 auto outputs = art.
getNode(
"outputsLink");
1553 if(!outputs.isDisconnected())
1555 std::string localParentPath =
1558 __COUTT__ <<
"Inserting output... " << localParentPath << __E__;
1559 OUTCL(
"outputs: {",
"" );
1562 auto outputPlugins = outputs.getChildren();
1563 for(
auto& outputPlugin : outputPlugins)
1565 if(!outputPlugin.second.status())
1568 __COUTT__ <<
"Inserting output parameters... " << localParentPath << __E__;
1569 std::string localParentPath2 =
1570 localParentPath +
":" + outputPlugin.second.getTableName() +
":" +
1571 outputs.getParentLinkIndex() +
":" + outputs.getParentLinkID() +
"/" +
1572 outputPlugin.second.getValue();
1573 __COUTT__ <<
"Inserting output... " << localParentPath2 << __E__;
1575 outputPlugin.second.getNode(
"outputKey").getValue() <<
": {",
1576 outputPlugin.second.hasComment() ? outputPlugin.second.getComment() :
"",
1580 __COUTT__ <<
"insertModuleType... " << localParentPath2 << __E__;
1581 std::string moduleType =
1586 outputPlugin.second.getNode(
"outputModuleType"));
1590 __COUTT__ <<
"Inserting output parameters... " << localParentPath << __E__;
1595 outputPlugin.second.getNode(
"outputModuleParameterLink"),
1600 if(outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1601 "BinaryNetOutput" ||
1602 outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1605 OUT <<
"destinations: { # empty placeholder, '"
1606 << outputPlugin.second.getNode(
"outputModuleType").getValue()
1607 <<
"' destinations handled by artdaq interface\n";
1610 OUT <<
"routing_table_config: {\n";
1613 auto mySubsystemID = 1;
1614 auto destinationSubsystemID = 1;
1617 mySubsystemID = getSubsytemId(subsystemLink);
1619 destinationSubsystemID = info_.subsystems[mySubsystemID].destination;
1620 if(info_.subsystems[destinationSubsystemID].hasRoutingManager)
1622 std::string localParentPath =
1625 __COUTT__ <<
"Inserting routing manager... " << localParentPath
1627 OUTCL(
"use_routing_manager: true",
1628 "auto-generated because subsystem '" +
1629 std::to_string(destinationSubsystemID) +
1630 "' has Routing Manager added");
1633 "routing_manager_hostname: \""
1634 << info_.subsystems[destinationSubsystemID].routingManagerHost
1637 ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME);
1638 OUT <<
"table_update_port: 0\n";
1639 OUT <<
"table_update_address: \"0.0.0.0\"\n";
1640 OUT <<
"table_update_multicast_interface: \"0.0.0.0\"\n";
1641 OUT <<
"table_acknowledge_port : 0\n";
1642 OUT <<
"routing_timeout_ms: " << routingTimeoutMs <<
"\n";
1643 OUT <<
"routing_retry_count: " << routingRetryCount <<
"\n";
1647 OUTCF(
"use_routing_manager: false",
1648 "auto-generated if subsystem '" +
1649 std::to_string(destinationSubsystemID) +
1650 "' has Routing Manager added",
1654 if(outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1657 info_.subsystems[mySubsystemID].eventMode =
true;
1663 if(outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1665 outputPlugin.second.getNode(
"outputModuleType").getValue() ==
1666 "TransferOutputReliable")
1668 OUT <<
"transfer_plugin: @local::TransferPluginConfig \n";
1672 OUT <<
"} # end " << outputPlugin.second.getNode(
"outputKey").getValue()
1675 if(!outputPlugin.second.status())
1680 OUT <<
"} # end outputs\n\n";
1684 __COUTS__(3) <<
"No outputs found" << __E__;
1685 std::string localParentPath =
1686 parentPath +
"/" + outputs.getParentLinkColumnName();
1687 OUTCL(
"# no outputs found",
"" );
1692 __COUTT__ <<
"Filling art.physics parentPath =" << parentPath << __E__;
1693 auto physics = art.
getNode(
"physicsLink");
1694 if(!physics.isDisconnected())
1696 __COUTT__ <<
"Inserting physics... " << parentPath << __E__;
1697 std::string localParentPath = parentPath +
"/" +
1698 physics.getParentLinkColumnName() +
":" +
1699 physics.getTableName() +
"/" +
1703 OUTCL(
"physics: {", physics.hasComment() ? services.getComment() :
"");
1709 __COUTT__ <<
"Inserting physics other parameters... " << localParentPath << __E__;
1714 physics.getNode(
"physicsOtherParametersLink"),
1715 "physicsParameter" ,
1719 auto analyzers = physics.getNode(
"analyzersLink");
1720 if(!analyzers.isDisconnected())
1722 __COUTT__ <<
"Inserting art.physics.analyzers... " << localParentPath
1724 std::string localParentPath2 =
1725 localParentPath +
"/" + analyzers.getParentLinkColumnName();
1726 __COUTT__ <<
"Inserting art.physics.analyzers... " << localParentPath2
1731 OUTCL2(
"analyzers: {",
"" );
1735 auto modules = analyzers.getChildren();
1736 for(
auto& module : modules)
1738 if(!module.second.status())
1745 auto analyzerNodeParameterLink =
1746 module.second.getNode(
"analyzerModuleParameterLink");
1749 __COUTT__ <<
"Inserting analyzer @table parameters... "
1750 << localParentPath2 << __E__;
1751 std::string localParentPath3 =
1752 localParentPath2 +
":" + module.second.getTableName() +
":" +
1753 analyzers.getParentLinkIndex() +
":" + analyzers.getParentLinkID() +
1754 "/" + module.second.getValue();
1755 __COUTT__ <<
"Inserting analyzer @table parameters... "
1756 << localParentPath3 << __E__;
1761 analyzerNodeParameterLink,
1762 "analyzerParameter" ,
1766 OUT << module.second.getNode(
"analyzerKey").getValue() <<
": {\n";
1772 module.second.getNode(
"analyzerModuleType"));
1776 __COUTT__ <<
"Inserting analayzer not @table parameters... "
1777 << localParentPath3 << __E__;
1782 analyzerNodeParameterLink,
1783 "analyzerParameter" ,
1790 if(!module.second.status())
1794 OUT <<
"} # end physics.analyzers\n\n";
1798 __COUTS__(3) <<
"No analyzers found" << __E__;
1799 std::string localParentPath2 =
1800 localParentPath +
"/" + analyzers.getParentLinkColumnName();
1801 OUTCL2(
"# no analyzers found",
"" );
1804 auto producers = physics.getNode(
"producersLink");
1805 if(!producers.isDisconnected())
1807 __COUTT__ <<
"Inserting art.physics.producers... " << localParentPath
1809 std::string localParentPath2 =
1810 localParentPath +
"/" + producers.getParentLinkColumnName();
1814 OUTCL2(
"producers: {",
"" );
1818 auto modules = producers.getChildren();
1819 for(
auto& module : modules)
1821 if(!module.second.status())
1828 auto producerNodeParameterLink =
1829 module.second.getNode(
"producerModuleParameterLink");
1832 __COUTT__ <<
"Inserting producer @table parameters... "
1833 << localParentPath2 << __E__;
1834 std::string localParentPath3 =
1835 localParentPath2 +
":" + module.second.getTableName() +
":" +
1836 producers.getParentLinkIndex() +
":" + producers.getParentLinkID() +
1837 "/" + module.second.getValue();
1838 __COUTT__ <<
"Inserting producer @table parameters... "
1839 << localParentPath3 << __E__;
1844 producerNodeParameterLink,
1845 "producerParameter" ,
1849 if(module.second.status() &&
1850 module.second.getNode(
"producerModuleType").getValue() ==
"")
1852 std::string tmp = localParentPath2;
1853 localParentPath2 = localParentPath3;
1854 OUTCL2F(
"# skipping '" << module.second.getValue()
1855 <<
"' with empty module type",
1857 "producerModuleType");
1858 localParentPath2 = tmp;
1862 OUT << module.second.getNode(
"producerKey").getValue() <<
": {\n";
1869 module.second.getNode(
"producerModuleType"));
1873 __COUTT__ <<
"Inserting producer not @table parameters... "
1874 << localParentPath3 << __E__;
1879 producerNodeParameterLink,
1880 "producerParameter" ,
1887 if(!module.second.status())
1891 OUT <<
"} # end physics.producers\n\n";
1895 __COUTS__(3) <<
"No producers found" << __E__;
1896 std::string localParentPath2 =
1897 localParentPath +
"/" + producers.getParentLinkColumnName();
1898 OUTCL2(
"# no producers found",
"" );
1901 auto filters = physics.getNode(
"filtersLink");
1902 if(!filters.isDisconnected())
1904 __COUTT__ <<
"Inserting art.physics.filters... " << localParentPath << __E__;
1905 std::string localParentPath2 =
1906 localParentPath +
"/" + filters.getParentLinkColumnName();
1910 OUTCL2(
"filters: {",
"" );
1914 auto modules = filters.getChildren();
1915 for(
auto& module : modules)
1917 if(!module.second.status())
1924 auto filterNodeParameterLink =
1925 module.second.getNode(
"filterModuleParameterLink");
1928 __COUTT__ <<
"Inserting filter @table parameters... " << localParentPath2
1930 std::string localParentPath3 =
1931 localParentPath2 +
":" + module.second.getTableName() +
":" +
1932 filters.getParentLinkIndex() +
":" + filters.getParentLinkID() +
"/" +
1933 module.second.getValue();
1934 __COUTT__ <<
"Inserting filter @table parameters... " << localParentPath3
1940 filterNodeParameterLink,
1944 if(module.second.status() &&
1945 module.second.getNode(
"filterModuleType").getValue() ==
"")
1947 std::string tmp = localParentPath2;
1948 localParentPath2 = localParentPath3;
1949 OUTCL2F(
"# skipping '" << module.second.getValue()
1950 <<
"' with empty module type",
1952 "filterModuleType");
1953 localParentPath2 = tmp;
1957 OUT << module.second.getNode(
"filterKey").getValue() <<
": {\n";
1964 module.second.getNode(
"filterModuleType"));
1968 __COUTT__ <<
"Inserting filter not @table parameters... "
1969 << localParentPath3 << __E__;
1974 filterNodeParameterLink,
1982 if(!module.second.status())
1986 OUT <<
"} # end physics.filters\n\n";
1990 __COUTS__(3) <<
"No filters found" << __E__;
1991 std::string localParentPath2 =
1992 localParentPath +
"/" + services.getParentLinkColumnName();
1993 OUTCL2(
"# no filters found",
"" );
1998 __COUTT__ <<
"Inserting art.physics not @table parameters... " << localParentPath
2004 physics.getNode(
"physicsOtherParametersLink"),
2005 "physicsParameter" ,
2010 OUT <<
"} # end physics\n\n";
2014 __COUTS__(3) <<
"No physics found" << __E__;
2015 std::string localParentPath =
2016 parentPath +
"/" + physics.getParentLinkColumnName();
2017 OUTCL(
"# no physics found",
"" );
2022 __COUTT__ <<
"Filling art.source" << __E__;
2023 auto source = art.
getNode(
"sourceLink");
2024 if(!source.isDisconnected())
2026 __COUTT__ <<
"Inserting source... " << parentPath << __E__;
2027 std::string localParentPath = parentPath +
"/" +
2028 source.getParentLinkColumnName() +
":" +
2029 source.getTableName() +
"/" +
2031 OUTCL(
"source: {", source.hasComment() ? source.getComment() :
"");
2034 out, tabStr, commentStr, parentPath, source.getNode(
"sourceModuleType"));
2040 std::string localParentPath = parentPath +
"/" + source.getParentLinkColumnName();
2041 OUTCL(
"source: { # auto-generated default, to change provide a source link",
2044 OUT <<
"module_type: ArtdaqInput";
2051 __COUTT__ <<
"Writing art.process_name" << __E__;
2052 OUTCF(
"process_name: " << art.
getNode(ARTDAQTableBase::colARTDAQArt_.colProcessName_),
2054 ARTDAQTableBase::colARTDAQArt_.colProcessName_);
2058 __COUTT__ <<
"Inserting art @table parameters... " << parentPath << __E__;
2063 art.
getNode(
"AddOnParametersLink"),
2071 void ARTDAQTableBase::outputRoutingManagerFHICL(
2073 size_t routingTimeoutMs ,
2074 size_t routingRetryCount )
2076 if(ARTDAQ_DONOTWRITE_FCL)
2078 __COUT__ <<
"Skipping fcl generation." << __E__;
2082 std::string filename =
2083 getFHICLFilename(ARTDAQAppType::RoutingManager, routingManagerNode.
getValue());
2089 std::string tabStr =
"";
2090 std::string commentStr =
"";
2092 __COUTV__(filename);
2093 out.open(filename, std::fstream::out | std::fstream::trunc);
2096 __SS__ <<
"Failed to open ARTDAQ RoutingManager fcl file: " << filename << __E__;
2104 OUT <<
"###########################################################" << __E__;
2105 OUT <<
"#" << __E__;
2106 OUT <<
"# artdaq " << getTypeString(ARTDAQAppType::RoutingManager)
2107 <<
" fcl configuration file produced by otsdaq." << __E__;
2108 OUT <<
"# Creation time: \t"
2110 OUT <<
"# Original filename: \t" << filename << __E__;
2111 OUT <<
"# otsdaq-ARTDAQ RoutingManager UID:\t" << routingManagerNode.
getValue()
2113 OUT <<
"#" << __E__;
2114 OUT <<
"###########################################################" << __E__;
2128 catch(
const std::runtime_error&)
2140 OUT <<
"policy: {\n";
2144 if(policyName ==
"DEFAULT")
2145 policyName =
"NoOp";
2146 OUT <<
"policy: " << policyName <<
"\n";
2147 OUT <<
"receiver_ranks: []\n";
2150 auto parametersLink = routingManagerNode.
getNode(
"routingPolicyParametersLink");
2151 if(!parametersLink.isDisconnected())
2154 for(
auto& parameter : parameters)
2156 if(!parameter.second.status())
2167 parameter.second.getNode(TableViewColumnInfo::COL_NAME_COMMENT);
2168 OUT << parameter.second.getNode(
"daqParameterKey").getValue() <<
": "
2169 << parameter.second.getNode(
"daqParameterValue").getValue()
2170 << (comment.isDefaultValue() ?
"" : (
"\t # " + comment.getValue()))
2173 if(!parameter.second.status())
2181 OUT <<
"use_routing_manager: true\n";
2183 auto routingManagerSubsystemID = 1;
2184 auto routingManagerSubsystemLink = routingManagerNode.
getNode(
"SubsystemLink");
2185 std::string rmHost =
"localhost";
2186 if(!routingManagerSubsystemLink.isDisconnected())
2188 routingManagerSubsystemID = getSubsytemId(routingManagerSubsystemLink);
2189 rmHost = info_.subsystems[routingManagerSubsystemID].routingManagerHost;
2191 if(rmHost ==
"localhost" || rmHost ==
"127.0.0.1")
2193 char hostbuf[HOST_NAME_MAX + 1];
2194 gethostname(hostbuf, HOST_NAME_MAX);
2195 rmHost = std::string(hostbuf);
2199 OUT <<
"routing_manager_hostname: \"" << rmHost <<
"\"\n";
2200 OUT <<
"sender_ranks: []\n";
2201 OUT <<
"table_update_port: 0\n";
2202 OUT <<
"table_update_address: \"0.0.0.0\"\n";
2203 OUT <<
"table_acknowledge_port: 0\n";
2204 OUT <<
"token_receiver: {\n";
2207 OUT <<
"routing_token_port: 0\n";
2213 auto tableUpdateIntervalMs =
2215 if(tableUpdateIntervalMs !=
"DEFAULT")
2217 OUT <<
"table_update_interval_ms: " << tableUpdateIntervalMs <<
"\n";
2219 auto tableAckRetryCount =
2221 if(tableAckRetryCount !=
"DEFAULT")
2223 OUT <<
"table_ack_retry_count: " << tableAckRetryCount <<
"\n";
2226 OUT <<
"routing_timeout_ms: " << routingTimeoutMs <<
"\n";
2227 OUT <<
"routing_retry_count: " << routingRetryCount <<
"\n";
2238 __COUTT__ <<
"outputReaderFHICL DONE" << __E__;
2242 __SS__ <<
"\n\nError while generating FHiCL for "
2243 << getTypeString(ARTDAQAppType::RoutingManager) <<
" node at filename '"
2244 << filename <<
"'" << __E__;
2249 catch(
const std::runtime_error& e)
2251 ss <<
" Here is the error: " << e.what() << __E__;
2253 catch(
const std::exception& e)
2255 ss <<
" Here is the error: " << e.what() << __E__;
2267 bool getStatusFalseNodes ,
2269 size_t maxFragmentSizeBytes ,
2270 size_t routingTimeoutMs ,
2271 size_t routingRetryCount ,
2275 progressBar->
step();
2278 info_.subsystems.clear();
2279 info_.processes.clear();
2282 progressBar->
step();
2284 info_.subsystems[NULL_SUBSYSTEM_DESTINATION].id = NULL_SUBSYSTEM_DESTINATION;
2285 info_.subsystems[NULL_SUBSYSTEM_DESTINATION].label = NULL_SUBSYSTEM_DESTINATION_LABEL;
2290 __COUT__ <<
"artdaqSupervisorNode is disconnected." << __E__;
2295 extractRoutingManagersInfo(artdaqSupervisorNode,
2296 getStatusFalseNodes,
2300 __COUT__ <<
"artdaqSupervisorNode RoutingManager size: "
2301 << info_.processes.at(ARTDAQAppType::RoutingManager).size() << __E__;
2304 progressBar->
step();
2306 extractBoardReadersInfo(artdaqSupervisorNode,
2307 getStatusFalseNodes,
2309 maxFragmentSizeBytes,
2312 __COUT__ <<
"artdaqSupervisorNode BoardReader size: "
2313 << info_.processes.at(ARTDAQAppType::BoardReader).size() << __E__;
2316 progressBar->
step();
2318 extractEventBuildersInfo(
2319 artdaqSupervisorNode, getStatusFalseNodes, doWriteFHiCL, maxFragmentSizeBytes);
2320 __COUT__ <<
"artdaqSupervisorNode EventBuilder size: "
2321 << info_.processes.at(ARTDAQAppType::EventBuilder).size() << __E__;
2324 progressBar->
step();
2326 extractDataLoggersInfo(
2327 artdaqSupervisorNode, getStatusFalseNodes, doWriteFHiCL, maxFragmentSizeBytes);
2328 __COUT__ <<
"artdaqSupervisorNode DataLogger size: "
2329 << info_.processes.at(ARTDAQAppType::DataLogger).size() << __E__;
2332 progressBar->
step();
2334 extractDispatchersInfo(
2335 artdaqSupervisorNode, getStatusFalseNodes, doWriteFHiCL, maxFragmentSizeBytes);
2336 __COUT__ <<
"artdaqSupervisorNode Dispatcher size: "
2337 << info_.processes.at(ARTDAQAppType::Dispatcher).size() << __E__;
2340 progressBar->
step();
2346 void ARTDAQTableBase::extractRoutingManagersInfo(
ConfigurationTree artdaqSupervisorNode,
2347 bool getStatusFalseNodes,
2349 size_t routingTimeoutMs,
2350 size_t routingRetryCount)
2352 __COUT__ <<
"Checking for Routing Managers..." << __E__;
2353 info_.processes[ARTDAQAppType::RoutingManager].clear();
2356 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToRoutingManagers_);
2359 std::vector<std::pair<std::string, ConfigurationTree>> routingManagers =
2362 __COUT__ <<
"There are " << routingManagers.size()
2363 <<
" configured Routing Managers" << __E__;
2365 for(
auto& routingManager : routingManagers)
2367 const std::string& rmUID = routingManager.first;
2369 if(getStatusFalseNodes || routingManager.second.status())
2371 std::string rmHost =
2372 routingManager.second
2373 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2374 .getValueWithDefault(
"localhost");
2375 if(rmHost ==
"localhost" || rmHost ==
"127.0.0.1")
2377 char hostbuf[HOST_NAME_MAX + 1];
2378 gethostname(hostbuf, HOST_NAME_MAX);
2379 rmHost = std::string(hostbuf);
2383 routingManager.second
2384 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2385 .getValueWithDefault(
"");
2387 int routingManagerSubsystemID = 1;
2389 routingManager.second.
getNode(
2390 ARTDAQTableBase::ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2393 routingManagerSubsystemID =
2394 getSubsytemId(routingManagerSubsystemLink);
2397 info_.subsystems[routingManagerSubsystemID].id =
2398 routingManagerSubsystemID;
2400 const std::string& routingManagerSubsystemName =
2404 info_.subsystems[routingManagerSubsystemID].label =
2405 routingManagerSubsystemName;
2407 if(info_.subsystems[routingManagerSubsystemID].hasRoutingManager)
2409 __SS__ <<
"Error: You cannot have multiple Routing Managers in a "
2415 auto routingManagerSubsystemDestinationLink =
2416 routingManagerSubsystemLink.
getNode(
2417 colARTDAQSubsystem_.colLinkToDestination_);
2418 if(routingManagerSubsystemDestinationLink.isDisconnected())
2421 info_.subsystems[routingManagerSubsystemID].destination = 0;
2426 info_.subsystems[routingManagerSubsystemID].destination =
2427 getSubsytemId(routingManagerSubsystemDestinationLink);
2433 if(!info_.subsystems.count(
2434 info_.subsystems[routingManagerSubsystemID].destination) ||
2436 .subsystems[info_.subsystems[routingManagerSubsystemID]
2438 .sources.count(routingManagerSubsystemID))
2441 .subsystems[info_.subsystems[routingManagerSubsystemID]
2443 .sources.insert(routingManagerSubsystemID);
2448 __COUT__ <<
"Found Routing Manager with UID " << rmUID
2449 <<
", DAQInterface Hostname " << rmHost <<
", and Subsystem "
2450 << routingManagerSubsystemID << __E__;
2451 info_.processes[ARTDAQAppType::RoutingManager].emplace_back(
2455 routingManagerSubsystemID,
2456 ARTDAQAppType::RoutingManager,
2457 routingManager.second.status());
2459 info_.subsystems[routingManagerSubsystemID].hasRoutingManager =
true;
2460 info_.subsystems[routingManagerSubsystemID].routingManagerHost = rmHost;
2464 outputRoutingManagerFHICL(
2465 routingManager.second, routingTimeoutMs, routingRetryCount);
2467 flattenFHICL(ARTDAQAppType::RoutingManager,
2468 routingManager.second.getValue());
2473 __COUT__ <<
"Routing Manager " << rmUID <<
" is disabled." << __E__;
2480 void ARTDAQTableBase::extractBoardReadersInfo(
ConfigurationTree artdaqSupervisorNode,
2481 bool getStatusFalseNodes,
2483 size_t maxFragmentSizeBytes,
2484 size_t routingTimeoutMs,
2485 size_t routingRetryCount)
2487 __COUT__ <<
"Checking for Board Readers..." << __E__;
2488 info_.processes[ARTDAQAppType::BoardReader].clear();
2491 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToBoardReaders_);
2494 std::vector<std::pair<std::string, ConfigurationTree>> readers =
2496 __COUT__ <<
"There are " << readers.size() <<
" configured Board Readers."
2499 for(
auto& reader : readers)
2501 const std::string& readerUID = reader.first;
2503 if(getStatusFalseNodes || reader.second.status())
2505 std::string readerHost =
2506 reader.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2507 .getValueWithDefault(
"localhost");
2508 std::string readerAP =
2510 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2511 .getValueWithDefault(
"");
2513 int readerSubsystemID = 1;
2515 reader.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2518 readerSubsystemID = getSubsytemId(readerSubsystemLink);
2520 info_.subsystems[readerSubsystemID].id = readerSubsystemID;
2522 const std::string& readerSubsystemName =
2526 info_.subsystems[readerSubsystemID].label = readerSubsystemName;
2528 auto readerSubsystemDestinationLink = readerSubsystemLink.
getNode(
2529 colARTDAQSubsystem_.colLinkToDestination_);
2530 if(readerSubsystemDestinationLink.isDisconnected())
2533 info_.subsystems[readerSubsystemID].destination = 0;
2538 info_.subsystems[readerSubsystemID].destination =
2539 getSubsytemId(readerSubsystemDestinationLink);
2545 if(!info_.subsystems.count(
2546 info_.subsystems[readerSubsystemID].destination) ||
2547 !info_.subsystems[info_.subsystems[readerSubsystemID].destination]
2548 .sources.count(readerSubsystemID))
2550 info_.subsystems[info_.subsystems[readerSubsystemID].destination]
2551 .sources.insert(readerSubsystemID);
2556 __COUT__ <<
"Found Board Reader with UID " << readerUID
2557 <<
", DAQInterface Hostname " << readerHost <<
", and Subsystem "
2558 << readerSubsystemID << __E__;
2559 info_.processes[ARTDAQAppType::BoardReader].emplace_back(
2564 ARTDAQAppType::BoardReader,
2565 reader.second.status());
2569 outputBoardReaderFHICL(reader.second,
2570 maxFragmentSizeBytes,
2574 flattenFHICL(ARTDAQAppType::BoardReader, reader.second.getValue());
2579 __COUT__ <<
"Board Reader " << readerUID <<
" is disabled." << __E__;
2585 __COUT_WARN__ <<
"There should be at least one Board Reader!";
2592 void ARTDAQTableBase::extractEventBuildersInfo(
ConfigurationTree artdaqSupervisorNode,
2593 bool getStatusFalseNodes,
2595 size_t maxFragmentSizeBytes)
2597 __COUT__ <<
"Checking for Event Builders..." << __E__;
2598 info_.processes[ARTDAQAppType::EventBuilder].clear();
2601 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToEventBuilders_);
2604 std::vector<std::pair<std::string, ConfigurationTree>> builders =
2607 std::string lastBuilderFcl[2],
2608 flattenedLastFclParts
2610 for(
auto& builder : builders)
2612 const std::string& builderUID = builder.first;
2613 __COUTV__(builderUID);
2615 if(getStatusFalseNodes || builder.second.status())
2617 std::string builderHost =
2618 builder.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2619 .getValueWithDefault(
"localhost");
2620 std::string builderAP =
2622 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2623 .getValueWithDefault(
"");
2625 int builderSubsystemID = 1;
2627 builder.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2630 builderSubsystemID = getSubsytemId(builderSubsystemLink);
2633 info_.subsystems[builderSubsystemID].id = builderSubsystemID;
2635 const std::string& builderSubsystemName =
2639 info_.subsystems[builderSubsystemID].label = builderSubsystemName;
2641 auto builderSubsystemDestinationLink = builderSubsystemLink.
getNode(
2642 colARTDAQSubsystem_.colLinkToDestination_);
2643 if(builderSubsystemDestinationLink.isDisconnected())
2646 info_.subsystems[builderSubsystemID].destination = 0;
2651 info_.subsystems[builderSubsystemID].destination =
2652 getSubsytemId(builderSubsystemDestinationLink);
2658 if(!info_.subsystems.count(
2659 info_.subsystems[builderSubsystemID].destination) ||
2660 !info_.subsystems[info_.subsystems[builderSubsystemID].destination]
2661 .sources.count(builderSubsystemID))
2663 info_.subsystems[info_.subsystems[builderSubsystemID].destination]
2664 .sources.insert(builderSubsystemID);
2669 __COUT__ <<
"Found Event Builder with UID " << builderUID
2670 <<
", on Hostname " << builderHost <<
", in Subsystem "
2671 << builderSubsystemID << __E__;
2672 info_.processes[ARTDAQAppType::EventBuilder].emplace_back(
2677 ARTDAQAppType::EventBuilder,
2678 builder.second.status());
2682 std::string returnFcl, processName;
2683 bool needToFlatten =
true;
2684 bool captureAsLastFcl =
2687 (&builder != &builders.back());
2689 ARTDAQAppType::EventBuilder,
2690 maxFragmentSizeBytes,
2691 DEFAULT_ROUTING_TIMEOUT_MS,
2692 DEFAULT_ROUTING_RETRY_COUNT,
2693 captureAsLastFcl ? &returnFcl :
nullptr);
2700 auto cmi = returnFcl.find(
2701 "# otsdaq-ARTDAQ builder UID:");
2702 if(cmi != std::string::npos)
2703 cmi = returnFcl.find(
'\n', cmi);
2704 if(cmi != std::string::npos)
2706 size_t pnj = std::string::npos;
2708 returnFcl.find(
"\tprocess_name: ", cmi);
2709 if(pni != std::string::npos)
2711 pni += std::string(
"\tprocess_name: ")
2713 pnj = returnFcl.find(
'\n', pni);
2715 if(pnj != std::string::npos)
2717 processName = returnFcl.substr(pni, pnj - pni);
2718 __COUT__ <<
"Found process name = " << processName << __E__;
2720 bool sameFirst =
false;
2722 std::string newPiece = returnFcl.substr(cmi, pni - cmi);
2723 if(flattenedLastFclParts[0].size() &&
2724 lastBuilderFcl[0].size() && lastBuilderFcl[0] == newPiece)
2726 __COUT__ <<
"Same first fcl" << __E__;
2731 __COUTVS__(20, lastBuilderFcl[0]);
2732 __COUTVS__(20, newPiece);
2733 for(
size_t i = 0, j = 0;
2734 i < lastBuilderFcl[0].size() && j < newPiece.size();
2737 if(lastBuilderFcl[0][i] != newPiece[j])
2741 __COUTVS__(20, lastBuilderFcl[0].substr(i, 30));
2742 __COUTVS__(20, newPiece.substr(j, 30));
2747 if(captureAsLastFcl)
2748 lastBuilderFcl[0] = newPiece;
2751 newPiece = returnFcl.substr(pnj);
2752 if(lastBuilderFcl[0].size() && lastBuilderFcl[1] == newPiece)
2754 __COUT__ <<
"Same second fcl" << __E__;
2757 std::chrono::steady_clock::time_point startClock =
2758 std::chrono::steady_clock::now();
2759 __COUT__ <<
"Found fcl match! Reuse for "
2760 << builderUID << __E__;
2763 needToFlatten =
false;
2766 std::string outFile = getFlatFHICLFilename(
2767 ARTDAQAppType::EventBuilder, builderUID);
2768 __COUTVS__(3, outFile);
2769 std::ofstream ofs{outFile};
2772 __SS__ <<
"Failed to open fhicl output file '"
2773 << outFile <<
"!'" << __E__;
2776 ofs << flattenedLastFclParts[0] <<
"process_name: \""
2777 << processName <<
"\""
2778 << flattenedLastFclParts[1];
2780 << builderUID <<
" Flatten Clock time = "
2781 << artdaq::TimeUtils::GetElapsedTime(startClock)
2786 if(captureAsLastFcl)
2787 lastBuilderFcl[1] = newPiece;
2792 ARTDAQTableBase::flattenFHICL(
2793 ARTDAQAppType::EventBuilder,
2795 captureAsLastFcl ? &returnFcl :
nullptr);
2797 __COUT__ <<
"Skipping full flatten for " << builderUID << __E__;
2800 __COUTV__(captureAsLastFcl);
2801 if(captureAsLastFcl)
2803 size_t pnj = std::string::npos;
2804 auto pni = returnFcl.find(
"process_name:");
2805 if(pni != std::string::npos)
2809 (returnFcl[pni - 1] ==
' ' || returnFcl[pni - 1] ==
'\n' ||
2810 returnFcl[pni - 1] ==
'\t'))
2811 pnj = returnFcl.find(
'\n', pni);
2813 if(pnj != std::string::npos)
2816 <<
"Found flattened '"
2817 << returnFcl.substr(pni, pnj - pni) <<
"' at pos " << pni
2818 <<
" of " << returnFcl.size() << __E__;
2819 flattenedLastFclParts[0] = returnFcl.substr(0, pni);
2820 flattenedLastFclParts[1] = returnFcl.substr(pnj);
2824 __COUT_WARN__ <<
"Failed to capture fcl for " << processName
2832 __COUT__ <<
"Event Builder " << builderUID <<
" is disabled." << __E__;
2838 __COUT_WARN__ <<
"There should be at least one Event Builder!";
2845 void ARTDAQTableBase::extractDataLoggersInfo(
ConfigurationTree artdaqSupervisorNode,
2846 bool getStatusFalseNodes,
2848 size_t maxFragmentSizeBytes)
2850 __COUT__ <<
"Checking for Data Loggers..." << __E__;
2851 info_.processes[ARTDAQAppType::DataLogger].clear();
2854 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToDataLoggers_);
2857 std::vector<std::pair<std::string, ConfigurationTree>> dataloggers =
2860 for(
auto& datalogger : dataloggers)
2862 const std::string& loggerUID = datalogger.first;
2864 if(getStatusFalseNodes || datalogger.second.status())
2866 std::string loggerHost =
2867 datalogger.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2868 .getValueWithDefault(
"localhost");
2869 std::string loggerAP =
2871 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2872 .getValueWithDefault(
"");
2874 int loggerSubsystemID = 1;
2876 datalogger.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2879 loggerSubsystemID = getSubsytemId(loggerSubsystemLink);
2881 info_.subsystems[loggerSubsystemID].id = loggerSubsystemID;
2883 const std::string& loggerSubsystemName =
2887 info_.subsystems[loggerSubsystemID].label = loggerSubsystemName;
2889 auto loggerSubsystemDestinationLink = loggerSubsystemLink.
getNode(
2890 colARTDAQSubsystem_.colLinkToDestination_);
2891 if(loggerSubsystemDestinationLink.isDisconnected())
2894 info_.subsystems[loggerSubsystemID].destination = 0;
2899 info_.subsystems[loggerSubsystemID].destination =
2900 getSubsytemId(loggerSubsystemDestinationLink);
2906 if(!info_.subsystems.count(
2907 info_.subsystems[loggerSubsystemID].destination) ||
2908 !info_.subsystems[info_.subsystems[loggerSubsystemID].destination]
2909 .sources.count(loggerSubsystemID))
2911 info_.subsystems[info_.subsystems[loggerSubsystemID].destination]
2912 .sources.insert(loggerSubsystemID);
2917 __COUT__ <<
"Found Data Logger with UID " << loggerUID
2918 <<
", DAQInterface Hostname " << loggerHost <<
", and Subsystem "
2919 << loggerSubsystemID << __E__;
2920 info_.processes[ARTDAQAppType::DataLogger].emplace_back(
2925 ARTDAQAppType::DataLogger,
2926 datalogger.second.status());
2931 ARTDAQAppType::DataLogger,
2932 maxFragmentSizeBytes);
2934 flattenFHICL(ARTDAQAppType::DataLogger, datalogger.second.getValue());
2939 __COUT__ <<
"Data Logger " << loggerUID <<
" is disabled." << __E__;
2945 __COUT_WARN__ <<
"There were no Data Loggers found!";
2950 void ARTDAQTableBase::extractDispatchersInfo(
ConfigurationTree artdaqSupervisorNode,
2951 bool getStatusFalseNodes,
2953 size_t maxFragmentSizeBytes)
2955 __COUT__ <<
"Checking for Dispatchers..." << __E__;
2956 info_.processes[ARTDAQAppType::Dispatcher].clear();
2959 artdaqSupervisorNode.
getNode(colARTDAQSupervisor_.colLinkToDispatchers_);
2962 std::vector<std::pair<std::string, ConfigurationTree>> dispatchers =
2965 for(
auto& dispatcher : dispatchers)
2967 const std::string& dispatcherUID = dispatcher.first;
2969 if(getStatusFalseNodes || dispatcher.second.status())
2971 std::string dispatcherHost =
2972 dispatcher.second.getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_HOSTNAME)
2973 .getValueWithDefault(
"localhost");
2974 std::string dispatcherAP =
2976 .getNode(ARTDAQTableBase::ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS)
2977 .getValueWithDefault(
"");
2978 int dispatcherPort =
2979 dispatcher.second.getNode(
"DispatcherPort").getValue<
int>();
2981 auto dispatcherSubsystemID = 1;
2983 dispatcher.second.
getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK);
2986 dispatcherSubsystemID = getSubsytemId(dispatcherSubsystemLink);
2988 info_.subsystems[dispatcherSubsystemID].id = dispatcherSubsystemID;
2990 const std::string& dispatcherSubsystemName =
2994 info_.subsystems[dispatcherSubsystemID].label =
2995 dispatcherSubsystemName;
2997 auto dispatcherSubsystemDestinationLink =
2998 dispatcherSubsystemLink.
getNode(
2999 colARTDAQSubsystem_.colLinkToDestination_);
3000 if(dispatcherSubsystemDestinationLink.isDisconnected())
3003 info_.subsystems[dispatcherSubsystemID].destination = 0;
3008 info_.subsystems[dispatcherSubsystemID].destination =
3009 getSubsytemId(dispatcherSubsystemDestinationLink);
3015 if(!info_.subsystems.count(
3016 info_.subsystems[dispatcherSubsystemID].destination) ||
3018 .subsystems[info_.subsystems[dispatcherSubsystemID]
3020 .sources.count(dispatcherSubsystemID))
3023 .subsystems[info_.subsystems[dispatcherSubsystemID]
3025 .sources.insert(dispatcherSubsystemID);
3029 __COUT__ <<
"Found Dispatcher with UID " << dispatcherUID
3030 <<
", DAQInterface Hostname " << dispatcherHost
3031 <<
", and Subsystem " << dispatcherSubsystemID << __E__;
3032 info_.processes[ARTDAQAppType::Dispatcher].emplace_back(
3036 dispatcherSubsystemID,
3037 ARTDAQAppType::Dispatcher,
3038 dispatcher.second.status(),
3044 ARTDAQAppType::Dispatcher,
3045 maxFragmentSizeBytes);
3047 flattenFHICL(ARTDAQAppType::Dispatcher, dispatcher.second.getValue());
3052 __COUT__ <<
"Dispatcher " << dispatcherUID <<
" is disabled." << __E__;
3058 __COUT_WARN__ <<
"There were no Dispatchers found!";
3068 for(
auto context : contexts)
3070 if(!context.second.isEnabled())
3073 auto apps = context.second
3074 .getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
3076 for(
auto app : apps)
3079 if(app.second.getNode(XDAQContextTable::colApplication_.colClass_)
3080 .getValue() == ARTDAQ_SUPERVISOR_CLASS &&
3081 app.second.isEnabled())
3099 std::map<std::string ,
3100 std::map<std::string , std::vector<std::string /*property*/>>>&
3101 nodeTypeToObjectMap,
3102 std::map<std::string /*subsystemName*/, std::string /*destinationSubsystemName*/>&
3104 std::vector<std::string /*property*/>& artdaqSupervisoInfo)
3106 __COUT__ <<
"getARTDAQSystem()" << __E__;
3108 artdaqSupervisoInfo.clear();
3119 return ARTDAQTableBase::info_;
3121 __COUTV__(artdaqContext->contextUID_);
3122 __COUTV__(artdaqContext->applications_.size());
3125 std::map<std::string , std::set<std::string >> nodeLayoutNames;
3127 const std::string& finalContextGroupName =
3128 cfgMgr->getActiveGroupName(ConfigurationManager::GroupType::CONTEXT_TYPE);
3130 cfgMgr->getActiveGroupKey(ConfigurationManager::GroupType::CONTEXT_TYPE);
3131 const std::string& finalConfigGroupName = cfgMgr->getActiveGroupName(
3132 ConfigurationManager::GroupType::CONFIGURATION_TYPE);
3133 const TableGroupKey& finalConfigGroupKey = cfgMgr->getActiveGroupKey(
3134 ConfigurationManager::GroupType::CONFIGURATION_TYPE);
3139 std::stringstream layoutPath;
3140 layoutPath << ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH
3141 << finalContextGroupName <<
"_" << finalContextGroupKey <<
"."
3142 << finalConfigGroupName <<
"_" << finalConfigGroupKey <<
".dat";
3144 fp = fopen(layoutPath.str().c_str(),
"r");
3147 __COUT__ <<
"Layout file not found for '" << finalContextGroupName <<
"("
3148 << finalContextGroupKey <<
") + " << finalConfigGroupName <<
"("
3149 << finalConfigGroupKey <<
")': " << layoutPath.
str() << __E__;
3153 __COUTV__(layoutPath.str());
3157 std::stringstream layoutPath;
3158 layoutPath << ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH
3159 << finalContextGroupName <<
"_" << finalContextGroupKey <<
".dat";
3160 __COUTV__(layoutPath.str());
3162 fp = fopen(layoutPath.str().c_str(),
"r");
3165 __COUT__ <<
"Layout file not found for '" << finalContextGroupName <<
"("
3166 << finalContextGroupKey <<
")': " << layoutPath.str() << __E__;
3169 __COUTV__(layoutPath.str());
3175 struct dirent* entry;
3180 float bestScore = 0, score;
3181 std::string bestName =
"";
3183 if(!(pDIR = opendir((ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH).c_str())))
3185 __SS__ <<
"Path '" << ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH
3186 <<
"' could not be opened!" << __E__;
3191 while((entry = readdir(pDIR)))
3193 name = std::string(entry->d_name);
3194 type = int(entry->d_type);
3196 __COUTS__(2) << type <<
" " << name <<
"\n" << std::endl;
3198 if(name[0] !=
'.' &&
3208 if(type == 0 || type == 10)
3211 DIR* pTmpDIR = opendir(
3212 (ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH +
"/" + name)
3220 __COUTS__(2) <<
"Unable to open path as directory: "
3221 << (ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH +
3233 __COUTS__(2) <<
"Directory: " << type <<
" " << name << __E__;
3237 __COUTS__(2) <<
"File: " << type <<
" " << name <<
"\n"
3239 if(name.find(
".dat") !=
3243 __COUTS__(2) <<
"Contender: " << name <<
"\n" << std::endl;
3248 if(nameSplit.size() > 1)
3251 auto keyi = nameSplit[1].rfind(
'_');
3252 if(keyi != std::string::npos)
3256 .substr(keyi, nameSplit[1].size() - 4 - keyi)
3260 finalConfigGroupKey.key() -
3266 __COUTVS__(2, tmpscore);
3270 __COUTVS__(2, tmpscore);
3273 std::string nameToCompare = nameSplit[1].substr(0, keyi);
3274 __COUTVS__(2, nameToCompare);
3275 size_t i = 0, j = 0;
3277 for(; i < nameToCompare.size() &&
3278 j < finalConfigGroupName.size();
3281 if(nameToCompare[i] == finalConfigGroupName[j])
3287 __COUTVS__(2, tmpscore);
3289 for(; i < nameToCompare.size() &&
3290 j < finalConfigGroupName.size();
3293 if(nameToCompare[i] == finalConfigGroupName[j])
3299 __COUTVS__(2, tmpscore);
3302 __COUTVS__(2, score);
3304 if(nameSplit.size() > 0)
3307 auto keyi = nameSplit[0].rfind(
'_');
3308 if(keyi != std::string::npos)
3312 .substr(keyi, nameSplit[0].size() - 4 - keyi)
3316 finalContextGroupKey.key() -
3322 __COUTVS__(2, tmpscore);
3326 __COUTVS__(2, tmpscore);
3329 std::string nameToCompare = nameSplit[0].substr(0, keyi);
3330 __COUTVS__(2, nameToCompare);
3331 size_t i = 0, j = 0;
3333 for(; i < nameToCompare.size() &&
3334 j < finalContextGroupName.size();
3337 if(nameToCompare[i] == finalContextGroupName[j])
3343 __COUTVS__(2, tmpscore);
3345 for(; i < nameToCompare.size() &&
3346 j < finalContextGroupName.size();
3349 if(nameToCompare[i] == finalContextGroupName[j])
3355 __COUTVS__(2, tmpscore);
3358 __COUTVS__(2, score);
3361 if(score > bestScore)
3365 __COUTVS__(2, bestName);
3373 __COUT__ <<
"Found closest layout file name: " << bestName <<
".dat"
3375 std::stringstream layoutPath;
3376 layoutPath << ARTDAQTableBase::ARTDAQ_CONFIG_LAYOUTS_PATH << bestName
3378 __COUTV__(layoutPath.str());
3379 fp = fopen(layoutPath.str().c_str(),
"r");
3382 __COUT__ <<
"Closest layout file not found for '" << bestName <<
"'"
3392 __COUT__ <<
"Extract info from layout file.." << __E__;
3398 const size_t maxLineSz = 1000;
3399 char line[maxLineSz];
3400 if(!fgets(line, maxLineSz, fp))
3403 __COUT__ <<
"No layout naming info found." << __E__;
3409 char name[maxLineSz];
3410 char type[maxLineSz];
3412 while(fgets(line, maxLineSz, fp))
3415 sscanf(line,
"%s %s %u %u", type, name, &x, &y);
3416 nodeLayoutNames[type].emplace(name);
3431 for(
auto& artdaqApp : artdaqContext->applications_)
3433 if(artdaqApp.class_ != ARTDAQ_SUPERVISOR_CLASS)
3436 __COUTV__(artdaqApp.applicationUID_);
3437 artdaqSupervisoInfo.push_back(artdaqApp.applicationUID_);
3438 artdaqSupervisoInfo.push_back(
3439 (artdaqContext->status_ && artdaqApp.status_) ?
"1" :
"0");
3440 artdaqSupervisoInfo.push_back(artdaqContext->address_);
3441 artdaqSupervisoInfo.push_back(std::to_string(artdaqContext->port_));
3444 XDAQContextTable::getSupervisorConfigNode(
3446 artdaqContext->contextUID_,
3447 artdaqApp.applicationUID_),
3450 __COUT__ <<
"========== "
3451 <<
"Found " << info.subsystems.size() <<
" subsystems." << __E__;
3454 for(
auto& subsystem : info.subsystems)
3455 subsystemObjectMap.emplace(std::make_pair(
3456 subsystem.second.label, std::to_string(subsystem.second.destination)));
3458 __COUT__ <<
"========== "
3459 <<
"Found " << info.processes.size() <<
" process types." << __E__;
3463 const std::string& typeString = nameTypePair.first;
3464 __COUTV__(typeString);
3466 nodeTypeToObjectMap.emplace(
3467 std::make_pair(typeString,
3468 std::map<std::string ,
3469 std::vector<std::string /*property*/>>()));
3471 auto it = info.processes.find(nameTypePair.second);
3472 if(it == info.processes.end())
3475 <<
"Found 0 " << typeString << __E__;
3479 <<
"Found " << it->second.size() <<
" " << typeString <<
"(s)"
3485 __SS__ <<
"Invalid artdaq node type '" << typeString <<
"' attempted!"
3489 __COUTV__(tableIt->second);
3492 std::stringstream ss;
3493 cfgMgr->getTableByName(tableIt->second)->getView().print(ss);
3494 __COUT_MULTI__(1, ss.str());
3504 const std::set<std::string > skipColumns(
3505 {ARTDAQ_TYPE_TABLE_HOSTNAME,
3506 ARTDAQ_TYPE_TABLE_ALLOWED_PROCESSORS,
3507 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK,
3509 .colDaqFragmentIDs_,
3510 TableViewColumnInfo::COL_NAME_COMMENT,
3511 TableViewColumnInfo::COL_NAME_AUTHOR,
3512 TableViewColumnInfo::
3513 COL_NAME_CREATION});
3515 if(TTEST(1) && nodeLayoutNames.find(typeString) != nodeLayoutNames.end())
3521 for(
auto& artdaqNode : it->second)
3524 if(skipSet.find(StringMacros::encodeURIComponent(artdaqNode.label)) !=
3529 <<
"Found '" << artdaqNode.label <<
"' " << typeString << __E__;
3531 std::string nodeName = artdaqNode.label;
3532 bool status = artdaqNode.status;
3533 std::string hostname = artdaqNode.hostname;
3534 std::string subsystemId = std::to_string(artdaqNode.subsystem);
3535 std::string subsystemName =
3536 info.subsystems.at(artdaqNode.subsystem).label;
3547 std::vector<std::string> multiNodeNames, hostnameArray;
3552 StringMacros::encodeURIComponent(nodeName));
3554 __COUTV__(allNodes.size());
3555 for(
auto& otherNode : allNodes)
3557 if(skipSet.find(StringMacros::encodeURIComponent(otherNode.first)) !=
3559 otherNode.second.status() != status)
3566 otherNode.second.getNode(ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID)
3575 auto otherNodeColumns = otherNode.second.getChildren();
3577 bool isMultiNode =
true;
3578 for(
unsigned int i = 0;
3579 i < thisNodeColumns.size() && i < otherNodeColumns.size();
3583 if(skipColumns.find(thisNodeColumns[i].first) !=
3584 skipColumns.end() ||
3585 thisNodeColumns[i].second.isLinkNode())
3596 if(thisNodeColumns[i].second.getValue() !=
3597 otherNodeColumns[i].second.getValue())
3599 __COUT__ <<
"Mismatch, not multi-node member." << __E__;
3600 isMultiNode =
false;
3607 __COUT__ <<
"Found '" << nodeName
3608 <<
"' multi-node member candidate '"
3609 << otherNode.first <<
"'" << __E__;
3612 if(!multiNodeNames.size())
3614 multiNodeNames.push_back(
3615 StringMacros::encodeURIComponent(nodeName));
3616 hostnameArray.push_back(
3617 StringMacros::encodeURIComponent(hostname));
3619 multiNodeNames.push_back(
3620 StringMacros::encodeURIComponent(otherNode.first));
3621 hostnameArray.push_back(StringMacros::encodeURIComponent(
3622 otherNode.second.getNode(ARTDAQ_TYPE_TABLE_HOSTNAME)
3625 __COUTV__(hostnameArray.back());
3627 StringMacros::encodeURIComponent(otherNode.first));
3632 unsigned int nodeFixedWildcardLength = 0, hostFixedWildcardLength = 0;
3633 std::string multiNodeString =
"", hostArrayString =
"";
3635 __COUTV__(nodeName);
3637 if(multiNodeNames.size() > 1)
3639 __COUT__ <<
"Handling multi-node printer syntax" << __E__;
3646 if(nodeLayoutNames.find(typeString) != nodeLayoutNames.end())
3654 std::string bestNodeLayoutName =
"";
3655 size_t bestNodeLayoutMatchCount =
3656 multiNodeNames.size() + 1;
3658 for(
const auto& layoutNameFull : nodeLayoutNames.at(typeString))
3660 __COUTTV__(layoutNameFull);
3661 size_t statusPos = layoutNameFull.find(
";status=");
3662 std::string layoutName = layoutNameFull.substr(0, statusPos);
3663 bool layoutStatus =
true;
3667 layoutStatus = status;
3669 layoutNameFull.substr(statusPos +
3670 std::string(
";status=").size()))
3671 layoutStatus =
false;
3673 __COUTTV__(layoutStatus);
3675 if(layoutStatus != status)
3677 __COUTT__ <<
"Status mismatch for template" << __E__;
3685 bool exactMatch =
true;
3687 for(
const auto& layoutSeg : layoutSplit)
3688 if((pos = nodeName.find(layoutSeg, pos)) ==
3691 __COUTT__ <<
"Did not find '" << layoutSeg <<
"' in '"
3692 << nodeName <<
"'" << __E__;
3697 __COUTTV__(exactMatch);
3700 size_t nodeLayoutMatchCount = 1;
3702 __COUT__ <<
"Found layout template name match! '"
3703 << layoutName <<
"' for node '" << nodeName
3704 <<
".' Trimming multinode candidates to match..."
3707 for(
unsigned int i = 1; i < multiNodeNames.size(); ++i)
3709 __COUTTV__(multiNodeNames[i]);
3710 std::string multiNodeName =
3713 __COUTTV__(multiNodeName);
3714 bool exactMatch =
true;
3716 for(
const auto& layoutSeg : layoutSplit)
3717 if((pos = multiNodeName.find(layoutSeg, pos)) ==
3720 __COUTT__ <<
"Did not find '" << layoutSeg
3721 <<
"' in '" << multiNodeName <<
"'"
3729 ++nodeLayoutMatchCount;
3730 __COUTT__ <<
"Found '" << layoutName <<
"' in '"
3731 << multiNodeName <<
"'" << __E__;
3736 __COUTTV__(nodeLayoutMatchCount);
3737 if(nodeLayoutMatchCount < bestNodeLayoutMatchCount)
3739 bestNodeLayoutName = layoutNameFull;
3740 bestNodeLayoutMatchCount = nodeLayoutMatchCount;
3741 __COUTTV__(bestNodeLayoutName);
3742 __COUTTV__(bestNodeLayoutMatchCount);
3747 __COUTV__(nodeName);
3753 if(bestNodeLayoutMatchCount > 0)
3755 __COUTV__(bestNodeLayoutName);
3756 std::string layoutNameFull = bestNodeLayoutName;
3757 __COUTTV__(layoutNameFull);
3758 size_t statusPos = layoutNameFull.find(
";status=");
3759 std::string layoutName = layoutNameFull.substr(0, statusPos);
3765 __COUT__ <<
"Found layout template name match! '"
3766 << layoutName <<
"' for node '" << nodeName
3767 <<
".' Trimming multinode candidates to match..."
3770 for(
unsigned int i = 1; i < multiNodeNames.size(); ++i)
3772 __COUTTV__(multiNodeNames[i]);
3773 std::string multiNodeName =
3775 __COUTTV__(multiNodeName);
3776 bool exactMatch =
true;
3778 for(
const auto& layoutSeg : layoutSplit)
3779 if((pos = multiNodeName.find(layoutSeg, pos)) ==
3782 __COUTT__ <<
"Did not find '" << layoutSeg
3783 <<
"' in '" << multiNodeName <<
"'"
3791 __COUT__ <<
"Trimming multinode candidate '"
3792 << multiNodeName <<
"'" << __E__;
3793 skipSet.erase(multiNodeNames[i]);
3794 multiNodeNames.erase(multiNodeNames.begin() + i);
3795 hostnameArray.erase(hostnameArray.begin() + i);
3802 __COUTV__(nodeName);
3809 unsigned int maxScore = 0;
3811 unsigned int minScore = -1;
3812 std::vector<unsigned int> scoreVector;
3813 scoreVector.push_back(-1);
3814 for(
unsigned int i = 1; i < multiNodeNames.size(); ++i)
3818 __COUTS__(3) << multiNodeNames[0] <<
" vs "
3819 << multiNodeNames[i] << __E__;
3822 for(
unsigned int j = 0, k = 0; j < multiNodeNames[0].size() &&
3823 k < multiNodeNames[i].size();
3826 while(j < multiNodeNames[0].size() &&
3827 !(multiNodeNames[0][j] >=
'a' &&
3828 multiNodeNames[0][j] <=
'z') &&
3829 !(multiNodeNames[0][j] >=
'A' &&
3830 multiNodeNames[0][j] <=
'Z'))
3832 while(k < multiNodeNames[i].size() &&
3833 !(multiNodeNames[i][k] >=
'a' &&
3834 multiNodeNames[i][k] <=
'z') &&
3835 !(multiNodeNames[i][k] >=
'A' &&
3836 multiNodeNames[i][k] <=
'Z'))
3839 while(k < multiNodeNames[i].size() &&
3840 multiNodeNames[0][j] != multiNodeNames[i][k])
3844 << j <<
"-" << k <<
" of " << multiNodeNames[0].size()
3845 <<
"-" << multiNodeNames[i].size() << __E__;
3847 if(j < multiNodeNames[0].size() &&
3848 k < multiNodeNames[i].size())
3852 __COUTVS__(3, score);
3855 for(
unsigned int j = multiNodeNames[0].size() - 1,
3856 k = multiNodeNames[i].size() - 1;
3857 j < multiNodeNames[0].size() &&
3858 k < multiNodeNames[i].size();
3861 while(j < multiNodeNames[0].size() &&
3862 !(multiNodeNames[0][j] >=
'a' &&
3863 multiNodeNames[0][j] <=
'z') &&
3864 !(multiNodeNames[0][j] >=
'A' &&
3865 multiNodeNames[0][j] <=
'Z'))
3867 while(k < multiNodeNames[i].size() &&
3868 !(multiNodeNames[i][k] >=
'a' &&
3869 multiNodeNames[i][k] <=
'z') &&
3870 !(multiNodeNames[i][k] >=
'A' &&
3871 multiNodeNames[i][k] <=
'Z'))
3874 while(k < multiNodeNames[i].size() &&
3875 multiNodeNames[0][j] != multiNodeNames[i][k])
3878 __COUTS__(3) <<
"BACK" << j <<
"-" << k <<
" of "
3879 << multiNodeNames[0].size() <<
"-"
3880 << multiNodeNames[i].size() << __E__;
3882 if(j < multiNodeNames[0].size() &&
3883 k < multiNodeNames[i].size())
3887 __COUTVS__(3, score / 2.0);
3889 scoreVector.push_back(score);
3891 if(score > maxScore)
3896 if(score < minScore)
3903 __COUTVS__(2, minScore);
3904 __COUTVS__(2, maxScore);
3906 __COUT__ <<
"Trimming multi-node members with low match score..."
3911 for(
unsigned int i = multiNodeNames.size() - 1;
3912 i > 0 && i < multiNodeNames.size();
3917 if(maxScore > multiNodeNames[0].size() &&
3918 scoreVector[i] >= maxScore)
3922 __COUT__ <<
"Trimming low score match " << multiNodeNames[i]
3923 <<
" for node name " << nodeName << __E__;
3925 skipSet.erase(multiNodeNames[i]);
3926 multiNodeNames.erase(multiNodeNames.begin() + i);
3927 hostnameArray.erase(hostnameArray.begin() + i);
3933 __COUTV__(nodeName);
3940 __COUT__ <<
"Reorganizing multinode '" << nodeName
3941 <<
"' alphabetically..." << __E__;
3943 std::pair<std::string , std::string >>
3945 for(
unsigned int i = 0; i < multiNodeNames.size(); ++i)
3947 std::make_pair(multiNodeNames[i], hostnameArray[i]));
3952 multiNodeNames.clear();
3953 hostnameArray.clear();
3954 for(
const auto& orderedPair : reorderSet)
3956 multiNodeNames.push_back(orderedPair.first);
3957 hostnameArray.push_back(orderedPair.second);
3961 __COUTV__(nodeName);
3967 if(multiNodeNames.size() > 1)
3969 std::vector<std::string> commonChunks;
3970 std::vector<std::string> wildcards;
3974 bool wildcardsNeeded =
3978 nodeFixedWildcardLength);
3980 if(!wildcardsNeeded || wildcards.size() != multiNodeNames.size())
3983 <<
"Impossible extractCommonChunks result! Please notify "
3984 "admins or try to simplify record naming convention."
3994 for(
auto& commonChunk : commonChunks)
3996 nodeName += (!first ?
"*" :
"") + commonChunk;
4000 if(commonChunks.size() == 1)
4003 __COUTV__(nodeName);
4010 bool allIntegers =
true;
4011 for(
auto& wildcard : wildcards)
4014 else if(wildcard.size() == 0)
4016 allIntegers =
false;
4020 for(
unsigned int i = 0; i < wildcard.size(); ++i)
4021 if(!(wildcard[i] >=
'0' && wildcard[i] <=
'9'))
4023 allIntegers =
false;
4027 __COUTV__(allIntegers);
4033 std::vector<unsigned int> intWildcards;
4034 for(
auto& wildcard : wildcards)
4035 intWildcards.push_back(strtol(wildcard.c_str(), 0, 10));
4039 unsigned int hyphenLo = -1;
4040 bool isFirst =
true;
4041 for(
unsigned int i = 0; i < intWildcards.size(); ++i)
4043 if(i + 1 < intWildcards.size() &&
4044 intWildcards[i] + 1 == intWildcards[i + 1])
4056 (isFirst ?
"" :
",") +
4057 std::to_string(intWildcards[i]);
4062 if(intWildcards[hyphenLo] + 1 == intWildcards[i])
4064 (isFirst ?
"" :
",") +
4065 std::to_string(intWildcards[hyphenLo]) +
4066 "," + std::to_string(intWildcards[i]);
4069 (isFirst ?
"" :
",") +
4070 std::to_string(intWildcards[hyphenLo]) +
4071 "-" + std::to_string(intWildcards[i]);
4081 nodeFixedWildcardLength =
4085 __COUTV__(multiNodeString);
4086 __COUTV__(nodeFixedWildcardLength);
4089 if(hostnameArray.size() > 1)
4091 std::vector<std::string> commonChunks;
4092 std::vector<std::string> wildcards;
4096 bool wildcardsNeeded =
4100 hostFixedWildcardLength);
4102 __COUTV__(wildcardsNeeded);
4108 for(
auto& commonChunk : commonChunks)
4110 hostname += (!first ?
"*" :
"") + commonChunk;
4114 if(wildcardsNeeded && commonChunks.size() == 1)
4117 __COUTV__(hostname);
4127 bool allIntegers =
true;
4128 for(
auto& wildcard : wildcards)
4129 for(
unsigned int i = 0; i < wildcard.size(); ++i)
4130 if(!(wildcard[i] >=
'0' && wildcard[i] <=
'9'))
4132 allIntegers =
false;
4136 __COUTV__(allIntegers);
4143 std::vector<unsigned int> intWildcards;
4144 for(
auto& wildcard : wildcards)
4145 intWildcards.push_back(
4146 strtol(wildcard.c_str(), 0, 10));
4150 unsigned int hyphenLo = -1;
4151 bool isFirst =
true;
4152 for(
unsigned int i = 0; i < intWildcards.size(); ++i)
4154 if(i + 1 < intWildcards.size() &&
4155 intWildcards[i] + 1 == intWildcards[i + 1])
4167 (isFirst ?
"" :
",") +
4168 std::to_string(intWildcards[i]);
4173 if(intWildcards[hyphenLo] + 1 ==
4176 (isFirst ?
"" :
",") +
4178 intWildcards[hyphenLo]) +
4179 "," + std::to_string(intWildcards[i]);
4182 (isFirst ?
"" :
",") +
4184 intWildcards[hyphenLo]) +
4185 "-" + std::to_string(intWildcards[i]);
4195 hostFixedWildcardLength =
4199 __COUTV__(hostArrayString);
4200 __COUTV__(hostFixedWildcardLength);
4210 auto result = nodeTypeToObjectMap.at(typeString)
4211 .emplace(std::make_pair(
4212 nodeName, std::vector<std::string /*property*/>()));
4215 __SS__ <<
"Impossible printer syntax handling result! Collision of "
4216 "base names. Please notify "
4217 "admins or try to simplify record naming convention."
4222 nodeTypeToObjectMap.at(typeString)
4224 .push_back(status ?
"1" :
"0");
4226 nodeTypeToObjectMap.at(typeString).at(nodeName).push_back(hostname);
4228 nodeTypeToObjectMap.at(typeString).at(nodeName).push_back(subsystemId);
4229 if(multiNodeNames.size() > 1)
4231 nodeTypeToObjectMap.at(typeString)
4233 .push_back(multiNodeString);
4235 nodeTypeToObjectMap.at(typeString)
4237 .push_back(std::to_string(nodeFixedWildcardLength));
4239 if(hostnameArray.size() > 1)
4241 nodeTypeToObjectMap.at(typeString)
4243 .push_back(hostArrayString);
4245 nodeTypeToObjectMap.at(typeString)
4247 .push_back(std::to_string(hostFixedWildcardLength));
4251 __COUTV__(multiNodeString);
4253 __COUTV__(hostArrayString);
4254 __COUT__ <<
"Done with extraction of node '" << nodeName <<
"'" << __E__;
4260 __COUT__ <<
"Done getting artdaq nodes." << __E__;
4262 return ARTDAQTableBase::info_;
4276 const std::map<std::string ,
4277 std::map<std::string ,
4278 std::vector<std::string /*property*/>>>& nodeTypeToObjectMap,
4279 const std::map<std::string ,
4280 std::string >& subsystemObjectMap)
4282 __COUT__ <<
"setAndActivateARTDAQSystem()" << __E__;
4284 const std::string& author = cfgMgr->
getUsername();
4295 GroupEditStruct configGroupEdit(ConfigurationManager::GroupType::CONFIGURATION_TYPE,
4298 unsigned int artdaqSupervisorRow = TableView::INVALID;
4305 bool needArtdaqSupervisorParents =
true;
4306 bool needArtdaqSupervisorCreation =
false;
4308 __COUTV__(artdaqContext);
4313 const std::string& activeContextGroupName =
4314 cfgMgr->getActiveGroupName(ConfigurationManager::GroupType::CONTEXT_TYPE);
4316 cfgMgr->getActiveGroupKey(ConfigurationManager::GroupType::CONTEXT_TYPE);
4317 const std::string& activeConfigGroupName = cfgMgr->getActiveGroupName(
4318 ConfigurationManager::GroupType::CONFIGURATION_TYPE);
4319 const TableGroupKey& activeConfigGroupKey = cfgMgr->getActiveGroupKey(
4320 ConfigurationManager::GroupType::CONFIGURATION_TYPE);
4322 __COUTV__(activeContextGroupName);
4323 __COUTV__(activeContextGroupKey);
4324 __COUTV__(activeConfigGroupName);
4325 __COUTV__(activeConfigGroupKey);
4326 __COUTV__(cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4327 .
getNode(artdaqContext->contextUID_)
4330 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4331 .
getNode(artdaqContext->contextUID_)
4332 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
4335 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4336 .
getNode(artdaqContext->contextUID_)
4337 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
4338 .
getNode(artdaqContext->applications_[0].applicationUID_)
4340 __COUTV__(artdaqContext->applications_[0].applicationUID_);
4341 __COUTV__(XDAQContextTable::colApplication_.colLinkToSupervisorTable_);
4343 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4344 .
getNode(artdaqContext->contextUID_)
4345 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
4346 .
getNode(artdaqContext->applications_[0].applicationUID_)
4347 .
getNode(XDAQContextTable::colApplication_.colLinkToSupervisorTable_)
4351 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4352 .
getNode(artdaqContext->contextUID_)
4353 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
4354 .
getNode(artdaqContext->applications_[0].applicationUID_)
4355 .
getNode(XDAQContextTable::colApplication_.colLinkToSupervisorTable_);
4360 needArtdaqSupervisorCreation =
true;
4362 artdaqSupervisorRow = artdaqSupervisorNode.
getRow();
4364 needArtdaqSupervisorParents =
false;
4368 needArtdaqSupervisorCreation =
true;
4370 __COUTV__(needArtdaqSupervisorCreation);
4373 if(!artdaqContext || needArtdaqSupervisorCreation)
4375 __COUT__ <<
"No artdaq Supervisor found! Creating..." << __E__;
4376 __COUTV__(needArtdaqSupervisorParents);
4378 std::string artdaqSupervisorUID;
4387 ARTDAQ_SUPERVISOR_TABLE,
true );
4391 std::stringstream ss;
4392 artdaqSupervisorTable.tableView_->print(ss);
4393 __COUT_MULTI__(0, ss.str());
4397 row = artdaqSupervisorTable.tableView_->
addRow(
4398 author,
true ,
"artdaqSupervisor");
4401 artdaqSupervisorUID =
4402 artdaqSupervisorTable.tableView_
4403 ->getDataView()[row][artdaqSupervisorTable.tableView_->
getColUID()];
4404 artdaqSupervisorRow = row;
4406 __COUTV__(artdaqSupervisorRow);
4407 __COUTV__(artdaqSupervisorUID);
4413 artdaqSupervisorTable.tableView_->
findCol(
4414 colARTDAQSupervisor_.colDAQInterfaceDebugLevel_));
4417 "${MRB_BUILDDIR}/../setup_ots.sh",
4419 artdaqSupervisorTable.tableView_->
findCol(
4420 colARTDAQSupervisor_.colDAQSetupScript_));
4424 ARTDAQ_READER_TABLE,
4426 artdaqSupervisorTable.tableView_->
findCol(
4427 colARTDAQSupervisor_.colLinkToBoardReaders_));
4431 artdaqSupervisorTable.tableView_->
findCol(
4432 colARTDAQSupervisor_.colLinkToBoardReadersGroupID_),
4433 artdaqSupervisorUID +
4437 ARTDAQ_BUILDER_TABLE,
4439 artdaqSupervisorTable.tableView_->
findCol(
4440 colARTDAQSupervisor_.colLinkToEventBuilders_));
4443 artdaqSupervisorTable.tableView_->
findCol(
4444 colARTDAQSupervisor_.colLinkToEventBuildersGroupID_),
4445 artdaqSupervisorUID +
4449 ARTDAQ_LOGGER_TABLE,
4451 artdaqSupervisorTable.tableView_->
findCol(
4452 colARTDAQSupervisor_.colLinkToDataLoggers_));
4455 artdaqSupervisorTable.tableView_->
findCol(
4456 colARTDAQSupervisor_.colLinkToDataLoggersGroupID_),
4457 artdaqSupervisorUID +
4461 ARTDAQ_DISPATCHER_TABLE,
4463 artdaqSupervisorTable.tableView_->
findCol(
4464 colARTDAQSupervisor_.colLinkToDispatchers_));
4467 artdaqSupervisorTable.tableView_->
findCol(
4468 colARTDAQSupervisor_.colLinkToDispatchersGroupID_),
4469 artdaqSupervisorUID +
4474 ARTDAQ_ROUTER_TABLE,
4476 artdaqSupervisorTable.tableView_->
findCol(
4477 colARTDAQSupervisor_.colLinkToRoutingManagers_));
4480 artdaqSupervisorTable.tableView_->
findCol(
4481 colARTDAQSupervisor_.colLinkToRoutingManagersGroupID_),
4482 artdaqSupervisorUID +
4487 std::stringstream ss;
4488 artdaqSupervisorTable.tableView_->print(ss);
4489 __COUT_MULTI__(0, ss.str());
4496 ConfigurationManager::GroupType::CONTEXT_TYPE, cfgMgr);
4499 ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME,
true );
4501 ConfigurationManager::XDAQ_APPLICATION_TABLE_NAME,
true );
4503 ConfigurationManager::XDAQ_APP_PROPERTY_TABLE_NAME,
4510 std::string contextUID;
4511 std::string contextAppGroupID;
4513 if(needArtdaqSupervisorParents)
4516 row = contextTable.tableView_->
addRow(
4517 author,
true ,
"artdaqContext");
4523 contextTable.tableView_
4524 ->getDataView()[row][contextTable.tableView_->
getColUID()];
4527 __COUTV__(contextUID);
4531 "http://${HOSTNAME}",
4533 contextTable.tableView_->
findCol(
4534 XDAQContextTable::colContext_.colAddress_));
4537 contextTable.tableView_->
findCol(
4538 XDAQContextTable::colContext_.colPort_),
4544 ConfigurationManager::XDAQ_APPLICATION_TABLE_NAME,
4546 contextTable.tableView_->
findCol(
4547 XDAQContextTable::colContext_.colLinkToApplicationTable_));
4550 contextTable.tableView_->
findCol(
4551 XDAQContextTable::colContext_.colLinkToApplicationGroupID_),
4552 "artdaqContextApps");
4554 __COUTV__(contextAppGroupID);
4558 std::string appPropertiesGroupID;
4564 if(needArtdaqSupervisorParents)
4568 unsigned int c = appTable.tableView_->
findCol(
4569 XDAQContextTable::colApplication_.colClass_);
4570 for(
unsigned int r = 0;
4571 r < appTable.tableView_->getNumberOfRows();
4573 if(appTable.tableView_->getDataView()[r][c] ==
4574 ARTDAQ_SUPERVISOR_CLASS)
4577 <<
"Found partially existing artdaq Supervisor "
4579 << appTable.tableView_->getDataView()
4581 <<
"'... Disabling it." << __E__;
4588 row = appTable.tableView_->
addRow(
4589 author,
true ,
"artdaqSupervisor");
4596 ->getDataView()[row][appTable.tableView_->
getColUID()];
4603 ARTDAQ_SUPERVISOR_CLASS,
4606 XDAQContextTable::colApplication_.colClass_));
4609 "${OTSDAQ_LIB}/libARTDAQSupervisor.so",
4612 XDAQContextTable::colApplication_.colModule_));
4617 appTable.tableView_->
findCol(XDAQContextTable::colApplication_
4618 .colApplicationGroupID_));
4622 ConfigurationManager::XDAQ_APP_PROPERTY_TABLE_NAME,
4624 appTable.tableView_->
findCol(XDAQContextTable::colApplication_
4625 .colLinkToPropertyTable_));
4628 appTable.tableView_->
findCol(XDAQContextTable::colApplication_
4629 .colLinkToPropertyGroupID_),
4630 appUID +
"Properties");
4632 __COUTV__(appPropertiesGroupID);
4636 __COUT__ <<
"Getting row of existing parent supervisor." << __E__;
4640 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4641 .
getNode(artdaqContext->contextUID_)
4642 .
getNode(XDAQContextTable::colContext_
4643 .colLinkToApplicationTable_)
4644 .
getNode(artdaqContext->applications_[0].applicationUID_)
4653 ARTDAQ_SUPERVISOR_TABLE,
4656 XDAQContextTable::colApplication_.colLinkToSupervisorTable_));
4658 artdaqSupervisorUID,
4661 XDAQContextTable::colApplication_.colLinkToSupervisorUID_));
4666 if(needArtdaqSupervisorParents)
4670 const std::vector<std::string> propertyUIDs = {
"Partition0",
4673 "BoardReaderTimeout",
4674 "EventBuilderTimeout",
4675 "DataLoggerTimeout",
4676 "DispatcherTimeout"};
4677 const std::vector<std::string> propertyNames = {
4679 "productsdir_for_bash_scripts",
4680 "max_fragment_size_bytes",
4681 "boardreader_timeout",
4682 "eventbuilder_timeout",
4683 "datalogger_timeout",
4684 "dispatcher_timeout"
4686 const std::vector<std::string> propertyValues = {
4696 for(
unsigned int i = 0; i < propertyNames.size(); ++i)
4699 row = appPropertyTable.tableView_->
addRow(
4702 appUID + propertyUIDs[i]);
4705 "1", row, appPropertyTable.tableView_->
getColStatus());
4709 "ots::SupervisorProperty",
4711 appPropertyTable.tableView_->
findCol(
4712 XDAQContextTable::colAppProperty_.colPropertyType_));
4717 appPropertyTable.tableView_->
findCol(
4718 XDAQContextTable::colAppProperty_.colPropertyName_));
4723 appPropertyTable.tableView_->
findCol(
4724 XDAQContextTable::colAppProperty_.colPropertyValue_));
4727 appPropertiesGroupID,
4729 appPropertyTable.tableView_->
findCol(
4730 XDAQContextTable::colAppProperty_.colPropertyGroupID_));
4735 std::stringstream ss;
4736 contextTable.tableView_->print(ss);
4737 __COUT_MULTI__(0, ss.str());
4740 std::stringstream ss;
4741 appTable.tableView_->print(ss);
4742 __COUT_MULTI__(0, ss.str());
4745 std::stringstream ss;
4746 appPropertyTable.tableView_->print(ss);
4747 __COUT_MULTI__(0, ss.str());
4750 contextTable.tableView_
4752 appTable.tableView_->
init();
4753 appPropertyTable.tableView_
4759 <<
"Table errors while creating ARTDAQ Supervisor. Erasing all newly "
4760 "created table versions."
4765 __COUT_INFO__ <<
"Edits complete for new artdaq Supervisor! Created '"
4766 << appUID <<
"'" << __E__;
4770 __SS__ <<
"DEBUG blocking artdaq supervisor save!" << __E__;
4774 contextGroupEdit.saveChanges(contextGroupEdit.originalGroupName_,
4786 artdaqSupervisorRow =
4787 cfgMgr->
getNode(ConfigurationManager::XDAQ_CONTEXT_TABLE_NAME)
4788 .
getNode(artdaqContext->contextUID_)
4789 .
getNode(XDAQContextTable::colContext_.colLinkToApplicationTable_)
4790 .
getNode(artdaqContext->applications_[0].applicationUID_)
4791 .
getNode(XDAQContextTable::colApplication_.colLinkToSupervisorTable_)
4795 __COUT__ <<
"------------------------- artdaq nodes to save:" << __E__;
4796 for(
auto& subsystemPair : subsystemObjectMap)
4798 __COUTV__(subsystemPair.first);
4802 for(
auto& nodeTypePair : nodeTypeToObjectMap)
4804 __COUTV__(nodeTypePair.first);
4806 for(
auto& nodePair : nodeTypePair.second)
4808 __COUTV__(nodePair.first);
4812 __COUT__ <<
"------------------------- end artdaq nodes to save." << __E__;
4816 __COUTV__(artdaqSupervisorRow);
4817 if(artdaqSupervisorRow >= TableView::INVALID)
4819 __SS__ <<
"Invalid artdaq Supervisor row " << artdaqSupervisorRow <<
" found!"
4834 ARTDAQ_SUPERVISOR_TABLE,
true );
4838 std::string artdaqSupervisorUID =
4839 artdaqSupervisorTable.tableView_
4840 ->getDataView()[artdaqSupervisorRow]
4841 [artdaqSupervisorTable.tableView_->
getColUID()];
4844 if(artdaqSupervisorTable.tableView_
4845 ->getDataView()[artdaqSupervisorRow]
4846 [artdaqSupervisorTable.tableView_->
findCol(
4847 colARTDAQSupervisor_.colLinkToBoardReaders_)] ==
4848 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
4850 __COUT__ <<
"Fixing missing link to Readers" << __E__;
4852 ARTDAQ_READER_TABLE,
4853 artdaqSupervisorRow,
4854 artdaqSupervisorTable.tableView_->
findCol(
4855 colARTDAQSupervisor_.colLinkToBoardReaders_));
4857 artdaqSupervisorRow,
4858 artdaqSupervisorTable.tableView_->
findCol(
4859 colARTDAQSupervisor_.colLinkToBoardReadersGroupID_),
4860 artdaqSupervisorUID +
4865 if(artdaqSupervisorTable.tableView_
4866 ->getDataView()[artdaqSupervisorRow]
4867 [artdaqSupervisorTable.tableView_->
findCol(
4868 colARTDAQSupervisor_.colLinkToEventBuilders_)] ==
4869 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
4871 __COUT__ <<
"Fixing missing link to Builders" << __E__;
4873 ARTDAQ_BUILDER_TABLE,
4874 artdaqSupervisorRow,
4875 artdaqSupervisorTable.tableView_->
findCol(
4876 colARTDAQSupervisor_.colLinkToEventBuilders_));
4878 artdaqSupervisorRow,
4879 artdaqSupervisorTable.tableView_->
findCol(
4880 colARTDAQSupervisor_.colLinkToEventBuildersGroupID_),
4881 artdaqSupervisorUID +
4886 if(artdaqSupervisorTable.tableView_
4887 ->getDataView()[artdaqSupervisorRow]
4888 [artdaqSupervisorTable.tableView_->
findCol(
4889 colARTDAQSupervisor_.colLinkToDataLoggers_)] ==
4890 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
4892 __COUT__ <<
"Fixing missing link to Loggers" << __E__;
4894 ARTDAQ_LOGGER_TABLE,
4895 artdaqSupervisorRow,
4896 artdaqSupervisorTable.tableView_->
findCol(
4897 colARTDAQSupervisor_.colLinkToDataLoggers_));
4899 artdaqSupervisorRow,
4900 artdaqSupervisorTable.tableView_->
findCol(
4901 colARTDAQSupervisor_.colLinkToDataLoggersGroupID_),
4902 artdaqSupervisorUID +
4907 if(artdaqSupervisorTable.tableView_
4908 ->getDataView()[artdaqSupervisorRow]
4909 [artdaqSupervisorTable.tableView_->
findCol(
4910 colARTDAQSupervisor_.colLinkToDispatchers_)] ==
4911 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
4913 __COUT__ <<
"Fixing missing link to Dispatchers" << __E__;
4915 ARTDAQ_DISPATCHER_TABLE,
4916 artdaqSupervisorRow,
4917 artdaqSupervisorTable.tableView_->
findCol(
4918 colARTDAQSupervisor_.colLinkToDispatchers_));
4920 artdaqSupervisorRow,
4921 artdaqSupervisorTable.tableView_->
findCol(
4922 colARTDAQSupervisor_.colLinkToDispatchersGroupID_),
4923 artdaqSupervisorUID +
4928 if(artdaqSupervisorTable.tableView_
4929 ->getDataView()[artdaqSupervisorRow]
4930 [artdaqSupervisorTable.tableView_->
findCol(
4931 colARTDAQSupervisor_.colLinkToRoutingManagers_)] ==
4932 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
4934 __COUT__ <<
"Fixing missing link to Routers" << __E__;
4936 ARTDAQ_ROUTER_TABLE,
4937 artdaqSupervisorRow,
4938 artdaqSupervisorTable.tableView_->
findCol(
4939 colARTDAQSupervisor_.colLinkToRoutingManagers_));
4941 artdaqSupervisorRow,
4942 artdaqSupervisorTable.tableView_->
findCol(
4943 colARTDAQSupervisor_.colLinkToRoutingManagersGroupID_),
4944 artdaqSupervisorUID +
4949 std::stringstream ss;
4950 artdaqSupervisorTable.tableView_->print(ss);
4951 __COUT_MULTI__(0, ss.str());
4957 ARTDAQ_SUBSYSTEM_TABLE,
true );
4960 artdaqSubsystemTable.tableView_->deleteAllRows();
4962 for(
auto& subsystemPair : subsystemObjectMap)
4964 __COUTV__(subsystemPair.first);
4965 __COUTV__(subsystemPair.second);
4968 row = artdaqSubsystemTable.tableView_->
addRow(
4969 author,
true , subsystemPair.first);
4971 if(subsystemPair.second !=
"" &&
4972 subsystemPair.second != TableViewColumnInfo::DATATYPE_STRING_DEFAULT &&
4973 subsystemPair.second != NULL_SUBSYSTEM_DESTINATION_LABEL)
4977 ARTDAQ_SUBSYSTEM_TABLE,
4979 artdaqSubsystemTable.tableView_->
findCol(
4980 colARTDAQSubsystem_.colLinkToDestination_));
4982 subsystemPair.second,
4984 artdaqSubsystemTable.tableView_->
findCol(
4985 colARTDAQSubsystem_.colLinkToDestinationUID_));
4992 for(
auto& nodeTypePair : nodeTypeToObjectMap)
4994 __COUTV__(nodeTypePair.first);
4998 auto it =
processTypes_.mapToTable_.find(nodeTypePair.first);
5001 __SS__ <<
"Invalid artdaq node type '" << nodeTypePair.first
5002 <<
"' attempted!" << __E__;
5005 __COUTV__(it->second);
5015 if(nodeTypePair.second.size())
5018 __COUT__ <<
"Ignoring missing table '" << it->second
5019 <<
"' since there were no user records attempted of type '"
5020 << nodeTypePair.first <<
".'" << __E__;
5027 bool hasArtProcessName =
false;
5028 unsigned int artProcessNameCol = -1;
5032 __COUT__ <<
"Identified non-Reader, no-Router type '"
5033 << nodeTypePair.first
5034 <<
"' that has an art link and thus Process Name, so creating "
5035 "table edit structure to ART table."
5038 ARTDAQTableBase::ARTDAQ_ART_TABLE,
true );
5041 std::stringstream ss;
5042 artTable->tableView_->print(ss);
5043 __COUT_MULTI__(1, ss.str());
5045 artProcessNameCol = artTable->tableView_->
findCol(
5046 ARTDAQTableBase::colARTDAQArt_.colProcessName_);
5047 __COUTTV__(artProcessNameCol);
5049 hasArtProcessName =
true;
5051 __COUTV__(hasArtProcessName);
5053 const unsigned int commentCol =
5054 typeTable.tableView_->
findColByType(TableViewColumnInfo::TYPE_COMMENT);
5055 const unsigned int authorCol =
5056 typeTable.tableView_->
findColByType(TableViewColumnInfo::TYPE_AUTHOR);
5057 const unsigned int timestampCol =
5058 typeTable.tableView_->
findColByType(TableViewColumnInfo::TYPE_TIMESTAMP);
5061 std::map<
unsigned int ,
bool > deleteRecordMap;
5062 unsigned int maxRowToDelete = typeTable.tableView_->getNumberOfRows();
5063 for(
unsigned int r = 0; r < typeTable.tableView_->getNumberOfRows(); ++r)
5064 deleteRecordMap.emplace(std::make_pair(
5067 __COUTTV__(maxRowToDelete);
5073 const unsigned int ORIG_MAP_ART_PROC_NAME_COL = -1;
5074 std::map<std::string ,
5075 std::map<
unsigned int , std::string >>
5076 originalMultinodeValues;
5077 std::map<std::string ,
5078 std::map<
unsigned int ,
5081 originalMultinodeSameSiblingValues;
5084 std::map<
unsigned int ,
5086 std::vector<std::string >>>>
5087 originalMultinodeAllSiblingEmbeddedName;
5090 std::map<
unsigned int ,
5092 std::vector<std::string >>>>
5093 originalMultinodeAllSiblingEmbeddedPrinterIndex;
5096 for(
auto& nodePair : nodeTypePair.second)
5098 __COUTV__(nodePair.first);
5101 std::vector<std::string> nodeIndices, hostnameIndices;
5102 unsigned int hostnameFixedWidth = 0, nodeNameFixedWidth = 0;
5103 std::string hostname;
5110 for(
unsigned int i = 0; i < nodePair.second.size(); ++i)
5112 __COUTV__(nodePair.second[i]);
5116 std::string nodeName;
5122 if(nodePair.second[i][0] ==
':')
5124 __COUT__ <<
"Handling original multi-node." << __E__;
5129 std::string lastOriginalName;
5130 std::vector<std::string> originalParameterArr =
5132 &(nodePair.second[i].c_str()[1]),
5135 if(originalParameterArr.size() != 3)
5137 __SS__ <<
"Illegal original name parameter string '"
5138 << nodePair.second[i] <<
"!'" << __E__;
5144 unsigned int fixedWidth;
5145 sscanf(originalParameterArr[0].c_str(),
"%u", &fixedWidth);
5146 __COUTV__(fixedWidth);
5148 std::vector<std::string> printerSyntaxArr =
5153 std::vector<std::string> originalNodeIndices;
5154 for(
auto& printerSyntaxValue : printerSyntaxArr)
5156 __COUTV__(printerSyntaxValue);
5158 std::vector<std::string> printerSyntaxRange =
5160 printerSyntaxValue, {
'-'} );
5162 if(printerSyntaxRange.size() == 0 ||
5163 printerSyntaxRange.size() > 2)
5165 __SS__ <<
"Illegal multi-node printer syntax string '"
5166 << printerSyntaxValue <<
"!'" << __E__;
5169 else if(printerSyntaxRange.size() == 1)
5171 __COUTV__(printerSyntaxRange[0]);
5172 originalNodeIndices.push_back(printerSyntaxRange[0]);
5176 unsigned int lo, hi;
5177 sscanf(printerSyntaxRange[0].c_str(),
"%u", &lo);
5178 sscanf(printerSyntaxRange[1].c_str(),
"%u", &hi);
5182 sscanf(printerSyntaxRange[0].c_str(),
"%u", &hi);
5184 for(; lo <= hi; ++lo)
5187 originalNodeIndices.push_back(std::to_string(lo));
5192 __COUTTV__(originalParameterArr[2]);
5194 originalParameterArr[2] = originalParameterArr[2].substr(
5195 0, originalParameterArr[2].find(
";status="));
5196 __COUTV__(originalParameterArr[2]);
5197 std::vector<std::string> originalNamePieces =
5202 if(originalNamePieces.size() < 2)
5204 __SS__ <<
"Illegal original multi-node name template - "
5205 "please use * to indicate where the multi-node "
5206 "index should be inserted!"
5213 std::stringstream ss;
5214 typeTable.tableView_->print(ss);
5215 __COUT_MULTI__(1, ss.str());
5220 <<
"originalMultinodeSameSiblingValues init col map for "
5221 << nodePair.first << __E__;
5222 originalMultinodeSameSiblingValues.emplace(std::make_pair(
5228 __COUT__ <<
"originalMultinodeAllSiblingEmbeddedName init "
5230 << nodePair.first << __E__;
5231 originalMultinodeAllSiblingEmbeddedName.emplace(std::make_pair(
5240 __COUT__ <<
"originalMultinodeAllSiblingEmbeddedPrinterIndex "
5242 << nodePair.first << __E__;
5243 originalMultinodeAllSiblingEmbeddedPrinterIndex.emplace(
5256 unsigned int originalRow = TableView::INVALID,
5257 lastOriginalRow = TableView::INVALID,
5258 lastArtProcessRow = TableView::INVALID;
5259 for(
unsigned int i = 0; i < originalNodeIndices.size(); ++i)
5261 std::string originalName = originalNamePieces[0];
5262 std::string nodeNameIndex;
5263 for(
unsigned int p = 1; p < originalNamePieces.size();
5266 nodeNameIndex = originalNodeIndices[i];
5269 if(nodeNameIndex.size() > fixedWidth)
5271 __SS__ <<
"Illegal original node name index '"
5273 <<
"' - length is longer than fixed "
5274 "width requirement of "
5275 << fixedWidth <<
"!" << __E__;
5280 while(nodeNameIndex.size() < fixedWidth)
5281 nodeNameIndex =
"0" + nodeNameIndex;
5284 originalName += nodeNameIndex + originalNamePieces[p];
5286 __COUTTV__(originalName);
5287 originalRow = typeTable.tableView_->
findRow(
5292 __COUTTV__(originalRow);
5296 auto result = originalMultinodeValues.emplace(
5297 std::make_pair(originalName,
5298 std::map<
unsigned int ,
5302 <<
"originalName '" << originalName
5303 <<
"' already in original multinode value cache."
5307 __COUT__ <<
"Saving multinode value " << originalName
5308 <<
"[" << originalRow
5309 <<
"][*] with row count = "
5310 << typeTable.tableView_->getNumberOfRows()
5314 for(
unsigned int col = 0;
5315 col < typeTable.tableView_->getNumberOfColumns();
5318 if(typeTable.tableView_->getColumnInfo(col)
5321 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK ||
5322 typeTable.tableView_->getColumnInfo(col)
5325 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID ||
5326 typeTable.tableView_->getColumnInfo(col)
5329 ARTDAQ_TYPE_TABLE_HOSTNAME ||
5330 typeTable.tableView_->getColumnInfo(col)
5333 typeTable.tableView_->getColumnInfo(col)
5335 col == timestampCol ||
5342 <<
"Caching node value: " << originalName
5343 <<
"[" << originalRow <<
"][" << col
5345 << typeTable.tableView_
5346 ->getColumnInfo(col)
5349 << typeTable.tableView_
5350 ->getDataView()[originalRow][col]
5352 originalMultinodeValues.at(originalName)
5353 .emplace(std::make_pair(
5355 typeTable.tableView_
5356 ->getDataView()[originalRow]
5361 for(
const auto& pair :
5362 originalMultinodeSameSiblingValues)
5363 __COUTT__ <<
"originalMultinodeSameSiblin"
5365 << pair.first <<
"]" << __E__;
5367 originalMultinodeSameSiblingValues
5369 .emplace(std::make_pair(
5374 typeTable.tableView_
5376 [originalRow][col])));
5378 for(
const auto& pair :
5379 originalMultinodeAllSiblingEmbeddedName)
5380 __COUTT__ <<
"originalMultinodeAllSibling"
5382 << pair.first <<
"]" << __E__;
5383 originalMultinodeAllSiblingEmbeddedName
5385 .emplace(std::make_pair(
5388 typeTable.tableView_
5391 .find(originalName) !=
5394 std::vector<std::string>())));
5396 for(
const auto& pair :
5397 originalMultinodeAllSiblingEmbeddedPrinterIndex)
5398 __COUTT__ <<
"originalMultinodeAllSibling"
5399 "EmbeddedPrinterIndex["
5400 << pair.first <<
"]" << __E__;
5401 originalMultinodeAllSiblingEmbeddedPrinterIndex
5403 .emplace(std::make_pair(
5406 typeTable.tableView_
5409 .find(nodeNameIndex) !=
5412 std::vector<std::string>())));
5418 originalMultinodeSameSiblingValues
5424 originalMultinodeAllSiblingEmbeddedName
5428 if(originalMultinodeAllSiblingEmbeddedName
5434 <<
"Determine string splits for "
5437 const std::string& val =
5438 typeTable.tableView_
5439 ->getDataView()[originalRow]
5441 size_t pos = val.find(originalName);
5442 originalMultinodeAllSiblingEmbeddedName
5446 val.substr(0, pos));
5447 originalMultinodeAllSiblingEmbeddedName
5450 .second.push_back(val.substr(
5451 pos + originalName.size()));
5453 originalMultinodeAllSiblingEmbeddedName
5459 originalMultinodeAllSiblingEmbeddedPrinterIndex
5463 if(originalMultinodeAllSiblingEmbeddedPrinterIndex
5468 __COUTT__ <<
"Determine string "
5469 "splits for embedded "
5470 "printer syntax index: "
5471 << nodeNameIndex << __E__;
5472 const std::string& val =
5473 typeTable.tableView_
5474 ->getDataView()[originalRow]
5476 size_t pos = val.find(nodeNameIndex);
5477 originalMultinodeAllSiblingEmbeddedPrinterIndex
5481 val.substr(0, pos));
5482 originalMultinodeAllSiblingEmbeddedPrinterIndex
5485 .second.push_back(val.substr(
5486 pos + nodeNameIndex.size()));
5488 originalMultinodeAllSiblingEmbeddedPrinterIndex
5496 if(originalMultinodeSameSiblingValues
5501 __COUTT__ <<
"Checking sibling same "
5503 << nodePair.first << __E__;
5504 if(typeTable.tableView_
5505 ->getDataView()[originalRow]
5507 typeTable.tableView_->getDataView()
5508 [lastOriginalRow][col])
5511 <<
"Found different sibling "
5514 << nodePair.first << __E__;
5515 originalMultinodeSameSiblingValues
5521 if(originalMultinodeAllSiblingEmbeddedName
5526 __COUTT__ <<
"Checking sibling "
5527 "embedded name... for "
5528 << nodePair.first <<
":"
5529 << originalName << __E__;
5530 if(typeTable.tableView_
5531 ->getDataView()[originalRow]
5533 .find(originalName) ==
5536 __COUT__ <<
"Found no embedded "
5538 << col <<
" looking for "
5539 << originalName << __E__;
5540 originalMultinodeAllSiblingEmbeddedName
5546 if(originalMultinodeAllSiblingEmbeddedPrinterIndex
5552 <<
"Checking sibling embedded "
5553 "printer syntax index... for "
5554 << nodePair.first <<
":"
5555 << nodeNameIndex << __E__;
5556 if(typeTable.tableView_
5557 ->getDataView()[originalRow]
5559 .find(nodeNameIndex) ==
5562 __COUT__ <<
"Found no embedded "
5565 << col <<
" looking for "
5568 originalMultinodeAllSiblingEmbeddedPrinterIndex
5577 <<
"originalMultinodeSameSiblingValues["
5578 << nodePair.first <<
"][" << col <<
"] = "
5579 << originalMultinodeSameSiblingValues
5585 <<
"originalMultinodeAllSiblingEmbeddedNa"
5587 << nodePair.first <<
"][" << col <<
"] = "
5588 << originalMultinodeAllSiblingEmbeddedName
5594 <<
"originalMultinodeAllSiblingEmbeddedPr"
5596 << nodePair.first <<
"][" << col <<
"] = "
5597 << originalMultinodeAllSiblingEmbeddedPrinterIndex
5603 if(hasArtProcessName && artTable &&
5604 typeTable.tableView_->getColumnInfo(col)
5606 ARTDAQTableBase::colARTDAQNotReader_
5611 <<
"Checking ART Process Name... for "
5613 << originalName <<
"' / "
5614 << typeTable.tableView_
5615 ->getDataView()[originalRow]
5618 unsigned int artRow =
5619 artTable->tableView_->
findRow(
5622 typeTable.tableView_
5623 ->getDataView()[originalRow]
5628 <<
"Found ART Process Name = "
5629 << artTable->tableView_->getDataView()
5630 [artRow][artProcessNameCol]
5634 originalMultinodeValues.at(originalName)
5635 .emplace(std::make_pair(
5636 ORIG_MAP_ART_PROC_NAME_COL,
5637 artTable->tableView_
5640 [artProcessNameCol]));
5642 originalMultinodeValues
5644 .at(ORIG_MAP_ART_PROC_NAME_COL));
5647 originalMultinodeSameSiblingValues
5649 .emplace(std::make_pair(
5650 ORIG_MAP_ART_PROC_NAME_COL,
5654 artTable->tableView_
5657 [artProcessNameCol])));
5658 originalMultinodeAllSiblingEmbeddedName
5660 .emplace(std::make_pair(
5661 ORIG_MAP_ART_PROC_NAME_COL,
5663 artTable->tableView_
5667 .find(originalName) !=
5670 std::vector<std::string>())));
5671 originalMultinodeAllSiblingEmbeddedPrinterIndex
5673 .emplace(std::make_pair(
5674 ORIG_MAP_ART_PROC_NAME_COL,
5676 artTable->tableView_
5684 std::vector<std::string>())));
5690 originalMultinodeSameSiblingValues
5692 .at(ORIG_MAP_ART_PROC_NAME_COL)
5696 originalMultinodeAllSiblingEmbeddedName
5698 .at(ORIG_MAP_ART_PROC_NAME_COL)
5700 if(originalMultinodeAllSiblingEmbeddedName
5702 .at(ORIG_MAP_ART_PROC_NAME_COL)
5706 <<
"Determine string splits "
5709 const std::string& val =
5710 artTable->tableView_
5713 [artProcessNameCol];
5715 val.find(originalName);
5716 originalMultinodeAllSiblingEmbeddedName
5718 .at(ORIG_MAP_ART_PROC_NAME_COL)
5720 val.substr(0, pos));
5721 originalMultinodeAllSiblingEmbeddedName
5723 .at(ORIG_MAP_ART_PROC_NAME_COL)
5724 .second.push_back(val.substr(
5726 originalName.size()));
5728 originalMultinodeAllSiblingEmbeddedName
5730 .at(ORIG_MAP_ART_PROC_NAME_COL)
5734 originalMultinodeAllSiblingEmbeddedPrinterIndex
5736 .at(ORIG_MAP_ART_PROC_NAME_COL)
5738 if(originalMultinodeAllSiblingEmbeddedPrinterIndex
5740 .at(ORIG_MAP_ART_PROC_NAME_COL)
5744 <<
"Determine string splits "
5745 "for embedded printer "
5747 << nodeNameIndex << __E__;
5748 const std::string& val =
5749 artTable->tableView_
5752 [artProcessNameCol];
5754 val.find(nodeNameIndex);
5755 originalMultinodeAllSiblingEmbeddedPrinterIndex
5757 .at(ORIG_MAP_ART_PROC_NAME_COL)
5759 val.substr(0, pos));
5760 originalMultinodeAllSiblingEmbeddedPrinterIndex
5762 .at(ORIG_MAP_ART_PROC_NAME_COL)
5763 .second.push_back(val.substr(
5765 nodeNameIndex.size()));
5767 originalMultinodeAllSiblingEmbeddedPrinterIndex
5769 .at(ORIG_MAP_ART_PROC_NAME_COL)
5775 if(originalMultinodeSameSiblingValues
5777 .at(ORIG_MAP_ART_PROC_NAME_COL)
5780 __COUTT__ <<
"Checking sibling "
5781 "same values... for "
5784 if(artTable->tableView_
5787 [artProcessNameCol] !=
5788 artTable->tableView_
5791 [artProcessNameCol])
5794 <<
"Found different "
5796 "at artProcessNameCol="
5797 << artProcessNameCol
5801 originalMultinodeSameSiblingValues
5803 .at(ORIG_MAP_ART_PROC_NAME_COL)
5807 if(originalMultinodeAllSiblingEmbeddedName
5809 .at(ORIG_MAP_ART_PROC_NAME_COL)
5813 <<
"Checking sibling "
5814 "embedded name... for "
5815 << nodePair.first <<
":"
5816 << originalName << __E__;
5817 if(artTable->tableView_
5821 .find(originalName) ==
5825 <<
"Found no embedded "
5827 "artProcessNameCol="
5828 << artProcessNameCol
5830 << originalName << __E__;
5831 originalMultinodeAllSiblingEmbeddedName
5833 .at(ORIG_MAP_ART_PROC_NAME_COL)
5837 if(originalMultinodeAllSiblingEmbeddedPrinterIndex
5839 .at(ORIG_MAP_ART_PROC_NAME_COL)
5843 <<
"Checking sibling "
5844 "embedded printer syntax "
5846 << nodePair.first <<
":"
5847 << nodeNameIndex << __E__;
5848 if(artTable->tableView_
5852 .find(nodeNameIndex) ==
5856 <<
"Found no embedded "
5857 "printer syntax index "
5858 "at artProcessNameCol="
5859 << artProcessNameCol
5861 << nodeNameIndex << __E__;
5862 originalMultinodeAllSiblingEmbeddedPrinterIndex
5864 .at(ORIG_MAP_ART_PROC_NAME_COL)
5871 <<
"originalMultinodeSameSiblingValue"
5873 << nodePair.first <<
"]["
5874 << ORIG_MAP_ART_PROC_NAME_COL
5876 << originalMultinodeSameSiblingValues
5878 .at(ORIG_MAP_ART_PROC_NAME_COL)
5882 <<
"originalMultinodeAllSiblingEmbedd"
5884 << nodePair.first <<
"]["
5885 << ORIG_MAP_ART_PROC_NAME_COL
5887 << originalMultinodeAllSiblingEmbeddedName
5889 .at(ORIG_MAP_ART_PROC_NAME_COL)
5893 <<
"originalMultinodeAllSiblingEmbedd"
5895 << nodePair.first <<
"]["
5896 << ORIG_MAP_ART_PROC_NAME_COL
5898 << originalMultinodeAllSiblingEmbeddedPrinterIndex
5900 .at(ORIG_MAP_ART_PROC_NAME_COL)
5905 <<
"Checking ART Process Name "
5906 "complete for originalName='"
5907 << originalName <<
"' / "
5908 << typeTable.tableView_
5909 ->getDataView()[originalRow]
5923 lastOriginalRow = originalRow;
5925 __COUTTV__(lastOriginalRow);
5926 lastOriginalName = originalName;
5929 for(
const auto& pair :
5930 originalMultinodeSameSiblingValues.at(nodePair.first))
5931 __COUTT__ <<
"originalMultinodeSameSiblingValues["
5932 << nodePair.first <<
"][" << pair.first
5933 <<
"] = " << pair.second.first << __E__;
5934 for(
const auto& pair :
5935 originalMultinodeAllSiblingEmbeddedName.at(
5937 __COUTT__ <<
"originalMultinodeAllSiblingEmbeddedName["
5938 << nodePair.first <<
"][" << pair.first
5939 <<
"] = " << pair.second.first << __E__;
5940 for(
const auto& pair :
5941 originalMultinodeAllSiblingEmbeddedPrinterIndex.at(
5944 <<
"originalMultinodeAllSiblingEmbeddedPrinterIndex["
5945 << nodePair.first <<
"][" << pair.first
5946 <<
"] = " << pair.second.first << __E__;
5948 __COUTTV__(lastOriginalRow);
5949 row = lastOriginalRow;
5954 std::string originalName = nodePair.second[i].substr(
5955 0, nodePair.second[i].find(
";status="));
5956 __COUTV__(originalName);
5959 row = typeTable.tableView_->
findRow(
5969 nodeName = nodePair.first;
5970 __COUTV__(nodeName);
5972 nodeName = nodeName.substr(0, nodeName.find(
";status="));
5975 std::string tmpNodeName = nodeName;
5977 for(
size_t c = 0; c < tmpNodeName.size(); ++c)
5978 if(tmpNodeName[c] !=
'*')
5979 nodeName += tmpNodeName[c];
5982 __COUTV__(nodeName);
5983 if(row == TableView::INVALID)
5986 row = typeTable.tableView_->
addRow(
5987 author,
true , nodeName);
5992 __COUT__ <<
"Handling new " << nodeTypePair.first
5993 <<
" defaults!" << __E__;
5996 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
6001 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
6003 typeTable.tableView_->
findCol(
6004 ARTDAQTableBase::colARTDAQReader_
6005 .colLinkToDaqParameters_));
6006 std::string daqParameterGroupID =
6009 typeTable.tableView_->
findCol(
6010 ARTDAQTableBase::colARTDAQReader_
6011 .colLinkToDaqParametersGroupID_),
6012 nodeName +
"DaqParameters");
6015 std::stringstream ss;
6016 typeTable.tableView_->print(ss);
6017 __COUT_MULTI__(1, ss.str());
6021 const std::vector<std::string> parameterUIDs = {
6022 "BoardID",
"FragmentID"};
6024 const std::vector<std::string> parameterNames = {
6028 const std::vector<std::string> parameterValues = {
6033 unsigned int parameterRow;
6034 for(
unsigned int i = 0; i < parameterNames.size(); ++i)
6037 parameterRow = daqParameterTable.tableView_->
addRow(
6040 nodeName + parameterUIDs[i]);
6051 daqParameterTable.tableView_->
findCol(
6052 ARTDAQTableBase::colARTDAQDaqParameter_
6053 .colDaqParameterKey_));
6058 daqParameterTable.tableView_->
findCol(
6059 ARTDAQTableBase::colARTDAQDaqParameter_
6060 .colDaqParameterValue_));
6063 daqParameterGroupID,
6065 daqParameterTable.tableView_->
findCol(
6066 ARTDAQTableBase::colARTDAQDaqParameter_
6067 .colDaqParameterGroupID_));
6071 daqParameterTable.tableView_
6079 __COUT__ <<
"Handling new " << nodeTypePair.first
6080 <<
" defaults!" << __E__;
6085 ARTDAQTableBase::ARTDAQ_DAQ_TABLE,
6088 unsigned int daqRecordRow = daqTable.tableView_->
addRow(
6092 std::string daqRecordUID =
6094 ->getDataView()[daqRecordRow]
6099 ARTDAQTableBase::ARTDAQ_DAQ_TABLE,
6101 typeTable.tableView_->
findCol(
6102 ARTDAQTableBase::colARTDAQNotReader_
6107 typeTable.tableView_->
findCol(
6108 ARTDAQTableBase::colARTDAQNotReader_
6109 .colLinkToDaqUID_));
6113 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
6117 ARTDAQTableBase::ARTDAQ_DAQ_PARAMETER_TABLE,
6120 ARTDAQTableBase::colARTDAQDaq_
6121 .colLinkToDaqParameters_));
6122 std::string daqParameterGroupID =
6126 ARTDAQTableBase::colARTDAQDaq_
6127 .colLinkToDaqParametersGroupID_),
6128 nodeName +
"DaqParameters");
6131 const std::vector<std::string> parameterUIDs = {
6132 "BufferCount",
"FragmentsPerEvent"};
6134 const std::vector<std::string> parameterNames = {
6136 "expected_fragments_per_event"
6138 const std::vector<std::string> parameterValues = {
6143 unsigned int parameterRow;
6144 for(
unsigned int i = 0; i < parameterNames.size(); ++i)
6147 parameterRow = daqParameterTable.tableView_->
addRow(
6150 nodeName + parameterUIDs[i]);
6161 daqParameterTable.tableView_->
findCol(
6162 ARTDAQTableBase::colARTDAQDaqParameter_
6163 .colDaqParameterKey_));
6168 daqParameterTable.tableView_->
findCol(
6169 ARTDAQTableBase::colARTDAQDaqParameter_
6170 .colDaqParameterValue_));
6173 daqParameterGroupID,
6175 daqParameterTable.tableView_->
findCol(
6176 ARTDAQTableBase::colARTDAQDaqParameter_
6177 .colDaqParameterGroupID_));
6183 daqParameterTable.tableView_
6191 <<
"Reusing row " << row <<
" current-UID="
6192 << typeTable.tableView_
6193 ->getDataView()[row]
6195 <<
" as (temporarily to basename if multinode) new-UID="
6196 << nodeName << __E__;
6197 typeTable.tableView_
6206 if(row < maxRowToDelete)
6207 deleteRecordMap[row] =
false;
6214 artdaqSupervisorTable.tableView_
6215 ->getDataView()[artdaqSupervisorRow]
6216 [artdaqSupervisorTable.tableView_->
findCol(
6218 .at(nodeTypePair.first))],
6220 typeTable.tableView_->
findCol(
6222 nodeTypePair.first)));
6235 hostname = nodePair.second[i];
6239 typeTable.tableView_->
findCol(ARTDAQ_TYPE_TABLE_HOSTNAME));
6244 if(nodePair.second[i] !=
"" &&
6245 nodePair.second[i] !=
6246 TableViewColumnInfo::DATATYPE_STRING_DEFAULT)
6249 if(subsystemObjectMap.find(nodePair.second[i]) ==
6250 subsystemObjectMap.end())
6252 __SS__ <<
"Illegal subsystem '" << nodePair.second[i]
6253 <<
"' mismatch!" << __E__;
6258 ARTDAQ_SUBSYSTEM_TABLE,
6260 typeTable.tableView_->
findCol(
6261 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK));
6265 typeTable.tableView_->
findCol(
6266 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID));
6271 TableViewColumnInfo::DATATYPE_LINK_DEFAULT,
6273 typeTable.tableView_->
findCol(
6274 ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK));
6278 i == 4 || i == 5 || i == 6 ||
6285 __COUT__ <<
"Handling printer syntax i=" << i << __E__;
6287 std::vector<std::string> printerSyntaxArr =
6291 if(printerSyntaxArr.size() == 2)
6293 if(printerSyntaxArr[0] ==
6296 sscanf(printerSyntaxArr[1].c_str(),
6298 &nodeNameFixedWidth);
6299 __COUTV__(nodeNameFixedWidth);
6302 else if(printerSyntaxArr[0] ==
6305 sscanf(printerSyntaxArr[1].c_str(),
6307 &hostnameFixedWidth);
6308 __COUTV__(hostnameFixedWidth);
6314 for(
auto& printerSyntaxValue : printerSyntaxArr)
6316 __COUTV__(printerSyntaxValue);
6318 std::vector<std::string> printerSyntaxRange =
6321 if(printerSyntaxRange.size() == 0 ||
6322 printerSyntaxRange.size() > 2)
6324 __SS__ <<
"Illegal multi-node printer syntax string '"
6325 << printerSyntaxValue <<
"!'" << __E__;
6328 else if(printerSyntaxRange.size() == 1)
6331 __COUTV__(printerSyntaxRange[0]);
6336 nodeIndices.push_back(printerSyntaxRange[0]);
6338 hostnameIndices.push_back(printerSyntaxRange[0]);
6342 unsigned int lo, hi;
6343 sscanf(printerSyntaxRange[0].c_str(),
"%u", &lo);
6344 sscanf(printerSyntaxRange[1].c_str(),
"%u", &hi);
6348 sscanf(printerSyntaxRange[0].c_str(),
"%u", &hi);
6350 for(; lo <= hi; ++lo)
6354 nodeIndices.push_back(std::to_string(lo));
6356 hostnameIndices.push_back(std::to_string(lo));
6363 __SS__ <<
"Unexpected parameter[" << i <<
" '"
6364 << nodePair.second[i] <<
"' for node " << nodePair.first
6370 __COUTV__(nodeIndices.size());
6371 __COUTV__(hostnameIndices.size());
6373 if(hostnameIndices.size())
6375 if(hostnameIndices.size() != nodeIndices.size())
6377 __SS__ <<
"Illegal associated hostname array has count "
6378 << hostnameIndices.size()
6379 <<
" which is not equal to the node count "
6380 << nodeIndices.size() <<
"!" << __E__;
6385 if(nodeIndices.size())
6387 unsigned int hostnameCol =
6388 typeTable.tableView_->
findCol(ARTDAQ_TYPE_TABLE_HOSTNAME);
6393 std::vector<std::string> namePieces =
6395 nodePair.first.substr(0, nodePair.first.find(
";status=")),
6399 if(namePieces.size() < 2)
6402 <<
"Illegal multi-node name template - please use * to "
6403 "indicate where the multi-node index should be inserted!"
6408 std::vector<std::string> hostnamePieces;
6409 if(hostnameIndices.size())
6415 if(hostnamePieces.size() < 2)
6418 <<
"Illegal hostname array template - please use * to "
6419 "indicate where the hostname index should be inserted!"
6425 bool isFirst =
true;
6426 unsigned int lastArtRow = TableView::INVALID;
6427 for(
unsigned int i = 0; i < nodeIndices.size(); ++i)
6429 std::string name = namePieces[0];
6430 std::string nodeNameIndex;
6431 for(
unsigned int p = 1; p < namePieces.size(); ++p)
6433 nodeNameIndex = nodeIndices[i];
6434 if(nodeNameFixedWidth > 1)
6436 if(nodeNameIndex.size() > nodeNameFixedWidth)
6438 __SS__ <<
"Illegal node name index '" << nodeNameIndex
6439 <<
"' - length is longer than fixed width "
6441 << nodeNameFixedWidth <<
"!" << __E__;
6446 while(nodeNameIndex.size() < nodeNameFixedWidth)
6447 nodeNameIndex =
"0" + nodeNameIndex;
6450 name += nodeNameIndex + namePieces[p];
6454 if(hostnamePieces.size())
6456 hostname = hostnamePieces[0];
6457 std::string hostnameIndex;
6458 for(
unsigned int p = 1; p < hostnamePieces.size(); ++p)
6460 hostnameIndex = hostnameIndices[i];
6461 if(hostnameFixedWidth > 1)
6463 if(hostnameIndex.size() > hostnameFixedWidth)
6465 __SS__ <<
"Illegal hostname index '"
6467 <<
"' - length is longer than fixed width "
6469 << hostnameFixedWidth <<
"!" << __E__;
6474 while(hostnameIndex.size() < hostnameFixedWidth)
6475 hostnameIndex =
"0" + hostnameIndex;
6478 hostname += hostnameIndex + hostnamePieces[p];
6480 __COUTV__(hostname);
6487 << author <<
"... Replacing row UID '"
6488 << typeTable.tableView_
6489 ->getDataView()[row]
6491 <<
"' with UID '" << name <<
"'" << __E__;
6494 if(row < maxRowToDelete)
6495 deleteRecordMap[row] =
false;
6500 << author <<
"... Copying row UID '"
6501 << typeTable.tableView_
6502 ->getDataView()[row]
6504 <<
"' to UID '" << name <<
"'" << __E__;
6505 unsigned int copyRow = typeTable.tableView_->
copyRows(
6507 *(typeTable.tableView_),
6514 if(row < maxRowToDelete)
6515 deleteRecordMap[copyRow] =
false;
6520 name, row, typeTable.tableView_->
getColUID());
6522 hostname, row, hostnameCol);
6525 TableViewColumnInfo::DATATYPE_COMMENT_DEFAULT,
6529 typeTable.tableView_->
setValue(time(0), row, timestampCol);
6531 __COUTTV__(typeTable
6533 ->getDataView()[row][commentCol]);
6534 __COUTTV__(typeTable
6536 ->getDataView()[row][authorCol]);
6537 __COUTTV__(typeTable
6539 ->getDataView()[row][timestampCol]);
6549 <<
"Looking for best original node match for row=" << row
6550 <<
" UID='" << name <<
"'" << __E__;
6551 size_t bestScore = 0;
6552 std::string bestOriginalNodeName;
6553 for(
const auto& originalNodePair : originalMultinodeValues)
6555 if(originalNodePair.second.find(
6556 ORIG_MAP_ART_PROC_NAME_COL) !=
6557 originalNodePair.second.end())
6558 __COUTTV__(originalNodePair.second.at(
6559 ORIG_MAP_ART_PROC_NAME_COL));
6561 for(
size_t c = 0, d = 0;
6562 c < originalNodePair.first.size() && d < name.size();
6565 if(name[d] == originalNodePair.first[c])
6567 else if(d + 1 < name.size() &&
6568 name[d + 1] == originalNodePair.first[c])
6570 else if(c + 1 < originalNodePair.first.size() &&
6571 name[d] == originalNodePair.first[c + 1])
6574 if(originalNodePair.first.size() == name.size())
6576 __COUTVS__(2, score);
6577 if(score > bestScore)
6579 bestOriginalNodeName = originalNodePair.first;
6581 __COUTVS__(2, bestOriginalNodeName);
6582 __COUTVS__(2, bestScore);
6586 bool exactMatch = (bestOriginalNodeName == name);
6587 bool needToHandleArtProcessName =
false;
6588 std::string artProcessName;
6591 originalMultinodeValues.find(bestOriginalNodeName) !=
6592 originalMultinodeValues.end())
6594 __COUT__ <<
"Populating original multinode value from '"
6595 << bestOriginalNodeName <<
"' into '" << name
6598 for(
const auto& valuePair :
6599 originalMultinodeValues.at(bestOriginalNodeName))
6602 if(!exactMatch && (valuePair.first == commentCol ||
6603 valuePair.first == authorCol ||
6604 valuePair.first == timestampCol))
6607 <<
"Not exact node name match, so keeping "
6608 "default meta info for node: "
6609 << name <<
"[" << row <<
"]["
6611 <<
"] /= " << valuePair.second <<
" keep= "
6612 << typeTable.tableView_
6613 ->getDataView()[row][valuePair.first]
6618 __COUTT__ <<
"Customizing node: " << name <<
"["
6619 << row <<
"][" << valuePair.first
6620 <<
"] = " << valuePair.second << __E__;
6622 if(valuePair.first == ORIG_MAP_ART_PROC_NAME_COL)
6624 __COUTT__ <<
"NEED Special art Process Name "
6626 << valuePair.second << __E__;
6627 needToHandleArtProcessName =
true;
6628 artProcessName = valuePair.second;
6631 valuePair.second, row, artProcessNameCol);
6635 valuePair.second, row, valuePair.first);
6639 __COUT__ <<
"Did not find '" << name
6640 <<
"' in original value cache. Looking for "
6641 "bestOriginalNodeName="
6642 << bestOriginalNodeName << __E__;
6644 __COUTV__(exactMatch);
6647 if(originalMultinodeSameSiblingValues.find(
6649 originalMultinodeSameSiblingValues.end())
6651 __COUT__ <<
"Applying multinode sibling same value "
6653 << row <<
" UID='" << name <<
"'" << __E__;
6654 for(
const auto& sameValuePair :
6655 originalMultinodeSameSiblingValues.at(
6658 if(!sameValuePair.second.first)
6661 <<
"Found originalMultinodeSameSiblingValues["
6662 << nodePair.first <<
"]["
6663 << sameValuePair.first <<
"] = "
6664 << sameValuePair.second.first <<
" --> "
6665 << sameValuePair.second.second << __E__;
6668 if(sameValuePair.first ==
6669 ORIG_MAP_ART_PROC_NAME_COL)
6671 __COUTT__ <<
"NEED Special art Process Name "
6673 << sameValuePair.second.second
6675 needToHandleArtProcessName =
true;
6676 artProcessName = sameValuePair.second.second;
6679 sameValuePair.second.second,
6685 sameValuePair.second.second,
6687 sameValuePair.first);
6692 if(originalMultinodeAllSiblingEmbeddedPrinterIndex.find(
6694 originalMultinodeAllSiblingEmbeddedPrinterIndex.end())
6696 __COUT__ <<
"Applying multinode sibling embbeded "
6697 "printer syntax index rules for row="
6698 << row <<
" UID='" << name
6699 <<
"' and printer index='" << nodeNameIndex
6701 for(
const auto& embedValuePair :
6702 originalMultinodeAllSiblingEmbeddedPrinterIndex
6703 .at(nodePair.first))
6705 if(!embedValuePair.second.first ||
6706 embedValuePair.second.second.size() < 2)
6710 "originalMultinodeAllSiblingEmbeddedPrinte"
6712 << nodePair.first <<
"]["
6713 << embedValuePair.first <<
"] = "
6714 << embedValuePair.second.first <<
" --> "
6716 embedValuePair.second.second)
6718 std::string embedValue =
6720 embedValuePair.second.second,
6722 __COUTTV__(embedValue);
6725 if(embedValuePair.first ==
6726 ORIG_MAP_ART_PROC_NAME_COL)
6728 __COUTT__ <<
"NEED Special art Process Name "
6730 << embedValue << __E__;
6731 needToHandleArtProcessName =
true;
6732 artProcessName = embedValue;
6735 embedValue, row, artProcessNameCol);
6739 embedValue, row, embedValuePair.first);
6743 if(originalMultinodeAllSiblingEmbeddedName.find(
6745 originalMultinodeAllSiblingEmbeddedName.end())
6747 __COUT__ <<
"Applying multinode sibling embbeded "
6748 "name rules for row="
6749 << row <<
" UID='" << name <<
"'" << __E__;
6750 for(
const auto& embedValuePair :
6751 originalMultinodeAllSiblingEmbeddedName.at(
6754 if(!embedValuePair.second.first ||
6755 embedValuePair.second.second.size() < 2)
6759 "originalMultinodeAllSiblingEmbeddedName["
6760 << nodePair.first <<
"]["
6761 << embedValuePair.first <<
"] = "
6762 << embedValuePair.second.first <<
" --> "
6764 embedValuePair.second.second)
6766 std::string embedValue =
6768 embedValuePair.second.second, name);
6769 __COUTTV__(embedValue);
6772 if(embedValuePair.first ==
6773 ORIG_MAP_ART_PROC_NAME_COL)
6775 __COUTT__ <<
"NEED Special art Process Name "
6777 << embedValue << __E__;
6778 needToHandleArtProcessName =
true;
6779 artProcessName = embedValue;
6782 embedValue, row, artProcessNameCol);
6786 embedValue, row, embedValuePair.first);
6790 __COUTV__(needToHandleArtProcessName);
6791 if(needToHandleArtProcessName)
6793 __COUTT__ <<
"Special art Process Name column value: "
6794 << artProcessName << __E__;
6796 std::string artRecord =
6797 typeTable.tableView_->getDataView()
6798 [row][typeTable.tableView_->
findCol(
6799 ARTDAQTableBase::colARTDAQNotReader_
6800 .colLinkToArtUID_)];
6801 __COUTTV__(artRecord);
6803 const unsigned int artCommentCol =
6805 TableViewColumnInfo::TYPE_COMMENT);
6806 const unsigned int artAuthorCol =
6808 TableViewColumnInfo::TYPE_AUTHOR);
6809 const unsigned int artTimestampCol =
6811 TableViewColumnInfo::TYPE_TIMESTAMP);
6813 unsigned int artRow = artTable->tableView_->
findRow(
6819 if(artRow == TableView::INVALID)
6821 __COUTT__ <<
"Need to make art Process record... "
6823 << artRecord << __E__;
6827 __COUTTV__(bestOriginalNodeName);
6828 const unsigned int bestMatchRow =
6829 typeTable.tableView_->
findRow(
6831 bestOriginalNodeName);
6832 __COUTTV__(bestMatchRow);
6834 std::string bestMatchArtRecord =
6835 typeTable.tableView_->getDataView()
6837 [typeTable.tableView_->
findCol(
6840 .colLinkToArtUID_)];
6841 __COUTTV__(bestMatchArtRecord);
6843 unsigned int bestMatchArtRow =
6844 artTable->tableView_->
findRow(
6849 __COUTTV__(bestMatchArtRow);
6850 if(bestMatchArtRow !=
6855 __COUTTV__(lastArtRow);
6858 if(lastArtRow != TableView::INVALID)
6860 __COUTT__ <<
"Copying art Process record... "
6862 << lastArtRow << __E__;
6863 unsigned int copyRow =
6866 *(artTable->tableView_),
6880 DATATYPE_COMMENT_DEFAULT,
6884 author, artRow, artAuthorCol);
6886 time(0), artRow, artTimestampCol);
6890 __COUTT__ <<
"Creating art Process record... "
6892 << artRecord << __E__;
6894 artRow = artTable->tableView_->
addRow(
6900 <<
"Made art Process record... artRecord="
6901 << artRecord << __E__;
6904 __COUTT__ <<
"Modify art Process record based on "
6905 "sibling rules... artRecord="
6907 <<
" artProcessName=" << artProcessName
6911 artProcessName, artRow, artProcessNameCol);
6912 lastArtRow = artRow;
6916 needToHandleArtProcessName)
6918 std::string artRecord =
6919 typeTable.tableView_->getDataView()
6920 [row][typeTable.tableView_->
findCol(
6921 ARTDAQTableBase::colARTDAQNotReader_
6922 .colLinkToArtUID_)];
6923 __COUTTV__(artRecord);
6924 unsigned int artRow = artTable->tableView_->
findRow(
6932 lastArtRow = artRow;
6935 __COUTTV__(lastArtRow);
6940 if(row < maxRowToDelete)
6941 __COUTTV__(deleteRecordMap[row]);
6943 __COUTTV__(typeTable
6945 ->getDataView()[row][commentCol]);
6946 __COUTTV__(typeTable
6948 ->getDataView()[row][authorCol]);
6949 __COUTTV__(typeTable
6951 ->getDataView()[row][timestampCol]);
6961 __COUT__ <<
"Deleting '" << nodeTypePair.first
6962 <<
"' records not specified..." << __E__;
6965 std::set<unsigned int> orderedRowSet;
6966 for(
auto& deletePair : deleteRecordMap)
6968 if(!deletePair.second)
6970 __COUTT__ <<
"Row keep = " << deletePair.first << __E__;
6974 __COUTT__ <<
"Row delete = " << deletePair.first << __E__;
6975 orderedRowSet.emplace(deletePair.first);
6979 for(std::set<unsigned int>::reverse_iterator rit = orderedRowSet.rbegin();
6980 rit != orderedRowSet.rend();
6986 if(TTEST(1) && artTable)
6988 std::stringstream ss;
6989 artTable->tableView_->print(ss);
6990 __COUT_MULTI__(1, ss.str());
6993 if(hasArtProcessName && artTable)
6994 artTable->tableView_
6999 std::stringstream ss;
7000 typeTable.tableView_->print(ss);
7001 __COUT_MULTI__(1, ss.str());
7004 typeTable.tableView_->
init();
7011 std::stringstream ss;
7012 artdaqSupervisorTable.tableView_->print(ss);
7013 __COUT_MULTI__(1, ss.str());
7016 std::stringstream ss;
7017 artdaqSubsystemTable.tableView_->print(ss);
7018 __COUT_MULTI__(1, ss.str());
7022 artdaqSupervisorTable.tableView_
7024 artdaqSubsystemTable.tableView_
7029 __COUT__ <<
"Table errors while creating ARTDAQ nodes. Erasing all newly "
7030 "created table versions."
7035 __COUT__ <<
"Edits complete for artdaq nodes and subsystems.. now save and activate "
7036 "groups, and update aliases!"
7042 __SS__ <<
"DEBUG blocking save!" << __E__;
7046 std::string localAccumulatedWarnings;
7047 configGroupEdit.saveChanges(configGroupEdit.originalGroupName_,
7048 newConfigurationGroupKey,
7055 &localAccumulatedWarnings);
7071 void ARTDAQTableBase::addCommentWhitespace(std::ostream& os,
size_t lineLength)
7073 for(
size_t i = 0;
true; i += 20)
7075 if(lineLength < FCL_COMMENT_POSITION + i)
7077 os << std::string(FCL_COMMENT_POSITION + i - lineLength,
' ');
<virtual so future plugins can inherit from multiple table base classes
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, std::string *returnFcl=nullptr)
static void insertArtProcessBlock(std::ostream &out, std::string &tabStr, std::string &commentStr, const std::string &parentPath, ConfigurationTree art, ConfigurationTree subsystemLink=ConfigurationTree(), size_t routingTimeoutMs=DEFAULT_ROUTING_TIMEOUT_MS, size_t routingRetryCount=DEFAULT_ROUTING_RETRY_COUNT)
static const std::string ARTDAQ_FCL_PATH
Tree-path rule is, if the last link in the path is a group link with a specified group ID,...
static std::string insertModuleType(std::ostream &out, std::string &tabStr, std::string &commentStr, const std::string &parentPath, ConfigurationTree moduleTypeNode)
static bool isARTDAQEnabled(const ConfigurationManager *cfgMgr)
isARTDAQEnabled
static void insertParameters(std::ostream &out, std::string &tabStr, std::string &commentStr, const std::string &parentPath, ConfigurationTree parameterLink, const std::string ¶meterPreamble, bool onlyInsertAtTableParameters=false, bool includeAtTableParameters=false)
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 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, const std::string &parentPath, ConfigurationTree daqNode)
insertMetricsBlock
const std::string & getUsername(void) const
Getters.
ConfigurationTree getNode(const std::string &nodeString, bool doNotThrowOnBrokenUIDLinks=false) const
"root/parent/parent/"
const unsigned int & getRow(void) const
getRow
bool isDisconnected(void) const
ConfigurationTree getNode(const std::string &nodeName, bool doNotThrowOnBrokenUIDLinks=false) const
navigating between nodes
const std::string & getTableName(void) const
getTableName
T getValueWithDefault(const T &defaultValue) const
const std::string & getValueAsString(bool returnLinkTableValue=false) 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
std::string getParentLinkIndex(void) const
getParentLinkIndex
const std::string & getUIDAsString(void) const
const unsigned int & getNodeRow(void) const
getNodeRow
const std::string & getFieldName(void) const
alias for getValueName
std::string getParentLinkID(void) const
getParentLinkID
const std::string & getParentTableName(void) const
getParentTableName
const std::string & getParentRecordName(void) const
getParentRecordName
const std::string & getParentLinkColumnName(void) const
getParentLinkColumnName
std::string str() const
alternative alias method
bool isUID(void) const
isUID
bool isGroupID(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 findColByType(const std::string &type, unsigned int startingCol=0) 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
void setValue(const T &value, unsigned int row, unsigned int col)
< in included .icc source
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
defines used also by OtsConfigurationWizardSupervisor
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=": ")
static std::string decodeURIComponent(const std::string &data)
static std::string stackTrace(void)