20 #include "boost/lexical_cast.hpp"
40 auto pL1GtPsbSetup = std::make_unique<L1GtPsbSetup>();
45 std::vector<L1GtPsbConfig> psbConfigurations;
50 std::vector<std::string>::iterator newEnd = std::remove_if(psbColumns.begin(), psbColumns.end(), &
notPsbColumnName);
51 psbColumns.erase(newEnd, psbColumns.end());
58 if (!
checkOneLineResult(psbKeys,
"GT_SETUP query for PSB keys with ID = " + objectKey)) {
59 edm::LogError(
"L1-O2O") <<
"Problem to get content of CMS_GT.GT_SETUP for GT_SETUP.ID key: " << objectKey;
64 for (std::vector<std::string>::const_iterator it = psbColumns.begin(); it != psbColumns.end(); ++it) {
76 pL1GtPsbSetup->setGtPsbSetup(psbConfigurations);
79 LogTrace(
"L1-O2O") << (*pL1GtPsbSetup) << std::endl;
91 unsigned len = columnName.size();
94 return len <= (startMatch.size() + endMatch.size()) ||
96 columnName.substr(0, startMatch.size()) != startMatch ||
98 columnName.substr(len - endMatch.size(), endMatch.size()) != endMatch;
138 std::vector<std::string> columnNames;
140 static const std::string lvdPrefix =
"ENABLE_TT_LVDS_";
143 static const std::string serSuffix =
"_REC_ENABLE";
144 static const std::string boardSlotColumn =
"BOARD_SLOT";
145 static const std::string ch0FormatColumn =
"CH0_SEND_LVDS_NOT_DS92LV16";
146 static const std::string ch1FormatColumn =
"CH1_SEND_LVDS_NOT_DS92LV16";
148 columnNames.push_back(boardSlotColumn);
149 columnNames.push_back(ch0FormatColumn);
150 columnNames.push_back(ch1FormatColumn);
165 if (!
checkOneLineResult(psbQuery,
"GT_PSB_SETUP query for PSB keys with ID = " + psbKey)) {
166 edm::LogError(
"L1-O2O") <<
"Problem to get setup for PSB keys with ID = " << psbKey;
175 bool sendLvds0, sendLvds1;
180 const std::vector<bool>& enableRecLvds =
182 const std::vector<bool>& serLinkRecEnable =
188 toAdd.setGtBoardSlot(boardSlot);
189 toAdd.setGtPsbCh0SendLvds(sendLvds0);
190 toAdd.setGtPsbCh1SendLvds(sendLvds1);
191 toAdd.setGtPsbEnableRecLvds(enableRecLvds);
192 toAdd.setGtPsbEnableRecSerLink(serLinkRecEnable);
195 psbSetup.push_back(
toAdd);
199 std::vector<L1GtPsbConfig>& psbSetup)
const {
208 toAdd.setGtBoardSlot(boardSlot);
209 toAdd.setGtPsbCh0SendLvds(
false);
210 toAdd.setGtPsbCh1SendLvds(
false);
211 toAdd.setGtPsbEnableRecLvds(allFalseLvds);
212 toAdd.setGtPsbEnableRecSerLink(allFalseSerLink);
214 psbSetup.push_back(
toAdd);
220 unsigned nColumns)
const {
221 std::vector<bool>
result(nColumns);
223 for (
unsigned i = 0;
i < nColumns; ++
i) {
235 if (
result.queryFailed()) {
236 edm::LogError(
"L1-O2O") <<
"\n " << queryDescription +
" failed: no match found!";
239 }
else if (
result.numberRows() != 1) {
240 edm::LogError(
"L1-O2O") <<
"\nProblem with " << queryDescription <<
": " << (
result.numberRows())
241 <<
" rows were returned, expected 1.";
255 std::ostringstream colName;
258 return colName.str();
262 std::istringstream
stream(aString);
265 for (
unsigned i = 0;
i < aString.size(); ++
i) {
278 throw cms::Exception(
"NumberNotFound") <<
"Failed to extract numeric value from " << aString;