CMS 3D CMS Logo

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< L1GtPrescaleFactorsnewObject (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< L1GtPrescaleFactorsproduce (const L1GtPrescaleFactorsTechTrigRcd &iRecord)
 
 ~L1ConfigOnlineProdBase () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename Record >
void updateFromMayConsumes (unsigned int iIndex, const Record &iRecord)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(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={})
 
- 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 34 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc.

34  {
35  // empty
36 }

Member Function Documentation

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

public methods

Implements L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >.

Definition at line 40 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.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< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >::m_omdsReader, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), bookConverter::results, l1t::OMDSReader::singleAttribute(), and AlCaHLTBitMon_QueryRunRegistry::string.

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_TT_FK and the index PRESCALE_INDEX
51  // for the GT_RUN_SETTINGS_FK
52  //
53  // get the prescale factors for key PRESCALE_FACTORS_TT_FK
54  // from GT_FDL_PRESCALE_FACTORS_TT 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_TT_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_TT_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("L1GtPrescaleFactorsTechTrigConfigOnlineProd")
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_TT_FK") {
103  resultsView.fillVariableFromRow(*constIt, iRow, objectKeyPrescaleFactorsSet);
104  } else {
105  LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd")
106  << "\nUnknown field " << (*constIt) << " requested for columns in GT_RUN_SETTINGS_PRESC_VIEW" << std::endl;
107  }
108  }
109 
110  if (m_isDebugEnabled) {
111  LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd")
112  << "\nFound prescale factors set: \n index = " << prescaleFactorsSetIndex
113  << "\n PRESCALE_FACTORS_TT_FK = " << objectKeyPrescaleFactorsSet << "\n"
114  << std::endl;
115  }
116 
117  // retrive now the prescale factors for PRESCALE_FACTORS_TT_FK
118 
119  // SQL query:
120  //
121  // select * from CMS_GT.GT_FDL_PRESCALE_FACTORS_TT
122  // WHERE GT_FDL_PRESCALE_FACTORS_TT.ID = objectKeyPrescaleFactorsSet
123  const std::vector<std::string>& columns = m_omdsReader.columnNames(gtSchema, "GT_FDL_PRESCALE_FACTORS_TT");
124 
125  if (m_isDebugEnabled) {
126  LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd")
127  << "\nColumn names for GT_FDL_PRESCALE_FACTORS_TT" << std::endl;
128 
129  for (std::vector<std::string>::const_iterator iter = columns.begin(); iter != columns.end(); iter++) {
130  LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd") << (*iter) << std::endl;
131  }
132  }
133 
135  m_omdsReader.basicQuery(columns,
136  gtSchema,
137  "GT_FDL_PRESCALE_FACTORS_TT",
138  "GT_FDL_PRESCALE_FACTORS_TT.ID",
139  m_omdsReader.singleAttribute(objectKeyPrescaleFactorsSet));
140 
141  // check if query was successful
142  if (results.queryFailed()) {
143  edm::LogError("L1-O2O") << "Problem with L1GtPrescaleFactorsTechTrigRcd 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") << "L1GtPrescaleFactorsTechTrig 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("L1GtPrescaleFactorsTechTrigConfigOnlineProd")
175  << "\nThe following L1GtPrescaleFactorsTechTrigRcd record was read from OMDS: \n"
176  << myCoutStream.str() << "\n"
177  << std::endl;
178  }
179 
180  return pL1GtPrescaleFactors;
181 }
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
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
#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:158

Member Data Documentation

bool L1GtPrescaleFactorsTechTrigConfigOnlineProd::m_isDebugEnabled
private

Definition at line 45 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.h.

Referenced by newObject().