CMS 3D CMS Logo

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...
 
std::unique_ptr< L1GtPrescaleFactorsnewObject (const std::string &objectKey) override
 public methods More...
 
 ~L1GtPrescaleFactorsAlgoTrigConfigOnlineProd () override
 destructor More...
 
- Public Member Functions inherited from L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >
 L1ConfigOnlineProdBase (const edm::ParameterSet &)
 
virtual std::unique_ptr< L1GtPrescaleFactorsproduce (const L1GtPrescaleFactorsAlgoTrigRcd &iRecord)
 
 ~L1ConfigOnlineProdBase () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- 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 () noexcept(false)
 

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< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- 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, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 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 ( )
override

destructor

Definition at line 37 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.cc.

37  {
38 
39  // empty
40 
41 }

Member Function Documentation

std::unique_ptr< L1GtPrescaleFactors > L1GtPrescaleFactorsAlgoTrigConfigOnlineProd::newObject ( const std::string &  objectKey)
overridevirtual

public methods

Implements L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >.

Definition at line 45 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.cc.

References l1t::OMDSReader::basicQuery(), l1t::OMDSReader::basicQueryView(), l1t::OMDSReader::columnNames(), mps_check::columns, DEFINE_FWK_EVENTSETUP_MODULE, l1t::OMDSReader::QueryResults::fillVariable(), l1t::OMDSReader::QueryResults::fillVariableFromRow(), mps_fire::i, edm::isDebugEnabled(), LogTrace, m_isDebugEnabled, L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >::m_omdsReader, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), mps_update::results, l1t::OMDSReader::singleAttribute(), and AlCaHLTBitMon_QueryRunRegistry::string.

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