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