Definition of signed integer types with overflow. More...
#include <L1GctTwosComplement.h>
Public Member Functions | |
L1GctTwosComplement () | |
Construct a signed integer with initial value zero. More... | |
L1GctTwosComplement (uint32_t raw) | |
Construct a signed integer from raw data, checking for overFlow. More... | |
L1GctTwosComplement (int value) | |
Construct a signed integer, checking for overflow. More... | |
template<int mBits> | |
L1GctTwosComplement (const L1GctTwosComplement< mBits > &rhs) | |
Copy contructor to move data between representations with different numbers of bits. More... | |
L1GctTwosComplement | operator+ (const L1GctTwosComplement &rhs) const |
add two numbers of the same size More... | |
L1GctTwosComplement | operator- () const |
overload unary - (negation) operator More... | |
L1GctTwosComplement & | operator= (int value) |
overload = operator More... | |
bool | overFlow () const |
access overflow More... | |
uint32_t | raw () const |
access raw data More... | |
void | reset () |
reset value and overflow to zero More... | |
void | setOverFlow (bool oflow) |
set the overflow bit More... | |
void | setRaw (uint32_t raw) |
set the raw data More... | |
void | setValue (int value) |
set value from signed int More... | |
int | size () const |
return number of bits More... | |
int | value () const |
access value as signed int More... | |
~L1GctTwosComplement () | |
Destructor. More... | |
Private Member Functions | |
void | checkOverFlow (uint32_t rawValue, uint32_t &maskValue, bool &overFlow) |
Private Attributes | |
uint32_t | m_data |
int | m_nBits |
bool | m_overFlow |
Static Private Attributes | |
static const int | MAX_NBITS = 24 |
static const int | MAX_VALUE = 1<<(MAX_NBITS-1) |
Definition of signed integer types with overflow.
This file defines the template class L1GctTwosComplement. It is used to store energy values that are represented in a given number of bits in hardware. The type has a built-in overFlow that is set if the value to be represented is outside the allowed range for that number of bits. This type represents signed integers; unsigned integers are represented by L1GctUnsignedInt. Functions are defined to add two values, and to copy data into a different number of bits.
this header file contains method definitions because these are template classes see http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
Definition at line 29 of file L1GctTwosComplement.h.
L1GctTwosComplement< nBits >::L1GctTwosComplement | ( | ) |
Construct a signed integer with initial value zero.
Definition at line 101 of file L1GctTwosComplement.h.
References reset().
L1GctTwosComplement< nBits >::L1GctTwosComplement | ( | uint32_t | raw | ) |
Construct a signed integer from raw data, checking for overFlow.
Definition at line 108 of file L1GctTwosComplement.h.
L1GctTwosComplement< nBits >::L1GctTwosComplement | ( | int | value | ) |
Construct a signed integer, checking for overflow.
Definition at line 116 of file L1GctTwosComplement.h.
References reco::JetExtendedAssociation::setValue().
|
inline |
L1GctTwosComplement< nBits >::L1GctTwosComplement | ( | const L1GctTwosComplement< mBits > & | rhs | ) |
Copy contructor to move data between representations with different numbers of bits.
Definition at line 126 of file L1GctTwosComplement.h.
References L1GctTwosComplement< nBits >::overFlow(), and L1GctTwosComplement< nBits >::raw().
|
private |
Definition at line 219 of file L1GctTwosComplement.h.
References relativeConstraints::value.
L1GctTwosComplement< nBits > L1GctTwosComplement< nBits >::operator+ | ( | const L1GctTwosComplement< nBits > & | rhs | ) | const |
add two numbers of the same size
Definition at line 178 of file L1GctTwosComplement.h.
References L1GctTwosComplement< nBits >::overFlow(), L1GctTwosComplement< nBits >::raw(), L1GctTwosComplement< nBits >::setOverFlow(), L1GctTwosComplement< nBits >::setRaw(), and groupFilesInBlocks::temp.
L1GctTwosComplement< nBits > L1GctTwosComplement< nBits >::operator- | ( | ) | const |
overload unary - (negation) operator
Definition at line 200 of file L1GctTwosComplement.h.
References L1GctTwosComplement< nBits >::overFlow(), L1GctTwosComplement< nBits >::setOverFlow(), L1GctTwosComplement< nBits >::setValue(), groupFilesInBlocks::temp, and relativeConstraints::value.
L1GctTwosComplement< nBits > & L1GctTwosComplement< nBits >::operator= | ( | int | value | ) |
overload = operator
Definition at line 210 of file L1GctTwosComplement.h.
References reco::JetExtendedAssociation::setValue().
|
inline |
access overflow
Definition at line 63 of file L1GctTwosComplement.h.
Referenced by L1GctJetFinderBase::doHtSums(), L1GctMet::inputOverFlow(), L1GctTwosComplement< nBits >::L1GctTwosComplement(), L1GctMet::metVector(), L1GctTwosComplement< nBits >::operator+(), and L1GctTwosComplement< nBits >::operator-().
|
inline |
access raw data
Definition at line 57 of file L1GctTwosComplement.h.
Referenced by L1GctTwosComplement< nBits >::L1GctTwosComplement(), and L1GctTwosComplement< nBits >::operator+().
void L1GctTwosComplement< nBits >::reset | ( | void | ) |
reset value and overflow to zero
Definition at line 134 of file L1GctTwosComplement.h.
Referenced by L1GctWheelEnergyFpga::resetProcessor(), L1GctWheelJetFpga::resetProcessor(), L1GctJetLeafCard::resetProcessor(), and L1GctGlobalEnergyAlgos::resetProcessor().
|
inline |
set the overflow bit
Definition at line 54 of file L1GctTwosComplement.h.
Referenced by L1GctJetFinderBase::doHtSums(), L1GctTwosComplement< nBits >::operator+(), L1GctTwosComplement< nBits >::operator-(), L1GctGlobalEnergyAlgos::setInputWheelEx(), L1GctGlobalEnergyAlgos::setInputWheelEy(), L1GctGlobalEnergyAlgos::setInputWheelHx(), and L1GctGlobalEnergyAlgos::setInputWheelHy().
void L1GctTwosComplement< nBits >::setRaw | ( | uint32_t | raw | ) |
set the raw data
Definition at line 141 of file L1GctTwosComplement.h.
Referenced by L1GctTwosComplement< nBits >::operator+().
void L1GctTwosComplement< nBits >::setValue | ( | int | value | ) |
set value from signed int
Definition at line 147 of file L1GctTwosComplement.h.
References relativeConstraints::value.
Referenced by L1GctTwosComplement< nBits >::operator-(), L1GctGlobalEnergyAlgos::setInputWheelEx(), L1GctGlobalEnergyAlgos::setInputWheelEy(), L1GctGlobalEnergyAlgos::setInputWheelHx(), and L1GctGlobalEnergyAlgos::setInputWheelHy().
|
inline |
int L1GctTwosComplement< nBits >::value | ( | void | ) | const |
access value as signed int
Definition at line 166 of file L1GctTwosComplement.h.
References query::result, and relativeConstraints::value.
Referenced by L1GctMet::inputOverFlow(), and L1GctMet::metVector().
|
private |
Definition at line 83 of file L1GctTwosComplement.h.
Referenced by L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits >::raw().
|
private |
Definition at line 80 of file L1GctTwosComplement.h.
Referenced by L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits >::size().
|
private |
Definition at line 86 of file L1GctTwosComplement.h.
Referenced by L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits >::overFlow(), and L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits >::setOverFlow().
|
staticprivate |
Definition at line 88 of file L1GctTwosComplement.h.
|
staticprivate |
Definition at line 89 of file L1GctTwosComplement.h.