Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:14:13

0001 #include "CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 
0004 class L1GctRSObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBase {
0005 public:
0006   L1GctRSObjectKeysOnlineProd(const edm::ParameterSet& iConfig);
0007   ~L1GctRSObjectKeysOnlineProd() override {}
0008 
0009   void fillObjectKeys(FillType pL1TriggerKey) override;
0010 
0011 private:
0012   bool m_enableL1GctChannelMask;
0013 };
0014 
0015 L1GctRSObjectKeysOnlineProd::L1GctRSObjectKeysOnlineProd(const edm::ParameterSet& iConfig)
0016     : L1ObjectKeysOnlineProdBase(iConfig),
0017       m_enableL1GctChannelMask(iConfig.getParameter<bool>("enableL1GctChannelMask")) {}
0018 
0019 void L1GctRSObjectKeysOnlineProd::fillObjectKeys(FillType pL1TriggerKey) {
0020   if (m_enableL1GctChannelMask) {
0021     // Execute SQL queries to get data from OMDS (using key) and make C++ object.
0022     // Example: SELECT A_KEY FROM CMS_XXX.XXX_RUN_SETTINGS_KEYS_CURRENT
0023 
0024     l1t::OMDSReader::QueryResults objectKeyResults =
0025         m_omdsReader.basicQuery("GCT_MASKS_KEY", "CMS_GCT", "GCT_MASKS_CURRENT");
0026 
0027     std::string maskKey;
0028 
0029     // check if query was successful
0030     if (objectKeyResults.queryFailed()) {
0031       edm::LogError("L1-O2O") << "Problem with key for record L1GctChannelMaskRcd: query failed ";
0032     } else if (objectKeyResults.numberRows() != 1) {
0033       edm::LogError("L1-O2O") << "Problem with key for record L1GctChannelMaskRcd: " << (objectKeyResults.numberRows())
0034                               << " rows were returned";
0035     } else {
0036       objectKeyResults.fillVariable(maskKey);
0037     }
0038 
0039     pL1TriggerKey->add("L1GctChannelMaskRcd", "L1GctChannelMask", maskKey);
0040   }
0041 }
0042 
0043 DEFINE_FWK_EVENTSETUP_MODULE(L1GctRSObjectKeysOnlineProd);