CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #include "CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h"
00002 #include "CondFormats/L1TObjects/interface/L1MuGMTChannelMask.h"
00003 #include "CondFormats/DataRecord/interface/L1MuGMTChannelMaskRcd.h"
00004 
00005 class L1MuGMTChannelMaskOnlineProducer : public L1ConfigOnlineProdBase< L1MuGMTChannelMaskRcd, L1MuGMTChannelMask > {
00006    public:
00007       L1MuGMTChannelMaskOnlineProducer(const edm::ParameterSet& iConfig)
00008          : L1ConfigOnlineProdBase< L1MuGMTChannelMaskRcd, L1MuGMTChannelMask >( iConfig ) {}
00009       ~L1MuGMTChannelMaskOnlineProducer() {}
00010 
00011       virtual boost::shared_ptr< L1MuGMTChannelMask > newObject( const std::string& objectKey ) ;
00012    private:
00013 };
00014 
00015 boost::shared_ptr< L1MuGMTChannelMask >
00016 L1MuGMTChannelMaskOnlineProducer::newObject( const std::string& objectKey )
00017 {
00018 
00019    std::vector<std::string> columns;
00020    columns.push_back("ENABLE_RPCB");
00021    columns.push_back("ENABLE_CSC");
00022    columns.push_back("ENABLE_DT");
00023    columns.push_back("ENABLE_RPCF");
00024 
00025    // Execute SQL queries to get data from OMDS (using key) and make C++ object
00026    // Example: SELECT A_PARAMETER FROM CMS_XXX.XXX_CONF WHERE XXX_CONF.XXX_KEY = objectKey
00027    l1t::OMDSReader::QueryResults results =
00028        m_omdsReader.basicQuery(
00029          columns,
00030          "CMS_GMT",
00031          "GMT_RUN_SETTINGS",
00032          "GMT_RUN_SETTINGS.ID",
00033          m_omdsReader.singleAttribute( objectKey ) ) ;
00034 
00035    if( results.queryFailed() ) // check if query was successful
00036    {
00037       edm::LogError( "L1-O2O" ) << "L1MuGMTChannelMaskOnlineProducer: Problem getting " << objectKey << " key from GMT_RUN_SETTING." ;
00038       return boost::shared_ptr< L1MuGMTChannelMask >() ;
00039    }
00040 
00041    unsigned mask = 0;
00042    bool maskaux;
00043    results.fillVariable( "ENABLE_RPCB", maskaux ) ;
00044    if(!maskaux) mask|=2;
00045    results.fillVariable( "ENABLE_CSC", maskaux ) ;
00046    if(!maskaux) mask|=4;
00047    results.fillVariable( "ENABLE_DT", maskaux ) ;
00048    if(!maskaux) mask|=1;
00049    results.fillVariable( "ENABLE_RPCF", maskaux ) ;
00050    if(!maskaux) mask|=8;
00051 
00052    boost::shared_ptr< L1MuGMTChannelMask > gmtchanmask = boost::shared_ptr< L1MuGMTChannelMask >( new L1MuGMTChannelMask() );
00053 
00054    gmtchanmask->setSubsystemMask(mask);
00055    
00056    return gmtchanmask;
00057 }
00058 
00059 DEFINE_FWK_EVENTSETUP_MODULE(L1MuGMTChannelMaskOnlineProducer);