test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1SubsystemKeysOnlineProdExt.cc
Go to the documentation of this file.
2 
4 
7 
10 
12 
14  : m_tscKey( iConfig.getParameter< std::string >( "tscKey" ) ),
15  m_omdsReader(
16  iConfig.getParameter< std::string >( "onlineDB" ),
17  iConfig.getParameter< std::string >( "onlineAuthentication" ) ),
18  m_forceGeneration( iConfig.getParameter< bool >( "forceGeneration" ) )
19 {
20  //the following line is needed to tell the framework what
21  // data is being produced
22  setWhatProduced(this, "SubsystemKeysOnly");
23 
24  //now do what ever other initialization is needed
25 }
26 
27 
29 {
30 
31  // do anything here that needs to be done at desctruction time
32  // (e.g. close files, deallocate resources etc.)
33 
34 }
35 
36 
37 //
38 // member functions
39 //
40 
41 // ------------ method called to produce the data ------------
44 {
45  using namespace edm::es;
46  boost::shared_ptr<L1TriggerKeyExt> pL1TriggerKey ;
47 
48  // Get L1TriggerKeyListExt
49  L1TriggerKeyListExt keyList ;
50  l1t::DataWriterExt dataWriter ;
51  if( !dataWriter.fillLastTriggerKeyList( keyList ) )
52  {
53  edm::LogError( "L1-O2O" )
54  << "Problem getting last L1TriggerKeyListExt" ;
55  }
56 
57  // If L1TriggerKeyListExt does not contain TSC key, token is empty
58  if( keyList.token( m_tscKey ) == std::string() ||
60  {
61  // Instantiate new L1TriggerKey
62  pL1TriggerKey = boost::shared_ptr< L1TriggerKeyExt >(
63  new L1TriggerKeyExt() ) ;
64  pL1TriggerKey->setTSCKey( m_tscKey ) ;
65 
66  edm::LogVerbatim( "L1-O2O" ) << "TSC KEY " << m_tscKey ;
67 
68  // Get subsystem keys from OMDS
69 
70  // SELECT uGT_KEY FROM TRIGGERSUP_CONF WHERE TRIGGERSUP_CONF.TS_KEY = m_tscKey
71  std::vector< std::string > queryStrings ;
72  queryStrings.push_back( "UGT_KEY" ) ;
73 
74  l1t::OMDSReader::QueryResults subkeyResults =
75  m_omdsReader.basicQuery( queryStrings,
76  "CMS_TRG_L1_CONF",
77  "L1_TRG_CONF_KEYS",
78  "L1_TRG_CONF_KEYS.ID",
80 
81  if( subkeyResults.queryFailed() ||
82  subkeyResults.numberRows() != 1 ) // check query successful
83  {
84  edm::LogError( "L1-O2O" ) << "Problem with subsystem keys." ;
85  return pL1TriggerKey ;
86  }
87 
88  std::string uGTKey;
89 
90  subkeyResults.fillVariable( "UGT_KEY", uGTKey ) ;
91  pL1TriggerKey->setSubsystemKey( L1TriggerKeyExt::kuGT, uGTKey ) ;
92  edm::LogVerbatim( "L1-O2O" ) << "UGT_KEY " << uGTKey ;
93 
94  }
95  else
96  {
98  "L1TriggerKeyExt for TSC key " + m_tscKey + " already in CondDB." ) ;
99  }
100 
101  return pL1TriggerKey ;
102 }
103 
104 //define this as a plug-in
105 //DEFINE_FWK_EVENTSETUP_MODULE(L1SubsystemKeysOnlineProdExt);
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:312
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:296
L1SubsystemKeysOnlineProdExt(const edm::ParameterSet &)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
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
ReturnType produce(const L1TriggerKeyExtRcd &)
boost::shared_ptr< L1TriggerKeyExt > ReturnType