1 #include "otsdaq-mu2e/TablePlugins/DTCInterfaceTable.h"
2 #include "otsdaq/Macros/TablePluginMacros.h"
11 #define SLOWCONTROL_PV_FILE_PATH \
13 getenv("OTSDAQ_EPICS_DATA")? \
14 (std::string(getenv("OTSDAQ_EPICS_DATA")) + "/" + __ENV__("MU2E_OWNER") + "_otsdaq_dtc-ai.dbg"): \
15 (EPICS_CONFIG_PATH + "/otsdaq_dtc-ai.dbg") )
20 DTCInterfaceTable::DTCInterfaceTable(
void)
21 : TableBase(
"DTCInterfaceTable")
22 , SlowControlsTableBase(
"DTCInterfaceTable")
27 DTCInterfaceTable::~DTCInterfaceTable(
void)
34 void DTCInterfaceTable::init(ConfigurationManager* configManager)
37 lastConfigManager_ = configManager;
41 isFirstAppInContext_ = configManager->isOwnerFirstAppInContext();
43 channelListHasChanged_ =
false;
46 if(!isFirstAppInContext_)
50 mkdir(EPICS_CONFIG_PATH.c_str(), 0755);
53 __COUT__ <<
"*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*" << __E__;
54 __COUT__ << configManager->__SELF_NODE__ << __E__;
61 unsigned int DTCInterfaceTable::slowControlsHandlerConfig (
62 std::stringstream& out
63 , ConfigurationManager* configManager
64 , std::vector<std::pair<std::string , std::vector<std::string>>>* channelList
70 std::string tabStr =
"";
71 std::string commentStr =
"";
74 std::vector<std::pair<std::string, ConfigurationTree>> feRecords =
75 configManager->getNode(
"FEInterfaceTable").getChildren();
77 std::string rocPluginType;
78 unsigned int numberOfDTCs = 0;
79 std::string subsystem = std::string(
"TDAQ_") + __ENV__(
"MU2E_OWNER");
81 for(
auto& fePair : feRecords)
83 if(!fePair.second.status() ||
84 fePair.second.getNode(feColNames_.colFEInterfacePluginName_)
85 .getValue<std::string>() != DTC_FE_PLUGIN_TYPE)
91 __COUT__ <<
"DTC record: " << fePair.first << __E__;
95 ConfigurationTree slowControlsLink =
96 fePair.second.getNode(feColNames_.colLinkToSlowControlsChannelTable_);
97 unsigned int numberOfDTCSlowControlsChannels =
98 slowControlsHandler(out,
106 __COUT__ <<
"DTC '" << fePair.first <<
"' number of slow controls channels: "
107 << numberOfDTCSlowControlsChannels << __E__;
113 ConfigurationTree DTCLink =
114 fePair.second.getNode(feColNames_.colLinkToFETypeTable);
115 if(DTCLink.isDisconnected())
117 __COUT__ <<
"Disconnected DTC type table information. So assuming no ROCs."
121 ConfigurationTree ROCLink = DTCLink.getNode(dtcColNames_.colLinkToROCGroupTable_);
122 if(ROCLink.isDisconnected())
124 __COUT__ <<
"Disconnected ROC link. So assuming no ROCs." << __E__;
127 std::vector<std::pair<std::string, ConfigurationTree>> rocChildren =
128 ROCLink.getChildren();
130 unsigned int numberOfROCSlowControlsChannels;
131 for(
auto& rocChildPair : rocChildren)
134 <<
"ROC record: " << rocChildPair.first << __E__;
135 numberOfROCSlowControlsChannels = 0;
139 rocChildPair.second.getNode(rocColNames_.colROCInterfacePluginName_)
140 .getValue<std::string>();
141 __COUTV__(rocPluginType);
143 ConfigurationTree slowControlsLink = rocChildPair.second.getNode(
144 rocColNames_.colLinkToSlowControlsChannelTable_);
145 numberOfROCSlowControlsChannels = slowControlsHandler(out,
153 catch(
const std::runtime_error& e)
155 __COUT_ERR__ <<
"Ignoring ROC error: " << e.what() << __E__;
159 <<
"ROC '" << rocChildPair.first
160 <<
"' number of slow controls channels: "
161 << numberOfROCSlowControlsChannels << __E__;
171 std::string DTCInterfaceTable::setFilePath()
const {
return SLOWCONTROL_PV_FILE_PATH; }