CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
L1GtPatternLine Class Reference

#include <L1GtPatternLine.h>

Public Member Functions

uint32_t get (const std::string &name) const
 
bool has (const std::string &colname) const
 
std::string name (const std::string &prefix, unsigned int i) const
 
std::string nextName (const std::string &prefix)
 
void print (std::ostream &out) const
 
void push (const std::string &prefix, uint32_t value)
 
void set (const std::string &name, uint32_t value)
 

Private Types

typedef std::map< std::string, uint32_t > ColumnMap
 

Private Attributes

ColumnMap m_columns
 

Detailed Description

A class representing the contents of one line in a pattern file. The contents are represented as (name, value) pairs. Column ids are also enumerated so that multiple columns with identical names end up with consecutive names ("muon" becomes "muon1", "muon2" etc).

Description: A representation of a of pattern file line for L1 GT hardware testing.

Implementation: <TODO: enter implementation details>

Author
: Thomas Themel - HEPHY Vienna

Description: see header file.

Implementation: <TODO: enter implementation details>

Author
: Thomas Themel - HEPHY Vienna

Definition at line 28 of file L1GtPatternLine.h.

Member Typedef Documentation

◆ ColumnMap

typedef std::map<std::string, uint32_t> L1GtPatternLine::ColumnMap
private

Definition at line 62 of file L1GtPatternLine.h.

Member Function Documentation

◆ get()

uint32_t L1GtPatternLine::get ( const std::string &  name) const

◆ has()

bool L1GtPatternLine::has ( const std::string &  colname) const

Returns true iff a column of the given name exists.

Parameters
colnameColumn name to look for. Beware: This has to include the number appended by push!

Definition at line 53 of file L1GtPatternLine.cc.

53 { return m_columns.find(colname) != m_columns.end(); }

References m_columns.

Referenced by nextName().

◆ name()

std::string L1GtPatternLine::name ( const std::string &  prefix,
unsigned int  i 
) const

Forms a column name from a prefix and a number.

Definition at line 65 of file L1GtPatternLine.cc.

65  {
66  std::ostringstream ss;
67  ss << prefix << i;
68  return ss.str();
69 }

References mps_fire::i, hcallasereventfilter2012_cfi::prefix, and contentValuesCheck::ss.

Referenced by config.CFG::__str__(), validation.Sample::digest(), get(), VIDSelectorBase.VIDSelectorBase::initialize(), nextName(), and set().

◆ nextName()

std::string L1GtPatternLine::nextName ( const std::string &  prefix)

Returns the next free column name for a given prefix.

Definition at line 55 of file L1GtPatternLine.cc.

55  {
56  int i = 1;
58  do {
59  result = name(prefix, i++);
60  } while (has(result));
61 
62  return result;
63 }

References has(), mps_fire::i, name(), hcallasereventfilter2012_cfi::prefix, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by push().

◆ print()

void L1GtPatternLine::print ( std::ostream &  out) const

Debug dump of contents

Definition at line 45 of file L1GtPatternLine.cc.

45  {
46  out << "BEGIN Columns: " << std::endl;
47  for (L1GtPatternLine::ColumnMap::const_iterator it = m_columns.begin(); it != m_columns.end(); ++it) {
48  out << it->first << ": " << std::hex << it->second << std::endl;
49  }
50  out << "END Columns." << std::endl;
51 }

References m_columns, and MillePedeFileConverter_cfg::out.

◆ push()

void L1GtPatternLine::push ( const std::string &  prefix,
uint32_t  value 
)

Add a new column with the specified name prefix and value.

Parameters
prefixThe name prefix of the new column. The final column name consists of prefix + the lowest free number (starting at 1)
valueThe actual data content of the column.

Definition at line 25 of file L1GtPatternLine.cc.

25  {
26  std::string colName = nextName(prefix);
27  // add three values for each column - the full 32bit value,
28  // one for the lower 16 bits and one for the higher 16 bits.
29  m_columns[colName] = value;
30  m_columns[colName + "_h"] = value >> 16;
31  m_columns[colName + "_l"] = value & 0xFFFF;
32 }

References m_columns, nextName(), hcallasereventfilter2012_cfi::prefix, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

◆ set()

void L1GtPatternLine::set ( const std::string &  name,
uint32_t  value 
)

Manipulate an existing value.

Parameters
namethe name (prefix + no) of the column to set. Do not use _h or _l values here!
valuethe new value for the column.

Definition at line 34 of file L1GtPatternLine.cc.

34  {
35  ColumnMap::iterator it = m_columns.find(name);
36  if (it == m_columns.end()) {
37  throw cms::Exception(__func__) << "Can't set field " << name << " to " << std::hex << value << ": not found";
38  }
39 
40  it->second = value;
41  m_columns[name + "_h"] = value >> 16;
42  m_columns[name + "_l"] = value & 0xFFFF;
43 }

References Exception, m_columns, name(), and relativeConstraints::value.

Member Data Documentation

◆ m_columns

ColumnMap L1GtPatternLine::m_columns
private

Definition at line 63 of file L1GtPatternLine.h.

Referenced by get(), has(), print(), push(), and set().

mps_fire.i
i
Definition: mps_fire.py:428
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
L1GtPatternLine::has
bool has(const std::string &colname) const
Definition: L1GtPatternLine.cc:53
L1GtPatternLine::nextName
std::string nextName(const std::string &prefix)
Definition: L1GtPatternLine.cc:55
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1GtPatternLine::m_columns
ColumnMap m_columns
Definition: L1GtPatternLine.h:63
L1GtPatternLine::name
std::string name(const std::string &prefix, unsigned int i) const
Definition: L1GtPatternLine.cc:65
value
Definition: value.py:1
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:245
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
mps_fire.result
result
Definition: mps_fire.py:311
hcallasereventfilter2012_cfi.prefix
prefix
Definition: hcallasereventfilter2012_cfi.py:10