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 &)
 
virtual 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,
edm::propagate_const
< std::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::persistency::Session 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

Definition at line 32 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.h.

Constructor & Destructor Documentation

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

destructor

Definition at line 37 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.cc.

37  {
38 
39  // empty
40 
41 }

Member Function Documentation

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

public methods

Implements L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >.

Definition at line 45 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(), bookConverter::results, l1t::OMDSReader::singleAttribute(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Member Data Documentation

bool L1GtPrescaleFactorsAlgoTrigConfigOnlineProd::m_isDebugEnabled
private

Definition at line 49 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.h.

Referenced by newObject().