39 auto pL1GtPsbSetup = std::make_unique<L1GtPsbSetup>();
44 std::vector<L1GtPsbConfig> psbConfigurations;
49 std::vector<std::string>::iterator newEnd = std::remove_if(psbColumns.begin(), psbColumns.end(), &
notPsbColumnName);
50 psbColumns.erase(newEnd, psbColumns.end());
57 if (!
checkOneLineResult(psbKeys,
"GT_SETUP query for PSB keys with ID = " + objectKey)) {
58 edm::LogError(
"L1-O2O") <<
"Problem to get content of CMS_GT.GT_SETUP for GT_SETUP.ID key: " << objectKey;
63 for (std::vector<std::string>::const_iterator it = psbColumns.begin(); it != psbColumns.end(); ++it) {
75 pL1GtPsbSetup->setGtPsbSetup(psbConfigurations);
78 LogTrace(
"L1-O2O") << (*pL1GtPsbSetup) << std::endl;
90 unsigned len = columnName.size();
93 return len <= (startMatch.size() + endMatch.size()) ||
95 columnName.substr(0, startMatch.size()) != startMatch ||
97 columnName.substr(len - endMatch.size(), endMatch.size()) != endMatch;
137 std::vector<std::string> columnNames;
139 static const std::string lvdPrefix =
"ENABLE_TT_LVDS_";
142 static const std::string serSuffix =
"_REC_ENABLE";
143 static const std::string boardSlotColumn =
"BOARD_SLOT";
144 static const std::string ch0FormatColumn =
"CH0_SEND_LVDS_NOT_DS92LV16";
145 static const std::string ch1FormatColumn =
"CH1_SEND_LVDS_NOT_DS92LV16";
147 columnNames.push_back(boardSlotColumn);
148 columnNames.push_back(ch0FormatColumn);
149 columnNames.push_back(ch1FormatColumn);
164 if (!
checkOneLineResult(psbQuery,
"GT_PSB_SETUP query for PSB keys with ID = " + psbKey)) {
165 edm::LogError(
"L1-O2O") <<
"Problem to get setup for PSB keys with ID = " << psbKey;
174 bool sendLvds0, sendLvds1;
179 const std::vector<bool>& enableRecLvds =
181 const std::vector<bool>& serLinkRecEnable =
187 toAdd.setGtBoardSlot(boardSlot);
188 toAdd.setGtPsbCh0SendLvds(sendLvds0);
189 toAdd.setGtPsbCh1SendLvds(sendLvds1);
190 toAdd.setGtPsbEnableRecLvds(enableRecLvds);
191 toAdd.setGtPsbEnableRecSerLink(serLinkRecEnable);
194 psbSetup.push_back(
toAdd);
198 std::vector<L1GtPsbConfig>& psbSetup)
const {
207 toAdd.setGtBoardSlot(boardSlot);
208 toAdd.setGtPsbCh0SendLvds(
false);
209 toAdd.setGtPsbCh1SendLvds(
false);
210 toAdd.setGtPsbEnableRecLvds(allFalseLvds);
211 toAdd.setGtPsbEnableRecSerLink(allFalseSerLink);
213 psbSetup.push_back(
toAdd);
219 unsigned nColumns)
const {
220 std::vector<bool>
result(nColumns);
222 for (
unsigned i = 0;
i < nColumns; ++
i) {
234 if (
result.queryFailed()) {
235 edm::LogError(
"L1-O2O") <<
"\n " << queryDescription +
" failed: no match found!";
238 }
else if (
result.numberRows() != 1) {
239 edm::LogError(
"L1-O2O") <<
"\nProblem with " << queryDescription <<
": " << (
result.numberRows())
240 <<
" rows were returned, expected 1.";
254 std::ostringstream colName;
257 return colName.str();
261 std::istringstream
stream(aString);
264 for (
unsigned i = 0;
i < aString.size(); ++
i) {
277 throw cms::Exception(
"NumberNotFound") <<
"Failed to extract numeric value from " << aString;
static bool notPsbColumnName(const std::string &columnName)
void addDefaultPsb(const std::string &psbColumn, std::vector< L1GtPsbConfig > &psbSetup) const
Creates a default valued PSB from an empty foreign key in the GT_SETUP table.
const QueryResults singleAttribute(const T &data) const
std::string numberedColumnName(const std::string &prefix, unsigned number, const std::string &suffix) const
Concatenates prefix, number and suffix into a string.
std::unique_ptr< L1GtPsbSetup > newObject(const std::string &objectKey) override
public methods
static const int PsbSerLinkNumberChannels
number of channels per board
Log< level::Error, false > LogError
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
~L1GtPsbSetupConfigOnlineProd() override
destructor
static const int PsbNumberLvdsGroups
number of LVDS groups per board
bool checkOneLineResult(const l1t::OMDSReader::QueryResults &result, const std::string &queryDescription) const
Ensures that result contains exactly one line, returning false otherwise.
std::vector< std::string > columnNames(const std::string &schemaName, const std::string &tableName)
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
bool fillVariable(const std::string &columnName, T &outputVariable) const
l1t::OMDSReader m_omdsReader
void getRequiredValue(const l1t::OMDSReader::QueryResults &result, const std::string &colName, T &value) const
std::vector< bool > extractBoolVector(const l1t::OMDSReader::QueryResults &query, const std::string &prefix, const std::string &suffix, unsigned nColumns) const
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
L1GtPsbSetupConfigOnlineProd(const edm::ParameterSet &)
constructor
unsigned numberFromString(const std::string &aString) const
void addPsbFromDb(const std::string &psbKey, std::vector< L1GtPsbConfig > &psbSetup)
Creates a new PSB object from a GT_PSB_SETUP entry and adds.