CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuGMTParametersKeysOnlineProd.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 //
11 // Author :
12 // Thomas Themel
13 //
14 //--------------------------------------------------
15 
18 
19 
21  public:
23  : L1ObjectKeysOnlineProdBase( iConfig )
24  {
25  LogDebug( "L1-O2O" ) << "L1MuGMTParametersKeysOnlineProd created" << std::endl;
26  }
28 
29  virtual void fillObjectKeys( ReturnType pL1TriggerKey ) override ;
30  private:
31 };
32 
33 
34 
35 void
37 {
38 
39  std::string subsystemKey = pL1TriggerKey->subsystemKey( L1TriggerKey::kGMT ) ;
40 
41  if( !subsystemKey.empty() )
42  {
43 
44  l1t::OMDSReader::QueryResults lutKeyResults =
46  // SELECTed column
47  "LUT_KEY",
48  // schema name
49  "CMS_GMT",
50  // table name
51  "GMT_CONFIG",
52  // WHERE lhs
53  "GMT_CONFIG.KEY",
54  // WHERE rhs
55  m_omdsReader.singleAttribute( subsystemKey ) );
56 
57  if( lutKeyResults.queryFailed() || lutKeyResults.numberRows() != 1 ) // check if query was successful
58  {
59  edm::LogError( "L1-O2O" ) << "Problem extracting GMT LUT key from GMT config key." ;
60  return ;
61  }
62 
63  l1t::OMDSReader::QueryResults softwareConfigKeyResults =
65  // SELECTed column
66  "GMT_SOFTWARE_CONFIG",
67  // schema name
68  "CMS_GMT",
69  // table name
70  "GMT_LUTS",
71  // WHERE lhs
72  "GMT_LUTS.KEY",
73  // WHERE rhs
74  lutKeyResults);
75 
76  if( softwareConfigKeyResults.queryFailed() || softwareConfigKeyResults.numberRows() != 1 ) // check if query was successful
77  {
78  edm::LogError( "L1-O2O" ) << "Problem extracting GMT software config key from GMT config key." ;
79  return ;
80  }
81 
82  std::string objectKey ;
83  softwareConfigKeyResults.fillVariable(objectKey) ;
84 
85  pL1TriggerKey->add( "L1MuGMTParametersRcd", "L1MuGMTParameters", objectKey ) ;
86  }
87 }
88 
#define LogDebug(id)
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) override
L1MuGMTParametersKeysOnlineProd(const edm::ParameterSet &iConfig)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
return(e1-e2)*(e1-e2)+dp *dp