00001 #include "CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h" 00002 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00003 00004 class L1GctRSObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBase { 00005 public: 00006 L1GctRSObjectKeysOnlineProd(const edm::ParameterSet& iConfig) ; 00007 ~L1GctRSObjectKeysOnlineProd() {} 00008 00009 virtual void fillObjectKeys( ReturnType pL1TriggerKey ) ; 00010 private: 00011 bool m_enableL1GctChannelMask ; 00012 }; 00013 00014 L1GctRSObjectKeysOnlineProd::L1GctRSObjectKeysOnlineProd(const edm::ParameterSet& iConfig) 00015 : L1ObjectKeysOnlineProdBase( iConfig ), 00016 m_enableL1GctChannelMask( iConfig.getParameter< bool >( "enableL1GctChannelMask" ) ) 00017 { 00018 } 00019 00020 void 00021 L1GctRSObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey ) 00022 { 00023 if( m_enableL1GctChannelMask ) 00024 { 00025 // Execute SQL queries to get data from OMDS (using key) and make C++ object. 00026 // Example: SELECT A_KEY FROM CMS_XXX.XXX_RUN_SETTINGS_KEYS_CURRENT 00027 00028 l1t::OMDSReader::QueryResults objectKeyResults = 00029 m_omdsReader.basicQuery( 00030 "GCT_MASKS_KEY", 00031 "CMS_GCT", 00032 "GCT_MASKS_CURRENT" ); 00033 00034 std::string maskKey ; 00035 00036 // check if query was successful 00037 if( objectKeyResults.queryFailed() ) 00038 { 00039 edm::LogError("L1-O2O") 00040 << "Problem with key for record L1GctChannelMaskRcd: query failed "; 00041 } 00042 else if( objectKeyResults.numberRows() != 1 ) 00043 { 00044 edm::LogError("L1-O2O") 00045 << "Problem with key for record L1GctChannelMaskRcd: " 00046 << (objectKeyResults.numberRows()) << " rows were returned"; 00047 } 00048 else 00049 { 00050 objectKeyResults.fillVariable( maskKey ) ; 00051 } 00052 00053 pL1TriggerKey->add( "L1GctChannelMaskRcd", "L1GctChannelMask", maskKey ) ; 00054 } 00055 } 00056 00057 DEFINE_FWK_EVENTSETUP_MODULE(L1GctRSObjectKeysOnlineProd);