CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes | Friends
L1GctLut< NAddressBits, NDataBits > Class Template Referenceabstract

Base class for LookUp Tables. More...

#include <L1GctLut.h>

Public Member Functions

uint16_t lutValue (const uint16_t lutAddress) const
 Access the look-up table contents for a given Address. More...
 
template<int KAddressBits, int KDataBits>
int operator!= (const L1GctLut< KAddressBits, KDataBits > &rhsLut) const
 Inequality check between look-up tables. More...
 
template<int KAddressBits, int KDataBits>
int operator== (const L1GctLut< KAddressBits, KDataBits > &rhsLut) const
 Equality check between look-up tables. More...
 
uint16_t operator[] (const uint16_t lutAddress) const
 Access the look-up table contents for a given Address. More...
 
void setTerse ()
 
bool setupOk ()
 
void setVerbose ()
 control output messages More...
 
virtual ~L1GctLut ()
 

Static Public Attributes

static const uint16_t MAX_ADDRESS_BITMASK = (1 << NAddressBits) - 1
 
static const uint16_t MAX_DATA_BITMASK = (1 << NDataBits) - 1
 

Protected Member Functions

template<int KAddressBits, int KDataBits>
bool equalityCheck (const L1GctLut< KAddressBits, KDataBits > &c) const
 
 L1GctLut ()
 
virtual uint16_t value (const uint16_t lutAddress) const =0
 

Protected Attributes

bool m_setupOk
 
bool m_verbose
 

Private Member Functions

std::string printHeader () const
 
std::string printLine (const int add) const
 

Static Private Attributes

static const int printWidth = 16
 

Friends

std::ostream & operator<< (std::ostream &os, const L1GctLut< NAddressBits, NDataBits > &lut)
 Overload << operator. More...
 

Detailed Description

template<int NAddressBits, int NDataBits>
class L1GctLut< NAddressBits, NDataBits >

Base class for LookUp Tables.

Author
Greg Heath
Date
Feb 2007

Definition at line 21 of file L1GctLut.h.

Constructor & Destructor Documentation

template<int NAddressBits, int NDataBits>
L1GctLut< NAddressBits, NDataBits >::~L1GctLut ( )
virtual

Definition at line 102 of file L1GctLut.h.

102 {}
template<int NAddressBits, int NDataBits>
L1GctLut< NAddressBits, NDataBits >::L1GctLut ( )
protected

Definition at line 99 of file L1GctLut.h.

99 : m_setupOk(false) {}
bool m_setupOk
Definition: L1GctLut.h:78

Member Function Documentation

template<int NAddressBits, int NDataBits>
template<int KAddressBits, int KDataBits>
bool L1GctLut< NAddressBits, NDataBits >::equalityCheck ( const L1GctLut< KAddressBits, KDataBits > &  c) const
protected

Definition at line 115 of file L1GctLut.h.

References L1GctLut< NAddressBits, NDataBits >::lutValue(), and match().

Referenced by L1GctLut< 16, 12 >::operator!=(), and L1GctLut< 16, 12 >::operator==().

116 {
117  if (KAddressBits==NAddressBits && KDataBits==NDataBits) {
118  bool match=true;
119  for (uint16_t address=0; address<=MAX_ADDRESS_BITMASK; address++) {
120  if (this->lutValue(address)!=rhsLut.lutValue(address)) { match = false; break; }
121  }
122  return match;
123  } else {
124  return false;
125  }
126 }
char * address
Definition: mlp_lapack.h:14
static const uint16_t MAX_ADDRESS_BITMASK
Definition: L1GctLut.h:24
uint16_t lutValue(const uint16_t lutAddress) const
Access the look-up table contents for a given Address.
Definition: L1GctLut.h:105
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
template<int NAddressBits, int NDataBits>
uint16_t L1GctLut< NAddressBits, NDataBits >::lutValue ( const uint16_t  lutAddress) const

Access the look-up table contents for a given Address.

Definition at line 105 of file L1GctLut.h.

References data, and relativeConstraints::value.

Referenced by L1GctLut< NAddressBits, NDataBits >::equalityCheck(), L1GctLut< 16, 12 >::operator[](), and L1GctMet::useHtMissLutAlgo().

106 {
107  if (!m_setupOk) return (uint16_t) 0;
108  uint16_t address=(lutAddress & MAX_ADDRESS_BITMASK);
109  uint16_t data=(value(address) & MAX_DATA_BITMASK);
110  return data;
111 }
char * address
Definition: mlp_lapack.h:14
virtual uint16_t value(const uint16_t lutAddress) const =0
static const uint16_t MAX_ADDRESS_BITMASK
Definition: L1GctLut.h:24
static const uint16_t MAX_DATA_BITMASK
Definition: L1GctLut.h:25
bool m_setupOk
Definition: L1GctLut.h:78
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
template<int NAddressBits, int NDataBits>
template<int KAddressBits, int KDataBits>
int L1GctLut< NAddressBits, NDataBits >::operator!= ( const L1GctLut< KAddressBits, KDataBits > &  rhsLut) const
inline

Inequality check between look-up tables.

Definition at line 61 of file L1GctLut.h.

61 { return !equalityCheck(rhsLut); }
bool equalityCheck(const L1GctLut< KAddressBits, KDataBits > &c) const
Definition: L1GctLut.h:115
template<int NAddressBits, int NDataBits>
template<int KAddressBits, int KDataBits>
int L1GctLut< NAddressBits, NDataBits >::operator== ( const L1GctLut< KAddressBits, KDataBits > &  rhsLut) const
inline

Equality check between look-up tables.

Definition at line 57 of file L1GctLut.h.

57 { return equalityCheck(rhsLut); }
bool equalityCheck(const L1GctLut< KAddressBits, KDataBits > &c) const
Definition: L1GctLut.h:115
template<int NAddressBits, int NDataBits>
uint16_t L1GctLut< NAddressBits, NDataBits >::operator[] ( const uint16_t  lutAddress) const
inline

Access the look-up table contents for a given Address.

Definition at line 53 of file L1GctLut.h.

53 { return lutValue(lutAddress); }
uint16_t lutValue(const uint16_t lutAddress) const
Access the look-up table contents for a given Address.
Definition: L1GctLut.h:105
template<int NAddressBits, int NDataBits>
std::string L1GctLut< NAddressBits, NDataBits >::printHeader ( ) const
private

Definition at line 129 of file L1GctLut.h.

References a.

130 {
131  std::stringstream ss;
132  ss << std::hex << std::showbase;
133  ss << std::setw(8) << "|";
134  for (int a=0; ((a<printWidth) && (a<=MAX_ADDRESS_BITMASK)); ++a) {
135  ss << std::setw(7) << a;
136  }
137  ss << std::endl;
138  ss << std::setfill('-') << std::setw(8) << "+";
139  for (int a=0; ((a<printWidth) && (a<=MAX_ADDRESS_BITMASK)); ++a) {
140  ss << std::setw(7) << "-";
141  }
142  ss << std::endl;
143 
144  return ss.str();
145 }
static const uint16_t MAX_ADDRESS_BITMASK
Definition: L1GctLut.h:24
static const int printWidth
Definition: L1GctLut.h:84
double a
Definition: hdecay.h:121
template<int NAddressBits, int NDataBits>
std::string L1GctLut< NAddressBits, NDataBits >::printLine ( const int  add) const
private

Definition at line 148 of file L1GctLut.h.

References a, Clusterizer1DCommons::add(), and trackerHits::c.

149 {
150  std::stringstream ss;
151  ss << std::hex << std::showbase;
152  int a=add;
153  ss << std::setw(7) << a << "|";
154  for (int c=0; ((c<printWidth) && (a<=MAX_ADDRESS_BITMASK)); ++c) {
155  uint16_t address = static_cast<uint16_t>(a++);
156  ss << std::setw(7) << lutValue(address);
157  }
158  ss << std::endl;
159 
160  return ss.str();
161 }
char * address
Definition: mlp_lapack.h:14
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
static const uint16_t MAX_ADDRESS_BITMASK
Definition: L1GctLut.h:24
static const int printWidth
Definition: L1GctLut.h:84
uint16_t lutValue(const uint16_t lutAddress) const
Access the look-up table contents for a given Address.
Definition: L1GctLut.h:105
double a
Definition: hdecay.h:121
template<int NAddressBits, int NDataBits>
void L1GctLut< NAddressBits, NDataBits >::setTerse ( )
inline

Definition at line 67 of file L1GctLut.h.

67 { m_verbose = false; }
bool m_verbose
Definition: L1GctLut.h:79
template<int NAddressBits, int NDataBits>
bool L1GctLut< NAddressBits, NDataBits >::setupOk ( )
inline

Definition at line 63 of file L1GctLut.h.

63 { return m_setupOk; }
bool m_setupOk
Definition: L1GctLut.h:78
template<int NAddressBits, int NDataBits>
void L1GctLut< NAddressBits, NDataBits >::setVerbose ( )
inline

control output messages

Definition at line 66 of file L1GctLut.h.

66 { m_verbose = true; }
bool m_verbose
Definition: L1GctLut.h:79
template<int NAddressBits, int NDataBits>
virtual uint16_t L1GctLut< NAddressBits, NDataBits >::value ( const uint16_t  lutAddress) const
protectedpure virtual

Friends And Related Function Documentation

template<int NAddressBits, int NDataBits>
std::ostream& operator<< ( std::ostream &  os,
const L1GctLut< NAddressBits, NDataBits > &  lut 
)
friend

Overload << operator.

Definition at line 30 of file L1GctLut.h.

31  {
32  //----------------------------------------------------------------------------------------
33  // Define the code here for the friend template function to get around
34  // compiler/linker problems when instantiating the template class.
35  // See http://www.parashift.com/c++-faq-lite/templates.html#faq-35.16
38 
39  os << lut.printHeader();
40 
41  for (int a=0; a<=maxAddress; a += width) {
42  os << lut.printLine(a);
43  }
44  return os;
45  // End of friend function definition
46  //----------------------------------------------------------------------------------------
47  }
std::string printLine(const int add) const
Definition: L1GctLut.h:148
Base class for LookUp Tables.
Definition: L1GctLut.h:21
double a
Definition: hdecay.h:121
std::string printHeader() const
Definition: L1GctLut.h:129

Member Data Documentation

template<int NAddressBits, int NDataBits>
bool L1GctLut< NAddressBits, NDataBits >::m_setupOk
protected

Definition at line 78 of file L1GctLut.h.

Referenced by L1GctLut< 16, 12 >::setupOk().

template<int NAddressBits, int NDataBits>
bool L1GctLut< NAddressBits, NDataBits >::m_verbose
protected

Definition at line 79 of file L1GctLut.h.

Referenced by L1GctLut< 16, 12 >::setTerse(), and L1GctLut< 16, 12 >::setVerbose().

template<int NAddressBits, int NDataBits>
const uint16_t L1GctLut< NAddressBits, NDataBits >::MAX_ADDRESS_BITMASK = (1 << NAddressBits) - 1
static

Definition at line 24 of file L1GctLut.h.

template<int NAddressBits, int NDataBits>
const uint16_t L1GctLut< NAddressBits, NDataBits >::MAX_DATA_BITMASK = (1 << NDataBits) - 1
static

Definition at line 25 of file L1GctLut.h.

template<int NAddressBits, int NDataBits>
const int L1GctLut< NAddressBits, NDataBits >::printWidth = 16
staticprivate

Definition at line 84 of file L1GctLut.h.