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 ()
 
 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< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >
bool getObjectKey (const L1GtPrescaleFactorsAlgoTrigRcd &record, std::string &objectKey)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &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< 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::L1GtPrescaleFactorsAlgoTrigConfigOnlineProd ( const edm::ParameterSet parSet)

◆ ~L1GtPrescaleFactorsAlgoTrigConfigOnlineProd()

L1GtPrescaleFactorsAlgoTrigConfigOnlineProd::~L1GtPrescaleFactorsAlgoTrigConfigOnlineProd ( )
override

destructor

Definition at line 34 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.cc.

34  {
35  // empty
36 }

Member Function Documentation

◆ newObject()

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

public methods

Implements L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >.

Definition at line 40 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.cc.

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

References l1t::OMDSReader::basicQuery(), l1t::OMDSReader::basicQueryView(), l1t::OMDSReader::columnNames(), mps_check::columns, 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(), bookConverter::results, l1t::OMDSReader::singleAttribute(), and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ m_isDebugEnabled

bool L1GtPrescaleFactorsAlgoTrigConfigOnlineProd::m_isDebugEnabled
private

Definition at line 45 of file L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.h.

Referenced by newObject().

l1t::OMDSReader::QueryResults
Definition: OMDSReader.h:49
mps_fire.i
i
Definition: mps_fire.py:428
L1GtPrescaleFactorsAlgoTrigConfigOnlineProd::m_isDebugEnabled
bool m_isDebugEnabled
Definition: L1GtPrescaleFactorsAlgoTrigConfigOnlineProd.h:45
L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >::m_omdsReader
l1t::OMDSReader m_omdsReader
Definition: L1ConfigOnlineProdBase.h:65
bookConverter.results
results
Definition: bookConverter.py:144
l1t::OMDSReader::singleAttribute
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
L1ConfigOnlineProdBase< L1GtPrescaleFactorsAlgoTrigRcd, L1GtPrescaleFactors >
l1t::OMDSReader::QueryResults::fillVariableFromRow
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:279
l1t::OMDSReader::columnNames
std::vector< std::string > columnNames(const std::string &schemaName, const std::string &tableName)
Definition: OMDSReader.cc:138
l1t::OMDSReader::QueryResults::numberRows
int numberRows() const
Definition: OMDSReader.h:60
l1t::OMDSReader::basicQuery
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
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
mps_check.columns
columns
Definition: mps_check.py:244
l1t::OMDSReader::QueryResults::queryFailed
bool queryFailed() const
Definition: OMDSReader.h:59
edm::isDebugEnabled
bool isDebugEnabled()
Definition: MessageLogger.cc:12
l1t::OMDSReader::basicQueryView
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
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234