File indexing completed on 2024-04-06 12:22:23
0001 #include "L1TriggerConfig/L1ScalesProducers/interface/ScaleRecordHelper.h"
0002 #include <sstream>
0003
0004 using namespace std;
0005
0006 ScaleRecordHelper::ScaleRecordHelper(const std::string& binPrefix, unsigned int maxBin) {
0007 binPrefix_ = binPrefix;
0008 maxBin_ = maxBin;
0009 }
0010
0011 void ScaleRecordHelper::extractScales(l1t::OMDSReader::QueryResults& record, vector<double>& destScales) {
0012 const coral::AttributeList& row = record.attributeLists()[0];
0013
0014
0015
0016
0017 for (unsigned int i = 0; i <= maxBin_; ++i) {
0018
0019
0020
0021
0022 destScales.push_back(row[i].data<float>());
0023 }
0024 }
0025
0026 void ScaleRecordHelper::pushColumnNames(vector<string>& columns) {
0027 for (unsigned int i = 0; i <= maxBin_; ++i) {
0028 columns.push_back(columnName(i));
0029 }
0030 }
0031
0032 const string ScaleRecordHelper::columnName(unsigned int bin) {
0033 ostringstream name;
0034 name << binPrefix_ << '_' << bin;
0035 return name.str();
0036 }