CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
ScaleRecordHelper Class Reference

#include <ScaleRecordHelper.h>

Public Member Functions

void extractScales (l1t::OMDSReader::QueryResults &record, std::vector< double > &destScales)
 
void pushColumnNames (std::vector< std::string > &columns)
 
 ScaleRecordHelper (const std::string &binPrefix, unsigned int maxBin)
 

Protected Member Functions

const std::string columnName (unsigned int bin)
 

Private Attributes

std::string binPrefix_
 
unsigned int maxBin_
 

Detailed Description

Definition at line 21 of file ScaleRecordHelper.h.

Constructor & Destructor Documentation

ScaleRecordHelper::ScaleRecordHelper ( const std::string &  binPrefix,
unsigned int  maxBin 
)

Definition at line 6 of file ScaleRecordHelper.cc.

6  {
7  binPrefix_ = binPrefix;
8  maxBin_ = maxBin;
9 }
std::string binPrefix_
unsigned int maxBin_

Member Function Documentation

const string ScaleRecordHelper::columnName ( unsigned int  bin)
protected

Definition at line 32 of file ScaleRecordHelper.cc.

References newFWLiteAna::bin, and Skims_PA_cff::name.

32  {
33  ostringstream name;
34  name << binPrefix_ << '_' << bin;
35  return name.str();
36 }
std::string binPrefix_
void ScaleRecordHelper::extractScales ( l1t::OMDSReader::QueryResults record,
std::vector< double > &  destScales 
)

Definition at line 11 of file ScaleRecordHelper.cc.

References l1t::OMDSReader::QueryResults::attributeLists(), and mps_fire::i.

Referenced by L1MuTriggerPtScaleOnlineProducer::newObject(), and L1MuTriggerScalesOnlineProducer::newObject().

11  {
12  const coral::AttributeList& row = record.attributeLists()[0];
13  /* The <= in the next line is of crucial importance, since putting the intuitive <
14  there will lead to a world of pain (because the scale then has a max entry of 0,
15  and very bad things happen). See RFC968.
16  */
17  for (unsigned int i = 0; i <= maxBin_; ++i) {
18  /* We actually would like double values, but CORAL thinks that the DB contains
19  float, so we have to eat that.
20  Also: This assumes that there are no other columns than the ones we added,
21  maybe this should be made more explicit by handling the whole query in here? */
22  destScales.push_back(row[i].data<float>());
23  }
24 }
const std::vector< coral::AttributeList > & attributeLists() const
Definition: OMDSReader.h:58
unsigned int maxBin_
void ScaleRecordHelper::pushColumnNames ( std::vector< std::string > &  columns)

Definition at line 26 of file ScaleRecordHelper.cc.

References mps_fire::i.

Referenced by L1MuTriggerPtScaleOnlineProducer::newObject(), and L1MuTriggerScalesOnlineProducer::newObject().

26  {
27  for (unsigned int i = 0; i <= maxBin_; ++i) {
28  columns.push_back(columnName(i));
29  }
30 }
const std::string columnName(unsigned int bin)
unsigned int maxBin_

Member Data Documentation

std::string ScaleRecordHelper::binPrefix_
private

Definition at line 33 of file ScaleRecordHelper.h.

unsigned int ScaleRecordHelper::maxBin_
private

Definition at line 34 of file ScaleRecordHelper.h.