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 28 of file L1GctTwosComplement.h.
L1GctTwosComplement< nBits >::L1GctTwosComplement | ( | ) |
Construct a signed integer with initial value zero.
Definition at line 99 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 106 of file L1GctTwosComplement.h.
L1GctTwosComplement< nBits >::L1GctTwosComplement | ( | int | value | ) |
Construct a signed integer, checking for overflow.
Definition at line 114 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 124 of file L1GctTwosComplement.h.
References L1GctTwosComplement< nBits >::overFlow(), and L1GctTwosComplement< nBits >::raw().
|
private |
Definition at line 217 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 181 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 201 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 62 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 56 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 132 of file L1GctTwosComplement.h.
Referenced by L1GctWheelEnergyFpga::resetProcessor(), L1GctWheelJetFpga::resetProcessor(), L1GctJetLeafCard::resetProcessor(), and L1GctGlobalEnergyAlgos::resetProcessor().
|
inline |
set the overflow bit
Definition at line 53 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 139 of file L1GctTwosComplement.h.
Referenced by L1GctTwosComplement< nBits >::operator+().
void L1GctTwosComplement< nBits >::setValue | ( | int | value | ) |
set value from signed int
Definition at line 145 of file L1GctTwosComplement.h.
References relativeConstraints::value.
Referenced by L1GctTwosComplement< nBits >::operator-(), L1GctGlobalEnergyAlgos::setInputWheelEx(), L1GctGlobalEnergyAlgos::setInputWheelEy(), L1GctGlobalEnergyAlgos::setInputWheelHx(), and L1GctGlobalEnergyAlgos::setInputWheelHy().
|
inline |
return number of bits
Definition at line 65 of file L1GctTwosComplement.h.
Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().
int L1GctTwosComplement< nBits >::value | ( | void | ) | const |
access value as signed int
Definition at line 170 of file L1GctTwosComplement.h.
References mps_fire::result, and relativeConstraints::value.
Referenced by Types.int32::__nonzero__(), Types.uint32::__nonzero__(), Types.int64::__nonzero__(), Types.uint64::__nonzero__(), Types.double::__nonzero__(), Types.bool::__nonzero__(), Types.string::__nonzero__(), average.Average::average(), Types.string::configValue(), Types.FileInPath::configValue(), L1GctMet::inputOverFlow(), Types.int32::insertInto(), Types.uint32::insertInto(), Types.int64::insertInto(), Types.uint64::insertInto(), Types.double::insertInto(), Types.bool::insertInto(), Types.string::insertInto(), Types.FileInPath::insertInto(), Types.vint32::insertInto(), Types.vuint32::insertInto(), Types.vint64::insertInto(), Types.vuint64::insertInto(), Types.vdouble::insertInto(), Types.vbool::insertInto(), Types.vstring::insertInto(), and L1GctMet::metVector().
|
private |
Definition at line 81 of file L1GctTwosComplement.h.
Referenced by L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits >::raw().
|
private |
Definition at line 78 of file L1GctTwosComplement.h.
Referenced by L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits >::size().
|
private |
Definition at line 84 of file L1GctTwosComplement.h.
Referenced by L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits >::overFlow(), and L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits >::setOverFlow().
|
staticprivate |
Definition at line 86 of file L1GctTwosComplement.h.
|
staticprivate |
Definition at line 87 of file L1GctTwosComplement.h.