1 #include "otsdaq/Macros/TablePluginMacros.h"
2 #include "otsdaq/TablePlugins/ARTDAQEventBuilderTable.h"
8 #define SLOWCONTROL_PV_FILE_PATH \
10 getenv("OTSDAQ_EPICS_DATA")? \
11 (std::string(getenv("OTSDAQ_EPICS_DATA")) + "/" + __ENV__("MU2E_OWNER") + "_otsdaq_artdaqEventBuilder-ai.dbg"): \
12 (EPICS_CONFIG_PATH + "/_otsdaq_artdaqEventBuilder-ai.dbg") )
17 ARTDAQEventBuilderTable::ARTDAQEventBuilderTable(
void)
25 __COUT__ <<
"ARTDAQEventBuilderTable Constructed." << __E__;
29 ARTDAQEventBuilderTable::~ARTDAQEventBuilderTable(
void) {}
34 lastConfigManager_ = configManager;
47 __COUT_INFO__ <<
"ARTDAQ Supervisor is disabled, so skipping fcl handling."
53 mkdir((ARTDAQTableBase::ARTDAQ_FCL_PATH).c_str(), 0755);
62 std::map<std::string ,
67 for(
auto& builder : buiders)
70 builder.second, ARTDAQTableBase::ARTDAQAppType::EventBuilder);
71 ARTDAQTableBase::flattenFHICL(ARTDAQAppType::EventBuilder,
72 builder.second.getValue());
77 unsigned int ARTDAQEventBuilderTable::slowControlsHandlerConfig(
78 std::stringstream& out,
80 std::vector<std::pair<std::string , std::vector<std::string>>>*
87 std::string tabStr =
"";
88 std::string commentStr =
"";
91 std::vector<std::pair<std::string, ConfigurationTree>> artdaqRecords =
94 unsigned int numberOfEventBuiderMetricParameters = 0;
96 for(
auto& artdaqPair : artdaqRecords)
98 if(artdaqPair.second.getNode(colARTDAQSupervisor_.colLinkToEventBuilders_)
102 std::vector<std::pair<std::string, ConfigurationTree>> eventBuilderRecords =
103 artdaqPair.second.getNode(colARTDAQSupervisor_.colLinkToEventBuilders_)
106 for(
auto& eventBuilderPair :
109 if(!eventBuilderPair.second.status())
114 if(eventBuilderPair.second.getNode(
"daqLink").isDisconnected())
117 auto daqLink = eventBuilderPair.second.getNode(
"daqLink");
119 if(daqLink.getNode(
"daqMetricsLink").isDisconnected())
122 auto daqMetricsLinks = daqLink.getNode(
"daqMetricsLink").getChildren();
123 for(
auto& daqMetricsLink :
126 if(!daqMetricsLink.second.status())
129 if(daqMetricsLink.second.getNode(
"metricParametersLink")
135 eventBuilderPair.second.
getNode(
"MetricAlarmThresholdsLink");
137 auto metricParametersLinks =
138 daqMetricsLink.second.
getNode(
"metricParametersLink")
140 for(
auto& metricParametersLink :
141 metricParametersLinks)
143 if(!metricParametersLink.second.status())
146 std::string subsystem =
147 metricParametersLink.second.getNode(
"metricParameterValue")
148 .getValueWithDefault<std::string>(std::string(
"TDAQ_") +
149 __ENV__(
"MU2E_OWNER"));
150 if(subsystem.find(
"Mu2e:") != std::string::npos)
151 subsystem = subsystem.replace(subsystem.find(
"Mu2e:"), 5,
"");
152 while(subsystem.find(
"\"") != std::string::npos)
153 subsystem = subsystem.replace(subsystem.find(
"\""), 1,
"");
155 numberOfEventBuiderMetricParameters =
156 slowControlsHandler(out,
160 eventBuilderPair.first,
164 __COUT__ <<
"EventBuilder '" << eventBuilderPair.first
165 <<
"' number of metrics for slow controls: "
166 << numberOfEventBuiderMetricParameters << __E__;
170 catch(
const std::runtime_error& e)
172 __COUT_ERR__ <<
"Ignoring EventBuilder error: " << e.what() << __E__;
177 return numberOfEventBuiderMetricParameters;
184 return SLOWCONTROL_PV_FILE_PATH;
virtual std::string setFilePath() const override
return out file path
void init(ConfigurationManager *configManager) override
Methods.
<virtual so future plugins can inherit from multiple table base classes
static bool isARTDAQEnabled(const ConfigurationManager *cfgMgr)
isARTDAQEnabled
static void outputDataReceiverFHICL(const ConfigurationTree &receiverNode, ARTDAQAppType appType, size_t maxFragmentSizeBytes=DEFAULT_MAX_FRAGMENT_SIZE, size_t routingTimeoutMs=DEFAULT_ROUTING_TIMEOUT_MS, size_t routingRetryCount=DEFAULT_ROUTING_RETRY_COUNT)
ConfigurationTree getNode(const std::string &nodeString, bool doNotThrowOnBrokenUIDLinks=false) const
"root/parent/parent/"
ConfigurationTree getNode(const std::string &nodeName, bool doNotThrowOnBrokenUIDLinks=false) const
navigating between nodes
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
<virtual so future plugins can inherit from multiple table base classes
bool isFirstAppInContext_
for managing if PV list has changed
const std::string & getTableName(void) const
Getters.