test
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 //
11 // Author :
12 // Thomas Themel
13 //
14 //--------------------------------------------------
15 
19 
20 
22  public:
24  : L1ObjectKeysOnlineProdBase( iConfig ),
25  m_objectTypes(iConfig.getParameter<std::vector<std::string> >("objectTypes")),
26  m_recordTypes(iConfig.getParameter<std::vector<std::string> >("recordTypes"))
27  {
28  if(m_objectTypes.size() != m_recordTypes.size()) {
29  throw cond::Exception("mismatch: need equal number objectType and recordType entries!");
30  }
31  }
32 
34 
35  virtual void fillObjectKeys( ReturnType pL1TriggerKey ) override ;
36 
37  private:
38  std::vector<std::string> m_objectTypes;
39  std::vector<std::string> m_recordTypes;
40 
41 };
42 
43 void
45 {
46 
47  std::string subsystemKey = pL1TriggerKey->subsystemKey( L1TriggerKey::kGMT ) ;
48 
49  if( !subsystemKey.empty() )
50  {
51  // Lookup GT scales key from GMT main config key
52  l1t::OMDSReader::QueryResults scalesKeyResults =
54  // SELECTed column
55  "SCALES_KEY",
56  // schema name
57  "CMS_GMT",
58  // table name
59  "GMT_CONFIG",
60  // WHERE lhs
61  "GMT_CONFIG.KEY",
62  // WHERE rhs
63  m_omdsReader.singleAttribute( subsystemKey ) );
64 
65  if( scalesKeyResults.numberRows() != 1 ) // check if query was successful
66  {
67  edm::LogError( "L1-O2O" ) << "Problem extracting GMT scales key from GMT config key." ;
68  return ;
69  }
70 
71  std::string objectKey ;
72  scalesKeyResults.fillVariable(objectKey) ;
73 
74  edm::LogError( "L1-O2O" ) << "Registering " << m_recordTypes.size() << " keys ";
75  // register the scales key for all the scales types we need to produce
76  for(unsigned i = 0; i < m_recordTypes.size() ; ++i) {
77  edm::LogError( "L1-O2O" ) << "Registering scales key " << objectKey << " for " << m_recordTypes[i];
78  pL1TriggerKey->add(m_recordTypes[i], m_objectTypes[i], objectKey ) ;
79  }
80  }
81 }
82 
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
return((rh^lh)&mask)
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
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
virtual void fillObjectKeys(ReturnType pL1TriggerKey) override
L1MuTriggerScaleKeysOnlineProd(const edm::ParameterSet &iConfig)