CMS 3D CMS Logo

Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes | Friends

L1GctLut< NAddressBits, NDataBits > Class Template Reference

Base class for LookUp Tables. More...

#include <L1GctLut.h>

List of all members.

Public Member Functions

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

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.

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

Definition at line 99 of file L1GctLut.h.

: m_setupOk(false) {}

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==().

{
  if (KAddressBits==NAddressBits && KDataBits==NDataBits) {
    bool match=true;
    for (uint16_t address=0; address<=MAX_ADDRESS_BITMASK; address++) {
      if (this->lutValue(address)!=rhsLut.lutValue(address)) { match = false; break; }
    }
    return match;
  } else {
    return false;
  }
}
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 AlCaHLTBitMon_QueryRunRegistry::data, and relativeConstraints::value.

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

{
  if (!m_setupOk) return (uint16_t) 0;
  uint16_t address=(lutAddress & MAX_ADDRESS_BITMASK);
  uint16_t data=(value(address) & MAX_DATA_BITMASK);
  return data;
}
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.

{ return !equalityCheck(rhsLut); }
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.

{ return equalityCheck(rhsLut); }
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.

{ return lutValue(lutAddress); } 
template<int NAddressBits, int NDataBits>
std::string L1GctLut< NAddressBits, NDataBits >::printHeader ( ) const [private]

Definition at line 129 of file L1GctLut.h.

References a.

{
  std::stringstream ss;
  ss << std::hex << std::showbase; 
  ss << std::setw(8) << "|";
  for (int a=0; ((a<printWidth) && (a<=MAX_ADDRESS_BITMASK)); ++a) {
    ss << std::setw(7) << a;
  }
  ss << std::endl;
  ss << std::setfill('-') << std::setw(8) << "+";
  for (int a=0; ((a<printWidth) && (a<=MAX_ADDRESS_BITMASK)); ++a) {
    ss << std::setw(7) << "-";
  }
  ss << std::endl;

  return ss.str();
}
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.

{
  std::stringstream ss;
  ss << std::hex << std::showbase; 
  int a=add;
  ss << std::setw(7) << a << "|";
  for (int c=0; ((c<printWidth) && (a<=MAX_ADDRESS_BITMASK)); ++c) {
    uint16_t address = static_cast<uint16_t>(a++);
    ss << std::setw(7) << lutValue(address);
  }
  ss << std::endl;

  return ss.str();
}
template<int NAddressBits, int NDataBits>
void L1GctLut< NAddressBits, NDataBits >::setTerse ( ) [inline]

Definition at line 67 of file L1GctLut.h.

{ m_verbose = false; }
template<int NAddressBits, int NDataBits>
bool L1GctLut< NAddressBits, NDataBits >::setupOk ( ) [inline]

Definition at line 63 of file L1GctLut.h.

{ return m_setupOk; }
template<int NAddressBits, int NDataBits>
void L1GctLut< NAddressBits, NDataBits >::setVerbose ( ) [inline]

control output messages

Definition at line 66 of file L1GctLut.h.

{ m_verbose = true; }
template<int NAddressBits, int NDataBits>
virtual uint16_t L1GctLut< NAddressBits, NDataBits >::value ( const uint16_t  lutAddress) const [protected, pure 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.

  {
    //----------------------------------------------------------------------------------------
    // Define the code here for the friend template function to get around
    // compiler/linker problems when instantiating the template class.
    // See https://www.parashift.com/c++-faq-lite/templates.html#faq-35.16
    static const int maxAddress=L1GctLut<NAddressBits, NDataBits>::MAX_ADDRESS_BITMASK;
    static const int width=L1GctLut<NAddressBits, NDataBits>::printWidth;

    os << lut.printHeader();

    for (int a=0; a<=maxAddress; a += width) {
      os << lut.printLine(a);
    }
    return os;
    // End of friend function definition
    //----------------------------------------------------------------------------------------
  }

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 [static, private]

Definition at line 84 of file L1GctLut.h.