CMS 3D CMS Logo

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

#include <L1GtPrescaleFactorsTechTrigConfigOnlineProd.h>

Inheritance diagram for L1GtPrescaleFactorsTechTrigConfigOnlineProd:
L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors > edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 L1GtPrescaleFactorsTechTrigConfigOnlineProd (const edm::ParameterSet &)
 constructor More...
 
std::unique_ptr
< L1GtPrescaleFactors
newObject (const std::string &objectKey) override
 public methods More...
 
 ~L1GtPrescaleFactorsTechTrigConfigOnlineProd () override
 destructor More...
 
- Public Member Functions inherited from L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >
 L1ConfigOnlineProdBase (const edm::ParameterSet &)
 
virtual std::unique_ptr
< L1GtPrescaleFactors
produce (const L1GtPrescaleFactorsTechTrigRcd &iRecord)
 
 ~L1ConfigOnlineProdBase () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector
< ESProxyIndex > > 
updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
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

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy >>>
 
- Protected Member Functions inherited from L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >
bool getObjectKey (const L1GtPrescaleFactorsTechTrigRcd &record, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
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={})
 
void usesResources (std::vector< std::string > const &)
 
- 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 EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Attributes inherited from L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >
bool m_copyFromCondDB
 
cond::persistency::Session m_dbSession
 
bool m_forceGeneration
 
l1t::OMDSReader m_omdsReader
 

Detailed Description

Description: online producer for L1GtPrescaleFactorsTechTrigRcd.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna

Definition at line 32 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.h.

Constructor & Destructor Documentation

L1GtPrescaleFactorsTechTrigConfigOnlineProd::L1GtPrescaleFactorsTechTrigConfigOnlineProd ( const edm::ParameterSet parSet)
L1GtPrescaleFactorsTechTrigConfigOnlineProd::~L1GtPrescaleFactorsTechTrigConfigOnlineProd ( )
override

destructor

Definition at line 32 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc.

32  {
33  // empty
34 }

Member Function Documentation

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

public methods

Implements L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >.

Definition at line 38 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc.

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

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

Member Data Documentation

bool L1GtPrescaleFactorsTechTrigConfigOnlineProd::m_isDebugEnabled
private

Definition at line 45 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.h.

Referenced by newObject().