CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuTriggerScaleKeysOnlineProd.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // \class L1MuGMTParametersOnlineProd
4 //
5 // Description: A key producer to deduce the GMT LUT keys from the master
6 // GMT configuration key, closely following the example of
7 //
8 // https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideL1ConfigOnlineProd r11
9 //
10 // $Date: 2009/03/18 14:13:10 $
11 // $Revision: 1.3 $
12 //
13 // Author :
14 // Thomas Themel
15 //
16 //--------------------------------------------------
17 
21 
22 
24  public:
26  : L1ObjectKeysOnlineProdBase( iConfig ),
27  m_objectTypes(iConfig.getParameter<std::vector<std::string> >("objectTypes")),
28  m_recordTypes(iConfig.getParameter<std::vector<std::string> >("recordTypes"))
29  {
30  if(m_objectTypes.size() != m_recordTypes.size()) {
31  throw cond::Exception("mismatch: need equal number objectType and recordType entries!");
32  }
33  }
34 
36 
37  virtual void fillObjectKeys( ReturnType pL1TriggerKey ) ;
38 
39  private:
40  std::vector<std::string> m_objectTypes;
41  std::vector<std::string> m_recordTypes;
42 
43 };
44 
45 void
47 {
48 
49  std::string subsystemKey = pL1TriggerKey->subsystemKey( L1TriggerKey::kGMT ) ;
50 
51  if( !subsystemKey.empty() )
52  {
53  // Lookup GT scales key from GMT main config key
54  l1t::OMDSReader::QueryResults scalesKeyResults =
56  // SELECTed column
57  "SCALES_KEY",
58  // schema name
59  "CMS_GMT",
60  // table name
61  "GMT_CONFIG",
62  // WHERE lhs
63  "GMT_CONFIG.KEY",
64  // WHERE rhs
65  m_omdsReader.singleAttribute( subsystemKey ) );
66 
67  if( scalesKeyResults.numberRows() != 1 ) // check if query was successful
68  {
69  edm::LogError( "L1-O2O" ) << "Problem extracting GMT scales key from GMT config key." ;
70  return ;
71  }
72 
73  std::string objectKey ;
74  scalesKeyResults.fillVariable(objectKey) ;
75 
76  edm::LogError( "L1-O2O" ) << "Registering " << m_recordTypes.size() << " keys ";
77  // register the scales key for all the scales types we need to produce
78  for(unsigned i = 0; i < m_recordTypes.size() ; ++i) {
79  edm::LogError( "L1-O2O" ) << "Registering scales key " << objectKey << " for " << m_recordTypes[i];
80  pL1TriggerKey->add(m_recordTypes[i], m_objectTypes[i], objectKey ) ;
81  }
82  }
83 }
84 
int i
Definition: DBlmapReader.cc:9
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:311
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:295
boost::shared_ptr< L1TriggerKey > ReturnType
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 void fillObjectKeys(ReturnType pL1TriggerKey)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
L1MuTriggerScaleKeysOnlineProd(const edm::ParameterSet &iConfig)