1 #ifndef _ots_ARTDAQTableBase_h_
2 #define _ots_ARTDAQTableBase_h_
4 #include "otsdaq/ConfigurationInterface/ConfigurationManager.h"
5 #include "otsdaq/ConfigurationInterface/ConfigurationManagerRW.h"
6 #include "otsdaq/TableCore/TableBase.h"
9 #define OUT out << tabStr << commentStr
10 #define PUSHTAB tabStr += "\t"
11 #define POPTAB tabStr.resize(tabStr.size() - 1)
12 #define PUSHCOMMENT commentStr += "# "
13 #define POPCOMMENT commentStr.resize(commentStr.size() - 2)
22 ARTDAQTableBase(std::string tableName, std::string* accumulatedExceptions = 0);
26 static const std::string ARTDAQ_FCL_PATH;
27 static const std::string ARTDAQ_SUPERVISOR_CLASS, ARTDAQ_SUPERVISOR_TABLE;
28 static const std::string ARTDAQ_READER_TABLE, ARTDAQ_BUILDER_TABLE, ARTDAQ_LOGGER_TABLE, ARTDAQ_DISPATCHER_TABLE, ARTDAQ_MONITOR_TABLE, ARTDAQ_ROUTER_TABLE;
29 static const std::string ARTDAQ_SUBSYSTEM_TABLE;
30 static const std::string ARTDAQ_TYPE_TABLE_HOSTNAME, ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK, ARTDAQ_TYPE_TABLE_SUBSYSTEM_LINK_UID;
32 enum class ARTDAQAppType
44 DEFAULT_MAX_FRAGMENT_SIZE = 1048576,
45 DEFAULT_ROUTING_TIMEOUT_MS = 1000,
46 DEFAULT_ROUTING_RETRY_COUNT = 5,
49 static const int NULL_SUBSYSTEM_DESTINATION;
50 static const std::string NULL_SUBSYSTEM_DESTINATION_LABEL;
59 ProcessInfo(std::string l, std::string h,
int s, ARTDAQAppType ,
bool onOff)
60 : label(l), hostname(h), subsystem(s), status(onOff) {}
68 std::set<int> sources;
71 bool hasRoutingMaster;
72 std::string routingMasterHost;
74 SubsystemInfo() : sources(), destination(0), hasRoutingMaster(
false), routingMasterHost(
"") {}
80 std::map<ARTDAQAppType, std::list<ProcessInfo>> processes;
83 static const std::string& getTypeString (ARTDAQAppType type);
84 static std::string getFHICLFilename (ARTDAQAppType type,
const std::string& name);
85 static std::string getFlatFHICLFilename (ARTDAQAppType type,
const std::string& name);
86 static void flattenFHICL (ARTDAQAppType type,
const std::string& name);
88 static void insertParameters (std::ostream& out,
90 std::string& commentStr,
92 const std::string& parameterPreamble,
93 bool onlyInsertAtTableParameters =
false,
94 bool includeAtTableParameters =
false);
95 static std::string insertModuleType (std::ostream& out, std::string& tabStr, std::string& commentStr,
ConfigurationTree moduleTypeNode);
96 static void insertMetricsBlock (std::ostream& out, std::string& tabStr, std::string& commentStr,
ConfigurationTree daqNode);
99 size_t maxFragmentSizeBytes = DEFAULT_MAX_FRAGMENT_SIZE,
100 size_t routingTimeoutMs = DEFAULT_ROUTING_TIMEOUT_MS,
101 size_t routingRetryCount = DEFAULT_ROUTING_RETRY_COUNT);
104 ARTDAQAppType appType,
105 size_t maxFragmentSizeBytes = DEFAULT_MAX_FRAGMENT_SIZE,
106 size_t routingTimeoutMs = DEFAULT_ROUTING_TIMEOUT_MS,
107 size_t routingRetryCount = DEFAULT_ROUTING_RETRY_COUNT);
109 static void outputRoutingMasterFHICL (
const ConfigurationTree& routingMasterNode,
110 size_t routingTimeoutMs = DEFAULT_ROUTING_TIMEOUT_MS,
111 size_t routingRetryCount = DEFAULT_ROUTING_RETRY_COUNT);
114 bool getStatusFalseNodes =
false,
115 bool doWriteFHiCL =
false,
116 size_t maxFragmentSizeBytes = DEFAULT_MAX_FRAGMENT_SIZE,
117 size_t routingTimeoutMs = DEFAULT_ROUTING_TIMEOUT_MS,
118 size_t routingRetryCount = DEFAULT_ROUTING_RETRY_COUNT,
122 std::map<std::string ,
123 std::map<std::string ,
124 std::vector<std::string /*property*/>>>& nodeTypeToObjectMap,
125 std::map<std::string ,
126 std::string >& subsystemObjectMap,
127 std::vector<std::string /*property*/>& artdaqSupervisoInfo);
130 const std::map<std::string ,
131 std::map<std::string ,
132 std::vector<std::string /*property*/>>>& nodeTypeToObjectMap,
133 const std::map<std::string ,
134 std::string >& subsystemObjectMap);
138 static void extractRoutingMastersInfo (
ConfigurationTree artdaqSupervisorNode,
bool getStatusFalseNodes,
bool doWriteFHiCL,
size_t routingTimeoutMs,
size_t routingRetryCount);
139 static void extractBoardReadersInfo (
ConfigurationTree artdaqSupervisorNode,
bool getStatusFalseNodes,
bool doWriteFHiCL,
size_t maxFragmentSizeBytes,
size_t routingTimeoutMs,
size_t routingRetryCount);
140 static void extractEventBuildersInfo (
ConfigurationTree artdaqSupervisorNode,
bool getStatusFalseNodes,
bool doWriteFHiCL,
size_t maxFragmentSizeBytes);
141 static void extractDataLoggersInfo (
ConfigurationTree artdaqSupervisorNode,
bool getStatusFalseNodes,
bool doWriteFHiCL,
size_t maxFragmentSizeBytes);
142 static void extractDispatchersInfo (
ConfigurationTree artdaqSupervisorNode,
bool getStatusFalseNodes,
bool doWriteFHiCL,
size_t maxFragmentSizeBytes);
149 std::string
const READER =
"reader";
150 std::string
const BUILDER =
"builder";
151 std::string
const LOGGER =
"logger";
152 std::string
const DISPATCHER =
"dispatcher";
153 std::string
const MONITOR =
"monitor";
154 std::string
const ROUTER =
"router";
158 std::make_pair(READER, ARTDAQTableBase::ARTDAQAppType::BoardReader),
159 std::make_pair(BUILDER, ARTDAQTableBase::ARTDAQAppType::EventBuilder),
160 std::make_pair(LOGGER, ARTDAQTableBase::ARTDAQAppType::DataLogger),
161 std::make_pair(DISPATCHER, ARTDAQTableBase::ARTDAQAppType::Dispatcher),
162 std::make_pair(MONITOR, ARTDAQTableBase::ARTDAQAppType::Monitor),
163 std::make_pair(ROUTER, ARTDAQTableBase::ARTDAQAppType::RoutingMaster)})
165 std::make_pair(READER, ARTDAQTableBase::ARTDAQ_READER_TABLE),
166 std::make_pair(BUILDER, ARTDAQTableBase::ARTDAQ_BUILDER_TABLE),
167 std::make_pair(LOGGER, ARTDAQTableBase::ARTDAQ_LOGGER_TABLE),
168 std::make_pair(DISPATCHER, ARTDAQTableBase::ARTDAQ_DISPATCHER_TABLE),
169 std::make_pair(MONITOR, ARTDAQTableBase::ARTDAQ_MONITOR_TABLE),
170 std::make_pair(ROUTER, ARTDAQTableBase::ARTDAQ_ROUTER_TABLE)})
171 , mapToGroupIDAppend_({
172 std::make_pair(READER,
"BoardReaders"),
173 std::make_pair(BUILDER,
"EventBuilders"),
174 std::make_pair(LOGGER,
"DataLoggers"),
175 std::make_pair(DISPATCHER,
"Dispatchers"),
176 std::make_pair(MONITOR,
"Monitors"),
177 std::make_pair(ROUTER,
"RoutingMasters")})
178 , mapToLinkGroupIDColumn_({
179 std::make_pair(READER, ARTDAQTableBase::colARTDAQSupervisor_.colLinkToBoardReadersGroupID_),
180 std::make_pair(BUILDER, ARTDAQTableBase::colARTDAQSupervisor_.colLinkToEventBuildersGroupID_),
181 std::make_pair(LOGGER, ARTDAQTableBase::colARTDAQSupervisor_.colLinkToDataLoggersGroupID_),
182 std::make_pair(DISPATCHER, ARTDAQTableBase::colARTDAQSupervisor_.colLinkToDispatchersGroupID_),
183 std::make_pair(ROUTER, ARTDAQTableBase::colARTDAQSupervisor_.colLinkToRoutingMastersGroupID_)})
184 , mapToGroupIDColumn_({
185 std::make_pair(READER,
"BoardReaderGroupID"),
186 std::make_pair(BUILDER,
"EventBuilderGroupID"),
187 std::make_pair(LOGGER,
"DataLoggerGroupID"),
188 std::make_pair(DISPATCHER,
"DispatcherGroupID"),
189 std::make_pair(MONITOR,
"MonitorGroupID"),
190 std::make_pair(ROUTER,
"RoutingMasterGroupID")})
193 const std::map<std::string , ARTDAQTableBase::ARTDAQAppType> mapToType_;
194 const std::map<std::string , std::string > mapToTable_, mapToGroupIDAppend_, mapToLinkGroupIDColumn_, mapToGroupIDColumn_;
200 std::string
const colDAQInterfaceDebugLevel_ =
"DAQInterfaceDebugLevel";
201 std::string
const colDAQSetupScript_ =
"DAQSetupScript";
203 std::string
const colLinkToBoardReaders_ =
"BoardReadersLink";
204 std::string
const colLinkToBoardReadersGroupID_ =
"BoardReadersLinkGroupID";
205 std::string
const colLinkToEventBuilders_ =
"EventBuildersLink";
206 std::string
const colLinkToEventBuildersGroupID_ =
"EventBuildersLinkGroupID";
207 std::string
const colLinkToDataLoggers_ =
"DataLoggersLink";
208 std::string
const colLinkToDataLoggersGroupID_ =
"DataLoggersLinkGroupID";
209 std::string
const colLinkToDispatchers_ =
"DispatchersLink";
210 std::string
const colLinkToDispatchersGroupID_ =
"DispatchersLinkGroupID";
211 std::string
const colLinkToRoutingMasters_ =
"RoutingMastersLink";
212 std::string
const colLinkToRoutingMastersGroupID_ =
"RoutingMastersLinkGroupID";
213 } colARTDAQSupervisor_;
218 std::string
const colLinkToDestination_ =
"SubsystemDestinationLink";
219 std::string
const colLinkToDestinationUID_ =
"SubsystemDestinationUID";
220 } colARTDAQSubsystem_;
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)