CMS 3D CMS Logo

ScaleRecordHelper.cc
Go to the documentation of this file.
2 #include <sstream>
3 
4 using namespace std;
5 
6 
7 ScaleRecordHelper::ScaleRecordHelper(const std::string& binPrefix, unsigned int maxBin) {
8  binPrefix_ = binPrefix;
9  maxBin_ = maxBin;
10 }
11 
13  const coral::AttributeList& row = record.attributeLists()[0];
14  /* The <= in the next line is of crucial importance, since putting the intuitive <
15  there will lead to a world of pain (because the scale then has a max entry of 0,
16  and very bad things happen). See RFC968.
17  */
18  for(unsigned int i=0;i<=maxBin_;++i) {
19  /* We actually would like double values, but CORAL thinks that the DB contains
20  float, so we have to eat that.
21  Also: This assumes that there are no other columns than the ones we added,
22  maybe this should be made more explicit by handling the whole query in here? */
23  destScales.push_back(row[i].data<float>());
24  }
25 }
26 
27 
29  for(unsigned int i = 0; i <= maxBin_ ; ++i) {
30  columns.push_back(columnName(i));
31  }
32 }
33 
34 const string ScaleRecordHelper::columnName(unsigned int bin) {
35  ostringstream name;
36  name << binPrefix_ << '_' << bin ;
37  return name.str();
38 }
JetCorrectorParameters::Record record
Definition: classes.h:7
ScaleRecordHelper(const std::string &binPrefix, unsigned int maxBin)
const std::vector< coral::AttributeList > & attributeLists() const
Definition: OMDSReader.h:64
const std::string columnName(unsigned int bin)
bin
set the eta bin as selection string.
void pushColumnNames(std::vector< std::string > &columns)
void extractScales(l1t::OMDSReader::QueryResults &record, std::vector< double > &destScales)