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 20 of file L1GctLut.h.

Constructor & Destructor Documentation

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

Definition at line 101 of file L1GctLut.h.

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

Definition at line 98 of file L1GctLut.h.

98 : m_setupOk(false) {}
bool m_setupOk
Definition: L1GctLut.h:77

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 114 of file L1GctLut.h.

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

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

115 {
116  if (KAddressBits==NAddressBits && KDataBits==NDataBits) {
117  bool match=true;
118  for (uint16_t address=0; address<=MAX_ADDRESS_BITMASK; address++) {
119  if (this->lutValue(address)!=rhsLut.lutValue(address)) { match = false; break; }
120  }
121  return match;
122  } else {
123  return false;
124  }
125 }
char * address
Definition: mlp_lapack.h:14
static const uint16_t MAX_ADDRESS_BITMASK
Definition: L1GctLut.h:23
uint16_t lutValue(const uint16_t lutAddress) const
Access the look-up table contents for a given Address.
Definition: L1GctLut.h:104
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 104 of file L1GctLut.h.

References data, and relativeConstraints::value.

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

105 {
106  if (!m_setupOk) return (uint16_t) 0;
107  uint16_t address=(lutAddress & MAX_ADDRESS_BITMASK);
108  uint16_t data=(value(address) & MAX_DATA_BITMASK);
109  return data;
110 }
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:23
static const uint16_t MAX_DATA_BITMASK
Definition: L1GctLut.h:24
bool m_setupOk
Definition: L1GctLut.h:77
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 60 of file L1GctLut.h.

60 { return !equalityCheck(rhsLut); }
bool equalityCheck(const L1GctLut< KAddressBits, KDataBits > &c) const
Definition: L1GctLut.h:114
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 56 of file L1GctLut.h.

56 { return equalityCheck(rhsLut); }
bool equalityCheck(const L1GctLut< KAddressBits, KDataBits > &c) const
Definition: L1GctLut.h:114
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 52 of file L1GctLut.h.

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

Definition at line 128 of file L1GctLut.h.

References a.

129 {
130  std::stringstream ss;
131  ss << std::hex << std::showbase;
132  ss << std::setw(8) << "|";
133  for (int a=0; ((a<printWidth) && (a<=MAX_ADDRESS_BITMASK)); ++a) {
134  ss << std::setw(7) << a;
135  }
136  ss << std::endl;
137  ss << std::setfill('-') << std::setw(8) << "+";
138  for (int a=0; ((a<printWidth) && (a<=MAX_ADDRESS_BITMASK)); ++a) {
139  ss << std::setw(7) << "-";
140  }
141  ss << std::endl;
142 
143  return ss.str();
144 }
static const uint16_t MAX_ADDRESS_BITMASK
Definition: L1GctLut.h:23
static const int printWidth
Definition: L1GctLut.h:83
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 147 of file L1GctLut.h.

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

148 {
149  std::stringstream ss;
150  ss << std::hex << std::showbase;
151  int a=add;
152  ss << std::setw(7) << a << "|";
153  for (int c=0; ((c<printWidth) && (a<=MAX_ADDRESS_BITMASK)); ++c) {
154  uint16_t address = static_cast<uint16_t>(a++);
155  ss << std::setw(7) << lutValue(address);
156  }
157  ss << std::endl;
158 
159  return ss.str();
160 }
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:23
static const int printWidth
Definition: L1GctLut.h:83
uint16_t lutValue(const uint16_t lutAddress) const
Access the look-up table contents for a given Address.
Definition: L1GctLut.h:104
double a
Definition: hdecay.h:121
template<int NAddressBits, int NDataBits>
void L1GctLut< NAddressBits, NDataBits >::setTerse ( )
inline

Definition at line 66 of file L1GctLut.h.

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

Definition at line 62 of file L1GctLut.h.

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

control output messages

Definition at line 65 of file L1GctLut.h.

65 { m_verbose = true; }
bool m_verbose
Definition: L1GctLut.h:78
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 29 of file L1GctLut.h.

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

Member Data Documentation

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

Definition at line 77 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 78 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 23 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 24 of file L1GctLut.h.

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

Definition at line 83 of file L1GctLut.h.