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