Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:17

0001 //-------------------------------------------------
0002 //
0003 //   \class L1MuGMTParametersOnlineProd
0004 //
0005 //   Description:      A key producer to deduce the GMT LUT keys from the master
0006 //                     GMT configuration  key, closely following the example of
0007 //
0008 //   https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideL1ConfigOnlineProd r11
0009 //
0010 //
0011 //   Author :
0012 //   Thomas Themel
0013 //
0014 //--------------------------------------------------
0015 
0016 #include "CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h"
0017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0018 
0019 class L1MuGMTParametersKeysOnlineProd : public L1ObjectKeysOnlineProdBase {
0020 public:
0021   L1MuGMTParametersKeysOnlineProd(const edm::ParameterSet& iConfig) : L1ObjectKeysOnlineProdBase(iConfig) {
0022     LogDebug("L1-O2O") << "L1MuGMTParametersKeysOnlineProd created" << std::endl;
0023   }
0024   ~L1MuGMTParametersKeysOnlineProd() override {}
0025 
0026   void fillObjectKeys(FillType) override;
0027 
0028 private:
0029 };
0030 
0031 void L1MuGMTParametersKeysOnlineProd::fillObjectKeys(FillType pL1TriggerKey) {
0032   std::string subsystemKey = pL1TriggerKey->subsystemKey(L1TriggerKey::kGMT);
0033 
0034   if (!subsystemKey.empty()) {
0035     l1t::OMDSReader::QueryResults lutKeyResults = m_omdsReader.basicQuery(
0036         // SELECTed column
0037         "LUT_KEY",
0038         // schema name
0039         "CMS_GMT",
0040         // table name
0041         "GMT_CONFIG",
0042         // WHERE lhs
0043         "GMT_CONFIG.KEY",
0044         // WHERE rhs
0045         m_omdsReader.singleAttribute(subsystemKey));
0046 
0047     if (lutKeyResults.queryFailed() || lutKeyResults.numberRows() != 1)  // check if query was successful
0048     {
0049       edm::LogError("L1-O2O") << "Problem extracting GMT LUT key from GMT config key.";
0050       return;
0051     }
0052 
0053     l1t::OMDSReader::QueryResults softwareConfigKeyResults = m_omdsReader.basicQuery(
0054         // SELECTed column
0055         "GMT_SOFTWARE_CONFIG",
0056         // schema name
0057         "CMS_GMT",
0058         // table name
0059         "GMT_LUTS",
0060         // WHERE lhs
0061         "GMT_LUTS.KEY",
0062         // WHERE rhs
0063         lutKeyResults);
0064 
0065     if (softwareConfigKeyResults.queryFailed() ||
0066         softwareConfigKeyResults.numberRows() != 1)  // check if query was successful
0067     {
0068       edm::LogError("L1-O2O") << "Problem extracting GMT software config key from GMT config key.";
0069       return;
0070     }
0071 
0072     std::string objectKey;
0073     softwareConfigKeyResults.fillVariable(objectKey);
0074 
0075     pL1TriggerKey->add("L1MuGMTParametersRcd", "L1MuGMTParameters", objectKey);
0076   }
0077 }
0078 
0079 DEFINE_FWK_EVENTSETUP_MODULE(L1MuGMTParametersKeysOnlineProd);