Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /**
0002  * \class L1MuGMTRSKeysOnlineProd
0003  *
0004  *
0005  * Description: online producer for GMT RUN SETTINGS.
0006  *
0007  * Implementation:
0008  *    
0009  *
0010  * \author: Ivan Mikulec
0011  *
0012  *
0013  */
0014 
0015 #include "CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h"
0016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0017 
0018 class L1MuGMTRSKeysOnlineProd : public L1ObjectKeysOnlineProdBase {
0019 public:
0020   L1MuGMTRSKeysOnlineProd(const edm::ParameterSet& iConfig);
0021   ~L1MuGMTRSKeysOnlineProd() override {}
0022 
0023   void fillObjectKeys(FillType pL1TriggerKey) override;
0024 
0025 private:
0026   bool m_enableL1MuGMTChannelMask;
0027 };
0028 
0029 L1MuGMTRSKeysOnlineProd::L1MuGMTRSKeysOnlineProd(const edm::ParameterSet& iConfig)
0030     : L1ObjectKeysOnlineProdBase(iConfig),
0031       m_enableL1MuGMTChannelMask(iConfig.getParameter<bool>("enableL1MuGMTChannelMask")) {}
0032 
0033 void L1MuGMTRSKeysOnlineProd::fillObjectKeys(FillType pL1TriggerKey) {
0034   if (m_enableL1MuGMTChannelMask) {
0035     // Execute SQL queries to get data from OMDS (using key) and make C++ object.
0036     // Example: SELECT A_KEY FROM CMS_XXX.XXX_RUN_SETTINGS_KEYS_CURRENT
0037     l1t::OMDSReader::QueryResults objectKeyResults =
0038         m_omdsReader.basicQuery("GMT_RUN_SETTINGS_FK", "CMS_GMT", "GMT_RUN_SETTINGS_KEY_CURRENT");
0039 
0040     std::string objectKey;
0041 
0042     // check if query was successful
0043     if (objectKeyResults.queryFailed()) {
0044       edm::LogError("L1-O2O") << "Problem with key for record L1MuGMTChannelMaskRcd: query failed ";
0045     } else if (objectKeyResults.numberRows() != 1) {
0046       edm::LogError("L1-O2O") << "Problem with key for record L1MuGMTChannelMaskRcd: "
0047                               << (objectKeyResults.numberRows()) << " rows were returned";
0048     } else {
0049       objectKeyResults.fillVariable(objectKey);
0050     }
0051 
0052     pL1TriggerKey->add("L1MuGMTChannelMaskRcd", "L1MuGMTChannelMask", objectKey);
0053   }
0054 }
0055 
0056 DEFINE_FWK_EVENTSETUP_MODULE(L1MuGMTRSKeysOnlineProd);