From 68095fed42dda6c61dac2355e8c9b05e6407418a Mon Sep 17 00:00:00 2001 From: "agioiosa@FNAL.GOV" Date: Sat, 13 Jul 2024 09:19:08 -0500 Subject: [PATCH] PV subsystem prefix fixed into DTCInterfaceTable --- .../TablePlugins/DTCInterfaceTable_table.cc | 177 ++++++++++-------- 1 file changed, 95 insertions(+), 82 deletions(-) diff --git a/otsdaq-mu2e/TablePlugins/DTCInterfaceTable_table.cc b/otsdaq-mu2e/TablePlugins/DTCInterfaceTable_table.cc index 6d83b4c5..4a5619a5 100644 --- a/otsdaq-mu2e/TablePlugins/DTCInterfaceTable_table.cc +++ b/otsdaq-mu2e/TablePlugins/DTCInterfaceTable_table.cc @@ -66,107 +66,120 @@ unsigned int DTCInterfaceTable::slowControlsHandlerConfig ( , std::vector>>* channelList /*= 0*/ ) const { - ///////////////////////// + ///////////////////////// // generate xdaq run parameter file std::string tabStr = ""; std::string commentStr = ""; + std::string subsystem = ""; - // loop through DTC records starting at FE Interface Table - std::vector> feRecords = - configManager->getNode("FEInterfaceTable").getChildren(); - - std::string rocPluginType; unsigned int numberOfDTCs = 0; - std::string subsystem = std::string("TDAQ_") + __ENV__("MU2E_OWNER"); - for(auto& fePair : feRecords) // start main fe/DTC record loop + // Set the PV subsystem name + std::vector> feSupervisorRecors = + configManager->getNode("FESupervisorTable").getChildren(); + + for(auto& feSupervPair : feSupervisorRecors) // start main fe/DTC record loop { - if(!fePair.second.status() || - fePair.second.getNode(feColNames_.colFEInterfacePluginName_) - .getValue() != DTC_FE_PLUGIN_TYPE) - continue; + subsystem = feSupervPair.second.getNode("SlowControlsMetricManagerChannelNamePreamble").getValue(); + __COUT__ << "PV SUBSITEM BEFORE CHECK IS: " << subsystem << __E__; - ++numberOfDTCs; + if (subsystem.empty() || subsystem == "DEFAULT") subsystem = std::string("TDAQ_") + __ENV__("MU2E_OWNER"); + __COUT__ << "PV SUBSITEM NAME IS: " << subsystem << __E__; - // check each row in table - __COUT__ << "DTC record: " << fePair.first << __E__; + // loop through DTC records starting at FE Interface Table + std::vector> feRecords = + feSupervPair.second.getNode("LinkToFEInterfaceTable").getChildren(); - // loop through each DTC slow controls channel and make entry in EPICS file - { - ConfigurationTree slowControlsLink = - fePair.second.getNode(feColNames_.colLinkToSlowControlsChannelTable_); - unsigned int numberOfDTCSlowControlsChannels = - slowControlsHandler(out, - tabStr, - commentStr, - subsystem, - fePair.first, - slowControlsLink, - channelList); - - __COUT__ << "DTC '" << fePair.first << "' number of slow controls channels: " - << numberOfDTCSlowControlsChannels << __E__; - } // end DTC slow controls channel handling - - // loop through ROC records - // use plugin type to indicate subsystem type - - ConfigurationTree DTCLink = - fePair.second.getNode(feColNames_.colLinkToFETypeTable); - if(DTCLink.isDisconnected()) - { - __COUT__ << "Disconnected DTC type table information. So assuming no ROCs." - << __E__; - continue; - } - ConfigurationTree ROCLink = DTCLink.getNode(dtcColNames_.colLinkToROCGroupTable_); - if(ROCLink.isDisconnected()) - { - __COUT__ << "Disconnected ROC link. So assuming no ROCs." << __E__; - continue; - } - std::vector> rocChildren = - ROCLink.getChildren(); - - unsigned int numberOfROCSlowControlsChannels; - for(auto& rocChildPair : rocChildren) + std::string rocPluginType; + + for(auto& fePair : feRecords) // start main fe/DTC record loop { - __COUT__ << "\t" - << "ROC record: " << rocChildPair.first << __E__; - numberOfROCSlowControlsChannels = 0; - try + if(!fePair.second.status() || + fePair.second.getNode(feColNames_.colFEInterfacePluginName_) + .getValue() != DTC_FE_PLUGIN_TYPE) + continue; + + ++numberOfDTCs; + + // check each row in table + __COUT__ << "DTC record: " << fePair.first << __E__; + + // loop through each DTC slow controls channel and make entry in EPICS file { - rocPluginType = - rocChildPair.second.getNode(rocColNames_.colROCInterfacePluginName_) - .getValue(); - __COUTV__(rocPluginType); - - std::string location = rocChildPair.first; - - ConfigurationTree slowControlsLink = rocChildPair.second.getNode( - rocColNames_.colLinkToSlowControlsChannelTable_); - numberOfROCSlowControlsChannels = slowControlsHandler(out, - tabStr, - commentStr, - subsystem, - location, - slowControlsLink, - channelList); + ConfigurationTree slowControlsLink = + fePair.second.getNode(feColNames_.colLinkToSlowControlsChannelTable_); + unsigned int numberOfDTCSlowControlsChannels = + slowControlsHandler(out, + tabStr, + commentStr, + subsystem, + fePair.first, + slowControlsLink, + channelList); + + __COUT__ << "DTC '" << fePair.first << "' number of slow controls channels: " + << numberOfDTCSlowControlsChannels << __E__; + } // end DTC slow controls channel handling + + // loop through ROC records + // use plugin type to indicate subsystem type + + ConfigurationTree DTCLink = + fePair.second.getNode(feColNames_.colLinkToFETypeTable); + if(DTCLink.isDisconnected()) + { + __COUT__ << "Disconnected DTC type table information. So assuming no ROCs." + << __E__; + continue; } - catch(const std::runtime_error& e) + ConfigurationTree ROCLink = DTCLink.getNode(dtcColNames_.colLinkToROCGroupTable_); + if(ROCLink.isDisconnected()) { - __COUT_ERR__ << "Ignoring ROC error: " << e.what() << __E__; + __COUT__ << "Disconnected ROC link. So assuming no ROCs." << __E__; + continue; } + std::vector> rocChildren = + ROCLink.getChildren(); - __COUT__ << "\t" - << "ROC '" << rocChildPair.first - << "' number of slow controls channels: " - << numberOfROCSlowControlsChannels << __E__; + unsigned int numberOfROCSlowControlsChannels; + for(auto& rocChildPair : rocChildren) + { + __COUT__ << "\t" + << "ROC record: " << rocChildPair.first << __E__; + numberOfROCSlowControlsChannels = 0; + try + { + rocPluginType = + rocChildPair.second.getNode(rocColNames_.colROCInterfacePluginName_) + .getValue(); + __COUTV__(rocPluginType); + + std::string location = rocChildPair.first; + + ConfigurationTree slowControlsLink = rocChildPair.second.getNode( + rocColNames_.colLinkToSlowControlsChannelTable_); + numberOfROCSlowControlsChannels = slowControlsHandler(out, + tabStr, + commentStr, + subsystem, + location, + slowControlsLink, + channelList); + } + catch(const std::runtime_error& e) + { + __COUT_ERR__ << "Ignoring ROC error: " << e.what() << __E__; + } - } // end ROC record loop - } // end main fe/DTC record loop + __COUT__ << "\t" + << "ROC '" << rocChildPair.first + << "' number of slow controls channels: " + << numberOfROCSlowControlsChannels << __E__; + } // end ROC record loop + } // end main fe/DTC record loop + } return numberOfDTCs; } // end slowControlsHandlerConfig()