23 #include "boost/lexical_cast.hpp"
48 const std::string& objectKey) {
54 boost::shared_ptr<L1GtPrescaleFactors> pL1GtPrescaleFactors =
66 const std::string gtSchema =
"CMS_GT";
71 std::vector<std::string> columnsView;
72 columnsView.push_back(
"PRESCALE_INDEX");
73 columnsView.push_back(
"PRESCALE_FACTORS_ALGO_FK");
76 columnsView, gtSchema,
"GT_RUN_SETTINGS_PRESC_VIEW",
83 <<
"Problem to get content of GT_RUN_SETTINGS_PRESC_VIEW "
84 <<
"for GT_RUN_SETTINGS_PRESC_VIEW.ID: " << objectKey;
85 return pL1GtPrescaleFactors;
90 std::string objectKeyPrescaleFactorsSet =
"WRONG_KEY_INITIAL";
91 short prescaleFactorsSetIndex = 9999;
93 int resultsViewRows = resultsView.
numberRows();
95 LogTrace(
"L1GtPrescaleFactorsAlgoTrigConfigOnlineProd") <<
"\nFound "
96 << resultsViewRows <<
" prescale factors sets for \n "
97 <<
"GT_RUN_SETTINGS_PRESC_VIEW.ID = " << objectKey <<
"\n"
102 std::vector<std::vector<int> > pFactors;
103 pFactors.reserve(resultsViewRows);
107 for (
int iRow = 0; iRow < resultsViewRows; ++iRow) {
109 for (std::vector<std::string>::const_iterator constIt =
110 columnsView.begin(); constIt != columnsView.end(); ++constIt) {
112 if ((*constIt) ==
"PRESCALE_INDEX") {
114 prescaleFactorsSetIndex);
115 }
else if ((*constIt) ==
"PRESCALE_FACTORS_ALGO_FK") {
117 objectKeyPrescaleFactorsSet);
120 LogTrace(
"L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
121 <<
"\nUnknown field " << (*constIt)
122 <<
" requested for columns in GT_RUN_SETTINGS_PRESC_VIEW"
129 LogTrace(
"L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
130 <<
"\nFound prescale factors set: \n index = "
131 << prescaleFactorsSetIndex
132 <<
"\n PRESCALE_FACTORS_ALGO_FK = "
133 << objectKeyPrescaleFactorsSet <<
"\n" << std::endl;
144 gtSchema,
"GT_FDL_PRESCALE_FACTORS_ALGO");
147 LogTrace(
"L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
148 <<
"\nColumn names for GT_FDL_PRESCALE_FACTORS_ALGO"
151 for (std::vector<std::string>::const_iterator iter =
152 columns.begin(); iter != columns.end(); iter++) {
153 LogTrace(
"L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
154 << (*iter) << std::endl;
160 columns, gtSchema,
"GT_FDL_PRESCALE_FACTORS_ALGO",
161 "GT_FDL_PRESCALE_FACTORS_ALGO.ID",
167 <<
"Problem with L1GtPrescaleFactorsAlgoTrigRcd key:"
168 << objectKeyPrescaleFactorsSet;
169 return pL1GtPrescaleFactors;
177 if (prescaleFactorsSetIndex != countSet) {
179 <<
"L1GtPrescaleFactorsAlgoTrig has unordered sets PRESCALE_INDEX in DB for\n"
180 <<
" GT_RUN_SETTINGS_PRESC_VIEW.ID = " << objectKey <<
"\n"
182 return pL1GtPrescaleFactors;
188 int pfSetSize = columns.size() - 1;
189 std::vector<int> pfSet(pfSetSize, 0);
191 for (
int i = 0;
i < pfSetSize;
i++) {
195 pFactors.push_back(pfSet);
201 pL1GtPrescaleFactors->setGtPrescaleFactors(pFactors);
204 std::ostringstream myCoutStream;
205 pL1GtPrescaleFactors->print(myCoutStream);
206 LogTrace(
"L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
207 <<
"\nThe following L1GtPrescaleFactorsAlgoTrigRcd record was read from OMDS: \n"
208 << myCoutStream.str() <<
"\n" << std::endl;
211 return pL1GtPrescaleFactors;
L1GtPrescaleFactorsAlgoTrigConfigOnlineProd(const edm::ParameterSet &)
constructor
bool fillVariable(const std::string &columnName, T &outputVariable) const
const QueryResults singleAttribute(const T &data) const
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
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="") const
virtual boost::shared_ptr< L1GtPrescaleFactors > newObject(const std::string &objectKey)
public methods
l1t::OMDSReader m_omdsReader
~L1GtPrescaleFactorsAlgoTrigConfigOnlineProd()
destructor
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
std::vector< std::string > columnNames(const std::string &schemaName, const std::string &tableName) const
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="") const