CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
L1GtPrescaleFactorsAlgoTrigConfigOnlineProd Class Reference

#include <L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.h>

Inheritance diagram for L1GtPrescaleFactorsAlgoTrigConfigOnlineProd:
L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 L1GtPrescaleFactorsAlgoTrigConfigOnlineProd (const edm::ParameterSet &)
 constructor More...
 
virtual boost::shared_ptr
< L1GtPrescaleFactors
newObject (const std::string &objectKey)
 public methods More...
 
 ~L1GtPrescaleFactorsAlgoTrigConfigOnlineProd ()
 destructor More...
 
- Public Member Functions inherited from L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >
 L1ConfigOnlineProdBase (const edm::ParameterSet &)
 
boost::shared_ptr
< L1GtPrescaleFactors
produce (const L1GtPrescaleFactorsAlgoTrigRcd &iRecord)
 
 ~L1ConfigOnlineProdBase ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider ()
 

Private Attributes

bool m_isDebugEnabled
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey, boost::shared_ptr
< DataProxy > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >
bool getObjectKey (const L1GtPrescaleFactorsAlgoTrigRcd &record, boost::shared_ptr< L1GtPrescaleFactors > data, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- Protected Attributes inherited from L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >
bool m_copyFromCondDB
 
cond::DbConnection m_dbConnection
 
cond::DbSession m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Description: online producer for L1GtPrescaleFactorsAlgoTrigRcd.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna

$Date$ $Revision$

Definition at line 34 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.h.

Constructor & Destructor Documentation

L1GtPrescaleFactorsAlgoTrigConfigOnlineProd::L1GtPrescaleFactorsAlgoTrigConfigOnlineProd ( const edm::ParameterSet parSet)
L1GtPrescaleFactorsAlgoTrigConfigOnlineProd::~L1GtPrescaleFactorsAlgoTrigConfigOnlineProd ( )

destructor

Definition at line 39 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.cc.

39  {
40 
41  // empty
42 
43 }

Member Function Documentation

boost::shared_ptr< L1GtPrescaleFactors > L1GtPrescaleFactorsAlgoTrigConfigOnlineProd::newObject ( const std::string &  objectKey)
virtual

public methods

Implements L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >.

Definition at line 47 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.cc.

References l1t::OMDSReader::basicQuery(), l1t::OMDSReader::basicQueryView(), l1t::OMDSReader::columnNames(), l1t::OMDSReader::QueryResults::fillVariable(), l1t::OMDSReader::QueryResults::fillVariableFromRow(), i, edm::isDebugEnabled(), LogTrace, m_isDebugEnabled, L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >::m_omdsReader, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), python.entryComment::results, and l1t::OMDSReader::singleAttribute().

48  {
49 
50  // FIXME seems to not work anymore in constructor...
52 
53  // shared pointer for L1GtPrescaleFactors
54  boost::shared_ptr<L1GtPrescaleFactors> pL1GtPrescaleFactors =
55  boost::shared_ptr<L1GtPrescaleFactors>(new L1GtPrescaleFactors());
56 
57  // Procedure:
58  // objectKey received as input is GT_RUN_SETTINGS_FK
59  //
60  // get from GT_RUN_SETTINGS_PRESC_VIEW the PRESCALE_FACTORS_ALGO_FK and the index PRESCALE_INDEX
61  // for the GT_RUN_SETTINGS_FK
62  //
63  // get the prescale factors for key PRESCALE_FACTORS_ALGO_FK
64  // from GT_FDL_PRESCALE_FACTORS_ALGO table
65 
66  const std::string gtSchema = "CMS_GT";
67 
68  // select * from CMS_GT.GT_RUN_SETTINGS_PRESC_VIEW
69  // where GT_RUN_SETTINGS_PRESC_VIEW.ID = objectKey
70 
71  std::vector<std::string> columnsView;
72  columnsView.push_back("PRESCALE_INDEX");
73  columnsView.push_back("PRESCALE_FACTORS_ALGO_FK");
74 
76  columnsView, gtSchema, "GT_RUN_SETTINGS_PRESC_VIEW",
77  "GT_RUN_SETTINGS_PRESC_VIEW.ID", m_omdsReader.singleAttribute(
78  objectKey));
79 
80  // check if query was successful
81  if (resultsView.queryFailed()) {
82  edm::LogError("L1-O2O")
83  << "Problem to get content of GT_RUN_SETTINGS_PRESC_VIEW "
84  << "for GT_RUN_SETTINGS_PRESC_VIEW.ID: " << objectKey;
85  return pL1GtPrescaleFactors;
86  }
87 
88  // retrieve PRESCALE_INDEX and PRESCALE_FACTORS_ALGO_FK for GT_RUN_SETTINGS_FK
89 
90  std::string objectKeyPrescaleFactorsSet = "WRONG_KEY_INITIAL";
91  short prescaleFactorsSetIndex = 9999;
92 
93  int resultsViewRows = resultsView.numberRows();
94  if (m_isDebugEnabled) {
95  LogTrace("L1GtPrescaleFactorsAlgoTrigConfigOnlineProd") << "\nFound "
96  << resultsViewRows << " prescale factors sets for \n "
97  << "GT_RUN_SETTINGS_PRESC_VIEW.ID = " << objectKey << "\n"
98  << std::endl;
99  }
100 
101  // vector to be filled (resultsViewRows prescale factors sets)
102  std::vector<std::vector<int> > pFactors;
103  pFactors.reserve(resultsViewRows);
104 
105  int countSet = -1;
106 
107  for (int iRow = 0; iRow < resultsViewRows; ++iRow) {
108 
109  for (std::vector<std::string>::const_iterator constIt =
110  columnsView.begin(); constIt != columnsView.end(); ++constIt) {
111 
112  if ((*constIt) == "PRESCALE_INDEX") {
113  resultsView.fillVariableFromRow(*constIt, iRow,
114  prescaleFactorsSetIndex);
115  } else if ((*constIt) == "PRESCALE_FACTORS_ALGO_FK") {
116  resultsView.fillVariableFromRow(*constIt, iRow,
117  objectKeyPrescaleFactorsSet);
118  } else {
119 
120  LogTrace("L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
121  << "\nUnknown field " << (*constIt)
122  << " requested for columns in GT_RUN_SETTINGS_PRESC_VIEW"
123  << std::endl;
124 
125  }
126  }
127 
128  if (m_isDebugEnabled) {
129  LogTrace("L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
130  << "\nFound prescale factors set: \n index = "
131  << prescaleFactorsSetIndex
132  << "\n PRESCALE_FACTORS_ALGO_FK = "
133  << objectKeyPrescaleFactorsSet << "\n" << std::endl;
134  }
135 
136  // retrive now the prescale factors for PRESCALE_FACTORS_ALGO_FK
137 
138 
139  // SQL query:
140  //
141  // select * from CMS_GT.GT_FDL_PRESCALE_FACTORS_ALGO
142  // WHERE GT_FDL_PRESCALE_FACTORS_ALGO.ID = objectKeyPrescaleFactorsSet
143  const std::vector<std::string>& columns = m_omdsReader.columnNames(
144  gtSchema, "GT_FDL_PRESCALE_FACTORS_ALGO");
145 
146  if (m_isDebugEnabled) {
147  LogTrace("L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
148  << "\nColumn names for GT_FDL_PRESCALE_FACTORS_ALGO"
149  << std::endl;
150 
151  for (std::vector<std::string>::const_iterator iter =
152  columns.begin(); iter != columns.end(); iter++) {
153  LogTrace("L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
154  << (*iter) << std::endl;
155 
156  }
157  }
158 
160  columns, gtSchema, "GT_FDL_PRESCALE_FACTORS_ALGO",
161  "GT_FDL_PRESCALE_FACTORS_ALGO.ID",
162  m_omdsReader.singleAttribute(objectKeyPrescaleFactorsSet));
163 
164  // check if query was successful
165  if (results.queryFailed()) {
166  edm::LogError("L1-O2O")
167  << "Problem with L1GtPrescaleFactorsAlgoTrigRcd key:"
168  << objectKeyPrescaleFactorsSet;
169  return pL1GtPrescaleFactors;
170  }
171 
172 
173 
174 
175  // check if set indices are ordered, starting from 0 (initial value for countSet is -1)
176  countSet++;
177  if (prescaleFactorsSetIndex != countSet) {
178  edm::LogError("L1-O2O")
179  << "L1GtPrescaleFactorsAlgoTrig has unordered sets PRESCALE_INDEX in DB for\n"
180  << " GT_RUN_SETTINGS_PRESC_VIEW.ID = " << objectKey << "\n"
181  << std::endl;
182  return pL1GtPrescaleFactors;
183 
184  }
185 
186 
187  // fill one set of prescale factors
188  int pfSetSize = columns.size() - 1; // table ID is also in columns
189  std::vector<int> pfSet(pfSetSize, 0);
190 
191  for (int i = 0; i < pfSetSize; i++) {
192  results.fillVariable(columns[i + 1], pfSet[i]);
193  }
194 
195  pFactors.push_back(pfSet);
196 
197  }
198 
199  // fill the record
200 
201  pL1GtPrescaleFactors->setGtPrescaleFactors(pFactors);
202 
203  if (m_isDebugEnabled) {
204  std::ostringstream myCoutStream;
205  pL1GtPrescaleFactors->print(myCoutStream);
206  LogTrace("L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
207  << "\nThe following L1GtPrescaleFactorsAlgoTrigRcd record was read from OMDS: \n"
208  << myCoutStream.str() << "\n" << std::endl;
209  }
210 
211  return pL1GtPrescaleFactors;
212 }
bool isDebugEnabled()
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
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:319
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 LogTrace(id)
std::vector< std::string > columnNames(const std::string &schemaName, const std::string &tableName) const
Definition: OMDSReader.cc:165
const QueryResults basicQueryView(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &viewName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="") const
Definition: OMDSReader.cc:191

Member Data Documentation

bool L1GtPrescaleFactorsAlgoTrigConfigOnlineProd::m_isDebugEnabled
private

Definition at line 51 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.h.

Referenced by newObject().