CMS 3D CMS Logo

L1MuTriggerScaleKeysOnlineProd.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // \class L1MuGMTParametersOnlineProd
4 //
5 // Description: A key producer to deduce the GMT LUT keys from the master
6 // GMT configuration key, closely following the example of
7 //
8 // https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideL1ConfigOnlineProd r11
9 //
10 //
11 // Author :
12 // Thomas Themel
13 //
14 //--------------------------------------------------
15 
18 
20 public:
22  : L1ObjectKeysOnlineProdBase(iConfig),
23  m_objectTypes(iConfig.getParameter<std::vector<std::string> >("objectTypes")),
24  m_recordTypes(iConfig.getParameter<std::vector<std::string> >("recordTypes")) {
25  if (m_objectTypes.size() != m_recordTypes.size()) {
26  throw cond::Exception("mismatch: need equal number objectType and recordType entries!");
27  }
28  }
29 
31 
32  void fillObjectKeys(FillType pL1TriggerKey) override;
33 
34 private:
35  std::vector<std::string> m_objectTypes;
36  std::vector<std::string> m_recordTypes;
37 };
38 
40  std::string subsystemKey = pL1TriggerKey->subsystemKey(L1TriggerKey::kGMT);
41 
42  if (!subsystemKey.empty()) {
43  // Lookup GT scales key from GMT main config key
45  // SELECTed column
46  "SCALES_KEY",
47  // schema name
48  "CMS_GMT",
49  // table name
50  "GMT_CONFIG",
51  // WHERE lhs
52  "GMT_CONFIG.KEY",
53  // WHERE rhs
54  m_omdsReader.singleAttribute(subsystemKey));
55 
56  if (scalesKeyResults.numberRows() != 1) // check if query was successful
57  {
58  edm::LogError("L1-O2O") << "Problem extracting GMT scales key from GMT config key.";
59  return;
60  }
61 
62  std::string objectKey;
63  scalesKeyResults.fillVariable(objectKey);
64 
65  edm::LogError("L1-O2O") << "Registering " << m_recordTypes.size() << " keys ";
66  // register the scales key for all the scales types we need to produce
67  for (unsigned i = 0; i < m_recordTypes.size(); ++i) {
68  edm::LogError("L1-O2O") << "Registering scales key " << objectKey << " for " << m_recordTypes[i];
69  pL1TriggerKey->add(m_recordTypes[i], m_objectTypes[i], objectKey);
70  }
71  }
72 }
73 
persistency::Exception Exception
Definition: Exception.h:25
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
std::unique_ptr< L1TriggerKey >::pointer FillType
Log< level::Error, false > LogError
void fillObjectKeys(FillType pL1TriggerKey) override
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
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:274
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
L1MuTriggerScaleKeysOnlineProd(const edm::ParameterSet &iConfig)