21 #include "boost/lexical_cast.hpp"
45 auto pL1GtPrescaleFactors = std::make_unique<L1GtPrescaleFactors>();
61 std::vector<std::string> columnsView;
62 columnsView.push_back(
"PRESCALE_INDEX");
63 columnsView.push_back(
"PRESCALE_FACTORS_ALGO_FK");
67 "GT_RUN_SETTINGS_PRESC_VIEW",
68 "GT_RUN_SETTINGS_PRESC_VIEW.ID",
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;
80 std::string objectKeyPrescaleFactorsSet =
"WRONG_KEY_INITIAL";
81 short prescaleFactorsSetIndex = 9999;
83 int resultsViewRows = resultsView.
numberRows();
85 LogTrace(
"L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
86 <<
"\nFound " << resultsViewRows <<
" prescale factors sets for \n "
87 <<
"GT_RUN_SETTINGS_PRESC_VIEW.ID = " << objectKey <<
"\n"
92 std::vector<std::vector<int> > pFactors;
93 pFactors.reserve(resultsViewRows);
97 for (
int iRow = 0; iRow < resultsViewRows; ++iRow) {
98 for (std::vector<std::string>::const_iterator constIt = columnsView.begin(); constIt != columnsView.end();
100 if ((*constIt) ==
"PRESCALE_INDEX") {
102 }
else if ((*constIt) ==
"PRESCALE_FACTORS_ALGO_FK") {
105 LogTrace(
"L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
106 <<
"\nUnknown field " << (*constIt) <<
" requested for columns in GT_RUN_SETTINGS_PRESC_VIEW" << std::endl;
111 LogTrace(
"L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
112 <<
"\nFound prescale factors set: \n index = " << prescaleFactorsSetIndex
113 <<
"\n PRESCALE_FACTORS_ALGO_FK = " << objectKeyPrescaleFactorsSet <<
"\n"
126 LogTrace(
"L1GtPrescaleFactorsAlgoTrigConfigOnlineProd")
127 <<
"\nColumn names for GT_FDL_PRESCALE_FACTORS_ALGO" << std::endl;
129 for (std::vector<std::string>::const_iterator iter =
columns.begin(); iter !=
columns.end(); iter++) {
130 LogTrace(
"L1GtPrescaleFactorsAlgoTrigConfigOnlineProd") << (*iter) << std::endl;
137 "GT_FDL_PRESCALE_FACTORS_ALGO",
138 "GT_FDL_PRESCALE_FACTORS_ALGO.ID",
143 edm::LogError(
"L1-O2O") <<
"Problem with L1GtPrescaleFactorsAlgoTrigRcd key:" << objectKeyPrescaleFactorsSet;
144 return pL1GtPrescaleFactors;
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"
153 return pL1GtPrescaleFactors;
157 int pfSetSize =
columns.size() - 1;
158 std::vector<int> pfSet(pfSetSize, 0);
160 for (
int i = 0;
i < pfSetSize;
i++) {
164 pFactors.push_back(pfSet);
169 pL1GtPrescaleFactors->setGtPrescaleFactors(pFactors);
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"
180 return pL1GtPrescaleFactors;