21 #ifndef CondFormatsL1TObjects_L1MuPacking_h
22 #define CondFormatsL1TObjects_L1MuPacking_h
54 template<
unsigned int Bits>
60 virtual int idxFromPacked(
unsigned packed)
const {
return (
int) packed;};
64 <<
"L1MuUnignedPacking::packedFromIdx: warning value " << idx
65 <<
"exceeds " <<
Bits <<
"-bit range !!!";
66 return (
unsigned)
idx;
75 static int idxFromPacked(
unsigned packed,
unsigned int nbits) {
return (
int) packed;};
79 <<
"L1MuUnignedPacking::packedFromIdx: warning value " << idx
80 <<
"exceeds " << nbits <<
"-bit range !!!";
81 return (
unsigned)
idx;
91 template<
unsigned int Bits>
98 virtual int idxFromPacked(
unsigned packed)
const {
return packed & (1 << (
Bits-1)) ? (packed - (1 <<
Bits) ) : packed;};
101 unsigned maxabs = 1 << (
Bits-1) ;
102 if (idx < -(
int)maxabs && idx >= (int)maxabs)
edm::LogWarning(
"ScaleRangeViolation")
103 <<
"L1MuSignedPacking::packedFromIdx: warning value " << idx
104 <<
"exceeds " <<
Bits <<
"-bit range !!!";
105 return ~(~0 <<
Bits) & (idx < 0 ? (1 << Bits) + idx :
idx);
112 static int signFromPacked(
unsigned packed,
unsigned int nbits) {
return packed & (1 << (nbits-1)) ? 1 : 0;};
115 static int idxFromPacked(
unsigned packed,
unsigned int nbits) {
return packed & (1 << (nbits-1)) ? (packed - (1 << nbits) ) : packed;};
118 unsigned maxabs = 1 << (nbits-1) ;
119 if (idx < -(
int)maxabs && idx >= (int)maxabs)
edm::LogWarning(
"ScaleRangeViolation")
120 <<
"L1MuSignedPacking::packedFromIdx: warning value " << idx
121 <<
"exceeds " << nbits <<
"-bit range !!!";
122 return ~(~0 << nbits) & (idx < 0 ? (1 << nbits) + idx :
idx);
145 unsigned mask = (1 << (
m_nbits-1)) - 1;
146 int absidx = (int) ( packed & mask );
147 unsigned psmask = (1 << (
m_nbits-1) );
148 return absidx * ( ( (packed & psmask) == psmask ) ? -1 : 1 );
152 unsigned packed =
abs(idx);
153 unsigned maxabs = (1 << (
m_nbits-1)) -1;
155 <<
"L1MuPseudoSignedPacking::packedFromIdx: warning value " << idx
156 <<
"exceeds " <<
m_nbits <<
"-bit range !!!";
157 if (idx < 0) packed |= 1 << (m_nbits-1);
163 unsigned packed =
abs(idx);
164 unsigned maxabs = (1 << (
m_nbits-1)) -1;
166 <<
"L1MuPseudoSignedPacking::packedFromIdx: warning value " << idx
167 <<
"exceeds " <<
m_nbits <<
"-bit range !!!";
168 if (sig==1) packed |= 1 << (m_nbits-1);
L1MuPseudoSignedPacking()
static int idxFromPacked(unsigned packed, unsigned int nbits)
get the value from the packed notation (always positive)
virtual unsigned packedFromIdx(int idx) const
get the packed notation of a value, check the range
virtual unsigned packedFromIdx(int idx) const
get the packed notation of a value, check range
static int signFromPacked(unsigned packed, unsigned int nbits)
get the sign from the packed notation. always psitive (0)
virtual int signFromPacked(unsigned packed) const
get the sign from the packed notation. always psitive (0)
virtual int idxFromPacked(unsigned packed) const
get the value from the packed notation (+/-)
virtual int signFromPacked(unsigned packed) const
get the sign from the packed notation (0=positive, 1=negative)
static unsigned packedFromIdx(int idx, unsigned int nbits)
get the packed notation of a value, check range
virtual unsigned packedFromIdx(int idx) const =0
get the packed notation of a value
static int idxFromPacked(unsigned packed, unsigned int nbits)
get the value from the packed notation (+/-)
Abs< T >::type abs(const T &t)
virtual unsigned packedFromIdx(int idx) const
get the packed notation of a value, check range
virtual int idxFromPacked(unsigned packed) const =0
get the value from the packed notation
virtual ~L1MuPseudoSignedPacking()
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
#define COND_SERIALIZABLE
virtual int idxFromPacked(unsigned packed) const
get the value from the packed notation (+/-)
L1MuPseudoSignedPacking(unsigned int nbits)
static unsigned packedFromIdx(int idx, unsigned int nbits)
get the packed notation of a value, check the range
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 int idxFromPacked(unsigned packed) const
get the value from the packed notation (always positive)
virtual int signFromPacked(unsigned packed) const
get the (pseudo-)sign from the packed notation (0=positive, 1=negative)
static int signFromPacked(unsigned packed, unsigned int nbits)
get the sign from the packed notation (0=positive, 1=negative)
virtual int signFromPacked(unsigned packed) const =0
get the sign from the packed notation (0=positive, 1=negative)