CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/L1TriggerConfig/GMTConfigProducers/src/L1MuGMTParametersKeysOnlineProd.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   \class L1MuGMTParametersOnlineProd
00004 //
00005 //   Description:      A key producer to deduce the GMT LUT keys from the master 
00006 //                     GMT configuration  key, closely following the example of 
00007 //
00008 //   https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideL1ConfigOnlineProd r11
00009 //
00010 //   $Date: 2009/03/13 17:55:39 $
00011 //   $Revision: 1.2 $
00012 //
00013 //   Author :
00014 //   Thomas Themel
00015 //
00016 //--------------------------------------------------
00017 
00018 #include "CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h"
00019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00020 
00021 
00022 class L1MuGMTParametersKeysOnlineProd : public L1ObjectKeysOnlineProdBase {
00023    public:
00024       L1MuGMTParametersKeysOnlineProd(const edm::ParameterSet& iConfig)
00025          : L1ObjectKeysOnlineProdBase( iConfig ) 
00026       {
00027         LogDebug( "L1-O2O" ) << "L1MuGMTParametersKeysOnlineProd created"  << std::endl;
00028       }
00029       ~L1MuGMTParametersKeysOnlineProd() {}
00030 
00031       virtual void fillObjectKeys( ReturnType pL1TriggerKey ) ;
00032    private:
00033 };
00034 
00035 
00036 
00037 void
00038 L1MuGMTParametersKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey )
00039 {
00040     
00041       std::string subsystemKey = pL1TriggerKey->subsystemKey( L1TriggerKey::kGMT ) ;
00042 
00043       if( !subsystemKey.empty() )
00044         {
00045 
00046       l1t::OMDSReader::QueryResults lutKeyResults =
00047       m_omdsReader.basicQuery(
00048           // SELECTed column
00049           "LUT_KEY",
00050           // schema name
00051           "CMS_GMT",
00052           // table name
00053           "GMT_CONFIG",
00054           // WHERE lhs
00055           "GMT_CONFIG.KEY",
00056           // WHERE rhs
00057           m_omdsReader.singleAttribute( subsystemKey  ) );
00058 
00059       if( lutKeyResults.queryFailed() || lutKeyResults.numberRows() != 1 ) // check if query was successful
00060       {
00061          edm::LogError( "L1-O2O" ) << "Problem extracting GMT LUT key from GMT config key." ;
00062          return ;
00063       }
00064 
00065       l1t::OMDSReader::QueryResults softwareConfigKeyResults =
00066       m_omdsReader.basicQuery(
00067           // SELECTed column
00068          "GMT_SOFTWARE_CONFIG",
00069           // schema name
00070          "CMS_GMT",
00071           // table name
00072          "GMT_LUTS",
00073           // WHERE lhs
00074          "GMT_LUTS.KEY",
00075           // WHERE rhs
00076          lutKeyResults);
00077 
00078       if( softwareConfigKeyResults.queryFailed() || softwareConfigKeyResults.numberRows() != 1 ) // check if query was successful
00079       {
00080          edm::LogError( "L1-O2O" ) << "Problem extracting GMT software config key from GMT config key." ;
00081          return ;
00082       }
00083 
00084       std::string objectKey ;
00085       softwareConfigKeyResults.fillVariable(objectKey) ;
00086 
00087       pL1TriggerKey->add( "L1MuGMTParametersRcd", "L1MuGMTParameters", objectKey ) ;
00088         }
00089 }
00090 
00091 DEFINE_FWK_EVENTSETUP_MODULE(L1MuGMTParametersKeysOnlineProd);