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::ScaleRecordHelper ( const std::string &  binPrefix,
unsigned int  maxBin 
)

Definition at line 6 of file ScaleRecordHelper.cc.

6  {
7  binPrefix_ = binPrefix;
8  maxBin_ = maxBin;
9 }

References cms::cuda::allocator::maxBin.

Member Function Documentation

◆ columnName()

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

Definition at line 32 of file ScaleRecordHelper.cc.

32  {
33  ostringstream name;
34  name << binPrefix_ << '_' << bin;
35  return name.str();
36 }

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

◆ extractScales()

void ScaleRecordHelper::extractScales ( l1t::OMDSReader::QueryResults record,
std::vector< double > &  destScales 
)

Definition at line 11 of file ScaleRecordHelper.cc.

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 }

References mps_fire::i, and GlobalPosition_Frontier_DevDB_cff::record.

Referenced by L1MuTriggerScalesOnlineProducer::newObject().

◆ pushColumnNames()

void ScaleRecordHelper::pushColumnNames ( std::vector< std::string > &  columns)

Definition at line 26 of file ScaleRecordHelper.cc.

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

References mps_check::columns, and mps_fire::i.

Referenced by L1MuTriggerScalesOnlineProducer::newObject().

Member Data Documentation

◆ binPrefix_

std::string ScaleRecordHelper::binPrefix_
private

Definition at line 33 of file ScaleRecordHelper.h.

◆ maxBin_

unsigned int ScaleRecordHelper::maxBin_
private

Definition at line 34 of file ScaleRecordHelper.h.

mps_fire.i
i
Definition: mps_fire.py:355
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
ScaleRecordHelper::binPrefix_
std::string binPrefix_
Definition: ScaleRecordHelper.h:33
cms::cuda::allocator::maxBin
constexpr unsigned int maxBin
Definition: getCachingDeviceAllocator.h:20
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
ScaleRecordHelper::columnName
const std::string columnName(unsigned int bin)
Definition: ScaleRecordHelper.cc:32
mps_check.columns
columns
Definition: mps_check.py:244
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
ScaleRecordHelper::maxBin_
unsigned int maxBin_
Definition: ScaleRecordHelper.h:34