#include <L1GtPrescaleFactorsTechTrigConfigOnlineProd.h>
Public Member Functions | |
L1GtPrescaleFactorsTechTrigConfigOnlineProd (const edm::ParameterSet &) | |
constructor | |
virtual boost::shared_ptr < L1GtPrescaleFactors > | newObject (const std::string &objectKey) |
public methods | |
~L1GtPrescaleFactorsTechTrigConfigOnlineProd () | |
destructor | |
Private Attributes | |
bool | m_isDebugEnabled |
Description: online producer for L1GtPrescaleFactorsTechTrigRcd.
Implementation: <TODO: enter implementation details>
$Date$ $Revision$
Definition at line 34 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.h.
L1GtPrescaleFactorsTechTrigConfigOnlineProd::L1GtPrescaleFactorsTechTrigConfigOnlineProd | ( | const edm::ParameterSet & | parSet | ) |
constructor
Definition at line 29 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc.
: L1ConfigOnlineProdBase<L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors> (parSet), m_isDebugEnabled(edm::isDebugEnabled()) { // empty }
L1GtPrescaleFactorsTechTrigConfigOnlineProd::~L1GtPrescaleFactorsTechTrigConfigOnlineProd | ( | ) |
destructor
Definition at line 39 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc.
{
// empty
}
boost::shared_ptr< L1GtPrescaleFactors > L1GtPrescaleFactorsTechTrigConfigOnlineProd::newObject | ( | const std::string & | objectKey | ) | [virtual] |
public methods
Implements L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >.
Definition at line 47 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.cc.
References l1t::OMDSReader::basicQuery(), l1t::OMDSReader::basicQueryView(), l1t::OMDSReader::columnNames(), l1t::OMDSReader::QueryResults::fillVariable(), l1t::OMDSReader::QueryResults::fillVariableFromRow(), i, edm::isDebugEnabled(), LogTrace, m_isDebugEnabled, L1ConfigOnlineProdBase< L1GtPrescaleFactorsTechTrigRcd, L1GtPrescaleFactors >::m_omdsReader, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), python::entryComment::results, and l1t::OMDSReader::singleAttribute().
{ // FIXME seems to not work anymore in constructor... m_isDebugEnabled = edm::isDebugEnabled(); // shared pointer for L1GtPrescaleFactors boost::shared_ptr<L1GtPrescaleFactors> pL1GtPrescaleFactors = boost::shared_ptr<L1GtPrescaleFactors>(new L1GtPrescaleFactors()); // Procedure: // objectKey received as input is GT_RUN_SETTINGS_FK // // get from GT_RUN_SETTINGS_PRESC_VIEW the PRESCALE_FACTORS_TT_FK and the index PRESCALE_INDEX // for the GT_RUN_SETTINGS_FK // // get the prescale factors for key PRESCALE_FACTORS_TT_FK // from GT_FDL_PRESCALE_FACTORS_TT table const std::string gtSchema = "CMS_GT"; // select * from CMS_GT.GT_RUN_SETTINGS_PRESC_VIEW // where GT_RUN_SETTINGS_PRESC_VIEW.ID = objectKey std::vector<std::string> columnsView; columnsView.push_back("PRESCALE_INDEX"); columnsView.push_back("PRESCALE_FACTORS_TT_FK"); l1t::OMDSReader::QueryResults resultsView = m_omdsReader.basicQueryView( columnsView, gtSchema, "GT_RUN_SETTINGS_PRESC_VIEW", "GT_RUN_SETTINGS_PRESC_VIEW.ID", m_omdsReader.singleAttribute( objectKey)); // check if query was successful if (resultsView.queryFailed()) { edm::LogError("L1-O2O") << "Problem to get content of GT_RUN_SETTINGS_PRESC_VIEW " << "for GT_RUN_SETTINGS_PRESC_VIEW.ID: " << objectKey; return pL1GtPrescaleFactors; } // retrieve PRESCALE_INDEX and PRESCALE_FACTORS_TT_FK for GT_RUN_SETTINGS_FK std::string objectKeyPrescaleFactorsSet = "WRONG_KEY_INITIAL"; short prescaleFactorsSetIndex = 9999; int resultsViewRows = resultsView.numberRows(); if (m_isDebugEnabled) { LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd") << "\nFound " << resultsViewRows << " prescale factors sets for \n " << "GT_RUN_SETTINGS_PRESC_VIEW.ID = " << objectKey << "\n" << std::endl; } // vector to be filled (resultsViewRows prescale factors sets) std::vector<std::vector<int> > pFactors; pFactors.reserve(resultsViewRows); int countSet = -1; for (int iRow = 0; iRow < resultsViewRows; ++iRow) { for (std::vector<std::string>::const_iterator constIt = columnsView.begin(); constIt != columnsView.end(); ++constIt) { if ((*constIt) == "PRESCALE_INDEX") { resultsView.fillVariableFromRow(*constIt, iRow, prescaleFactorsSetIndex); } else if ((*constIt) == "PRESCALE_FACTORS_TT_FK") { resultsView.fillVariableFromRow(*constIt, iRow, objectKeyPrescaleFactorsSet); } else { LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd") << "\nUnknown field " << (*constIt) << " requested for columns in GT_RUN_SETTINGS_PRESC_VIEW" << std::endl; } } if (m_isDebugEnabled) { LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd") << "\nFound prescale factors set: \n index = " << prescaleFactorsSetIndex << "\n PRESCALE_FACTORS_TT_FK = " << objectKeyPrescaleFactorsSet << "\n" << std::endl; } // retrive now the prescale factors for PRESCALE_FACTORS_TT_FK // SQL query: // // select * from CMS_GT.GT_FDL_PRESCALE_FACTORS_TT // WHERE GT_FDL_PRESCALE_FACTORS_TT.ID = objectKeyPrescaleFactorsSet const std::vector<std::string>& columns = m_omdsReader.columnNames( gtSchema, "GT_FDL_PRESCALE_FACTORS_TT"); if (m_isDebugEnabled) { LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd") << "\nColumn names for GT_FDL_PRESCALE_FACTORS_TT" << std::endl; for (std::vector<std::string>::const_iterator iter = columns.begin(); iter != columns.end(); iter++) { LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd") << (*iter) << std::endl; } } l1t::OMDSReader::QueryResults results = m_omdsReader.basicQuery( columns, gtSchema, "GT_FDL_PRESCALE_FACTORS_TT", "GT_FDL_PRESCALE_FACTORS_TT.ID", m_omdsReader.singleAttribute(objectKeyPrescaleFactorsSet)); // check if query was successful if (results.queryFailed()) { edm::LogError("L1-O2O") << "Problem with L1GtPrescaleFactorsTechTrigRcd key:" << objectKeyPrescaleFactorsSet; return pL1GtPrescaleFactors; } // check if set indices are ordered, starting from 0 (initial value for countSet is -1) countSet++; if (prescaleFactorsSetIndex != countSet) { edm::LogError("L1-O2O") << "L1GtPrescaleFactorsTechTrig has unordered sets PRESCALE_INDEX in DB for\n" << " GT_RUN_SETTINGS_PRESC_VIEW.ID = " << objectKey << "\n" << std::endl; return pL1GtPrescaleFactors; } // fill one set of prescale factors int pfSetSize = columns.size() - 1; // table ID is also in columns std::vector<int> pfSet(pfSetSize, 0); for (int i = 0; i < pfSetSize; i++) { results.fillVariable(columns[i + 1], pfSet[i]); } pFactors.push_back(pfSet); } // fill the record pL1GtPrescaleFactors->setGtPrescaleFactors(pFactors); if (m_isDebugEnabled) { std::ostringstream myCoutStream; pL1GtPrescaleFactors->print(myCoutStream); LogTrace("L1GtPrescaleFactorsTechTrigConfigOnlineProd") << "\nThe following L1GtPrescaleFactorsTechTrigRcd record was read from OMDS: \n" << myCoutStream.str() << "\n" << std::endl; } return pL1GtPrescaleFactors; }
Definition at line 51 of file L1GtPrescaleFactorsTechTrigConfigOnlineProd.h.
Referenced by newObject().