CMS 3D CMS Logo

List of all members | Static Public Member Functions
l1t::OnlineDBqueryHelper Class Reference

#include <OnlineDBqueryHelper.h>

Static Public Member Functions

static std::map< std::string, std::string > fetch (const std::vector< std::string > &queryColumns, const std::string &table, const std::string &key, l1t::OMDSReader &m_omdsReader)
 

Detailed Description

Definition at line 16 of file OnlineDBqueryHelper.h.

Member Function Documentation

◆ fetch()

std::map< std::string, std::string > l1t::OnlineDBqueryHelper::fetch ( const std::vector< std::string > &  queryColumns,
const std::string &  table,
const std::string &  key,
l1t::OMDSReader m_omdsReader 
)
static

Definition at line 3 of file OnlineDBqueryHelper.cc.

6  {
7  if (queryColumns.empty() || table.length() == 0)
8  return std::map<std::string, std::string>();
9 
10  l1t::OMDSReader::QueryResults queryResult =
11  m_omdsReader.basicQuery(queryColumns, "CMS_TRG_L1_CONF", table, table + ".ID", m_omdsReader.singleAttribute(key));
12 
13  if (queryResult.queryFailed() || queryResult.numberRows() != 1)
14  throw std::runtime_error(std::string("Cannot get ") + table + ".{" +
15  std::accumulate(std::next(queryColumns.begin()),
16  queryColumns.end(),
17  std::string(queryColumns[0]),
18  [](const std::string &a, const std::string &b) { return a + "," + b; }) +
19  "} for ID = " + key);
20 
21  std::vector<std::string> retval(queryColumns.size());
22 
23  std::transform(queryColumns.begin(), queryColumns.end(), retval.begin(), [queryResult](const std::string &a) {
25  if (!queryResult.fillVariable(a, res))
26  res = "";
27  return res;
28  });
29 
30  std::map<std::string, std::string> retvalMap;
31  for (unsigned int i = 0; i < queryColumns.size(); i++)
32  retvalMap.insert(make_pair(queryColumns[i], retval[i]));
33 
34  return retvalMap;
35 }

References a, b, l1t::OMDSReader::basicQuery(), l1t::OMDSReader::QueryResults::fillVariable(), mps_fire::i, crabWrapper::key, GetRecoTauVFromDQM_MC_cff::next, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), l1t::OMDSReader::singleAttribute(), AlCaHLTBitMon_QueryRunRegistry::string, TableParser::table, and HcalDetIdTransform::transform().

Referenced by L1TMuonEndCapObjectKeysOnlineProd::fillObjectKeys(), L1TMuonEndCapParamsOnlineProd::newObject(), L1TMuonGlobalParamsOnlineProd::newObject(), L1TMuonBarrelParamsOnlineProd::newObject(), L1TCaloParamsOnlineProd::newObject(), and L1TGlobalPrescalesVetosOnlineProd::newObject().

l1t::OMDSReader::QueryResults
Definition: OMDSReader.h:49
mps_fire.i
i
Definition: mps_fire.py:355
l1t::OMDSReader::singleAttribute
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
l1t::OMDSReader::QueryResults::fillVariable
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:274
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
a
double a
Definition: hdecay.h:119
l1t::OMDSReader::QueryResults::numberRows
int numberRows() const
Definition: OMDSReader.h:60
l1t::OMDSReader::basicQuery
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="")
Definition: OMDSReader.cc:75
res
Definition: Electron.h:6
l1t::OMDSReader::QueryResults::queryFailed
bool queryFailed() const
Definition: OMDSReader.h:59
TableParser.table
table
Definition: TableParser.py:111
crabWrapper.key
key
Definition: crabWrapper.py:19
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31