#include <CondFormats/L1TObjects/interface/L1MuPacking.h>
Public Member Functions | |
virtual int | idxFromPacked (unsigned packed) const |
get the value from the packed notation (+/-) | |
L1MuPseudoSignedPacking (unsigned int nbits) | |
L1MuPseudoSignedPacking () | |
virtual unsigned | packedFromIdx (int idx, int sig) const |
get the packed notation of a value, check range; sets the sign separately, 1 is neg. sign(!) | |
virtual unsigned | packedFromIdx (int idx) const |
get the packed notation of a value, check range | |
virtual int | signFromPacked (unsigned packed) const |
get the (pseudo-)sign from the packed notation (0=positive, 1=negative) | |
Private Attributes | |
unsigned int | m_nbits |
There is a -0 and a +0 in the pseudo-signed scale
Definition at line 128 of file L1MuPacking.h.
L1MuPseudoSignedPacking::L1MuPseudoSignedPacking | ( | ) | [inline] |
L1MuPseudoSignedPacking::L1MuPseudoSignedPacking | ( | unsigned int | nbits | ) | [inline] |
virtual int L1MuPseudoSignedPacking::idxFromPacked | ( | unsigned | packed | ) | const [inline, virtual] |
get the value from the packed notation (+/-)
Implements L1MuPacking.
Definition at line 137 of file L1MuPacking.h.
Referenced by L1MuSymmetricBinnedScale::getCenter(), and L1MuSymmetricBinnedScale::getLowEdge().
00137 { 00138 unsigned mask = (1 << (m_nbits-1)) - 1; // for lower bits 00139 int absidx = (int) ( packed & mask ); 00140 unsigned psmask = (1 << (m_nbits-1) ); 00141 return absidx * ( ( (packed & psmask) == psmask ) ? -1 : 1 ); // pseudo sign==1 is negative 00142 };
virtual unsigned L1MuPseudoSignedPacking::packedFromIdx | ( | int | idx, | |
int | sig | |||
) | const [inline, virtual] |
get the packed notation of a value, check range; sets the sign separately, 1 is neg. sign(!)
Definition at line 155 of file L1MuPacking.h.
References funct::abs(), and m_nbits.
00155 { 00156 unsigned packed = abs(idx); 00157 unsigned maxabs = (1 << (m_nbits-1)) -1; 00158 if (packed > maxabs) edm::LogWarning("ScaleRangeViolation") 00159 << "L1MuPseudoSignedPacking::packedFromIdx: warning value " << idx 00160 << "exceeds " << m_nbits << "-bit range !!!"; 00161 if (sig==1) packed |= 1 << (m_nbits-1); // sig==1 is negative 00162 return packed; 00163 }
virtual unsigned L1MuPseudoSignedPacking::packedFromIdx | ( | int | idx | ) | const [inline, virtual] |
get the packed notation of a value, check range
Implements L1MuPacking.
Definition at line 144 of file L1MuPacking.h.
References funct::abs(), and m_nbits.
Referenced by L1MuSymmetricBinnedScale::getPacked().
00144 { 00145 unsigned packed = abs(idx); 00146 unsigned maxabs = (1 << (m_nbits-1)) -1; 00147 if (packed > maxabs) edm::LogWarning("ScaleRangeViolation") 00148 << "L1MuPseudoSignedPacking::packedFromIdx: warning value " << idx 00149 << "exceeds " << m_nbits << "-bit range !!!"; 00150 if (idx < 0) packed |= 1 << (m_nbits-1); 00151 return packed; 00152 }
virtual int L1MuPseudoSignedPacking::signFromPacked | ( | unsigned | packed | ) | const [inline, virtual] |
get the (pseudo-)sign from the packed notation (0=positive, 1=negative)
Implements L1MuPacking.
Definition at line 134 of file L1MuPacking.h.
References m_nbits.
Referenced by L1MuSymmetricBinnedScale::getCenter(), and L1MuSymmetricBinnedScale::getLowEdge().
00134 { return ( packed & (1 << (m_nbits-1)) ) ? 1 : 0;};
unsigned int L1MuPseudoSignedPacking::m_nbits [private] |
Definition at line 166 of file L1MuPacking.h.
Referenced by idxFromPacked(), packedFromIdx(), and signFromPacked().