CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuGMTChannelMaskOnlineProducer.cc
Go to the documentation of this file.
4 
5 class L1MuGMTChannelMaskOnlineProducer : public L1ConfigOnlineProdBase< L1MuGMTChannelMaskRcd, L1MuGMTChannelMask > {
6  public:
10 
11  virtual boost::shared_ptr< L1MuGMTChannelMask > newObject( const std::string& objectKey ) override ;
12  private:
13 };
14 
15 boost::shared_ptr< L1MuGMTChannelMask >
17 {
18 
19  std::vector<std::string> columns;
20  columns.push_back("ENABLE_RPCB");
21  columns.push_back("ENABLE_CSC");
22  columns.push_back("ENABLE_DT");
23  columns.push_back("ENABLE_RPCF");
24 
25  // Execute SQL queries to get data from OMDS (using key) and make C++ object
26  // Example: SELECT A_PARAMETER FROM CMS_XXX.XXX_CONF WHERE XXX_CONF.XXX_KEY = objectKey
29  columns,
30  "CMS_GMT",
31  "GMT_RUN_SETTINGS",
32  "GMT_RUN_SETTINGS.ID",
33  m_omdsReader.singleAttribute( objectKey ) ) ;
34 
35  if( results.queryFailed() ) // check if query was successful
36  {
37  edm::LogError( "L1-O2O" ) << "L1MuGMTChannelMaskOnlineProducer: Problem getting " << objectKey << " key from GMT_RUN_SETTING." ;
38  return boost::shared_ptr< L1MuGMTChannelMask >() ;
39  }
40 
41  unsigned mask = 0;
42  bool maskaux;
43  results.fillVariable( "ENABLE_RPCB", maskaux ) ;
44  if(!maskaux) mask|=2;
45  results.fillVariable( "ENABLE_CSC", maskaux ) ;
46  if(!maskaux) mask|=4;
47  results.fillVariable( "ENABLE_DT", maskaux ) ;
48  if(!maskaux) mask|=1;
49  results.fillVariable( "ENABLE_RPCF", maskaux ) ;
50  if(!maskaux) mask|=8;
51 
52  boost::shared_ptr< L1MuGMTChannelMask > gmtchanmask = boost::shared_ptr< L1MuGMTChannelMask >( new L1MuGMTChannelMask() );
53 
54  gmtchanmask->setSubsystemMask(mask);
55 
56  return gmtchanmask;
57 }
58 
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:311
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:295
L1MuGMTChannelMaskOnlineProducer(const edm::ParameterSet &iConfig)
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="") const
Definition: OMDSReader.cc:87
virtual boost::shared_ptr< L1MuGMTChannelMask > newObject(const std::string &objectKey) override
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60