CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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

Definition at line 62 of file L1GtPatternLine.h.

Member Function Documentation

uint32_t L1GtPatternLine::get ( const std::string &  name) const
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.

References m_columns.

Referenced by nextName(), and L1GtPatternWriter::writePatternLine().

53 { return m_columns.find(colname) != m_columns.end(); }
ColumnMap m_columns
std::string L1GtPatternLine::name ( const std::string &  prefix,
unsigned int  i 
) const
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.

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

Referenced by push().

55  {
56  int i = 1;
58  do {
59  result = name(prefix, i++);
60  } while (has(result));
61 
62  return result;
63 }
tuple result
Definition: mps_fire.py:311
bool has(const std::string &colname) const
std::string name(const std::string &prefix, unsigned int i) const
void L1GtPatternLine::print ( std::ostream &  out) const

Debug dump of contents

Definition at line 45 of file L1GtPatternLine.cc.

References m_columns.

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 }
ColumnMap m_columns
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.

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

Referenced by L1GtPatternGenerator::extractGlobalTriggerData(), extractGlobalTriggerWord(), and extractRecordData().

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 }
std::string nextName(const std::string &prefix)
ColumnMap m_columns
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.

References Exception, m_columns, and relativeConstraints::value.

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 }
std::string name(const std::string &prefix, unsigned int i) const
ColumnMap m_columns

Member Data Documentation

ColumnMap L1GtPatternLine::m_columns
private

Definition at line 63 of file L1GtPatternLine.h.

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