CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1MuGMTChannelMaskOnlineProducer.cc
Go to the documentation of this file.
4 
5 class L1MuGMTChannelMaskOnlineProducer : public L1ConfigOnlineProdBase<L1MuGMTChannelMaskRcd, L1MuGMTChannelMask> {
6 public:
10 
11  std::unique_ptr<L1MuGMTChannelMask> newObject(const std::string& objectKey) override;
12 
13 private:
14 };
15 
16 std::unique_ptr<L1MuGMTChannelMask> L1MuGMTChannelMaskOnlineProducer::newObject(const std::string& objectKey) {
17  std::vector<std::string> columns;
18  columns.push_back("ENABLE_RPCB");
19  columns.push_back("ENABLE_CSC");
20  columns.push_back("ENABLE_DT");
21  columns.push_back("ENABLE_RPCF");
22 
23  // Execute SQL queries to get data from OMDS (using key) and make C++ object
24  // Example: SELECT A_PARAMETER FROM CMS_XXX.XXX_CONF WHERE XXX_CONF.XXX_KEY = objectKey
26  columns, "CMS_GMT", "GMT_RUN_SETTINGS", "GMT_RUN_SETTINGS.ID", m_omdsReader.singleAttribute(objectKey));
27 
28  if (results.queryFailed()) // check if query was successful
29  {
30  edm::LogError("L1-O2O") << "L1MuGMTChannelMaskOnlineProducer: Problem getting " << objectKey
31  << " key from GMT_RUN_SETTING.";
32  return std::unique_ptr<L1MuGMTChannelMask>();
33  }
34 
35  unsigned mask = 0;
36  bool maskaux;
37  results.fillVariable("ENABLE_RPCB", maskaux);
38  if (!maskaux)
39  mask |= 2;
40  results.fillVariable("ENABLE_CSC", maskaux);
41  if (!maskaux)
42  mask |= 4;
43  results.fillVariable("ENABLE_DT", maskaux);
44  if (!maskaux)
45  mask |= 1;
46  results.fillVariable("ENABLE_RPCF", maskaux);
47  if (!maskaux)
48  mask |= 8;
49 
50  auto gmtchanmask = std::make_unique<L1MuGMTChannelMask>();
51 
52  gmtchanmask->setSubsystemMask(mask);
53 
54  return gmtchanmask;
55 }
56 
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:274
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
dictionary results
L1MuGMTChannelMaskOnlineProducer(const edm::ParameterSet &iConfig)
Log< level::Error, false > LogError
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
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
tuple columns
Definition: mps_check.py:244
std::unique_ptr< L1MuGMTChannelMask > newObject(const std::string &objectKey) override