21 #ifndef CondFormatsL1TObjects_L1MuPacking_h
22 #define CondFormatsL1TObjects_L1MuPacking_h
56 template<
unsigned int Bits>
62 virtual int idxFromPacked(
unsigned packed)
const {
return (
int) packed;};
66 <<
"L1MuUnignedPacking::packedFromIdx: warning value " << idx
67 <<
"exceeds " <<
Bits <<
"-bit range !!!";
68 return (
unsigned)
idx;
77 static int idxFromPacked(
unsigned packed,
unsigned int nbits) {
return (
int) packed;};
81 <<
"L1MuUnignedPacking::packedFromIdx: warning value " << idx
82 <<
"exceeds " << nbits <<
"-bit range !!!";
83 return (
unsigned)
idx;
93 template<
unsigned int Bits>
100 virtual int idxFromPacked(
unsigned packed)
const {
return packed & (1 << (
Bits-1)) ? (packed - (1 <<
Bits) ) : packed;};
103 unsigned maxabs = 1 << (
Bits-1) ;
104 if (idx < -(
int)maxabs && idx >= (int)maxabs)
edm::LogWarning(
"ScaleRangeViolation")
105 <<
"L1MuSignedPacking::packedFromIdx: warning value " << idx
106 <<
"exceeds " <<
Bits <<
"-bit range !!!";
107 return ~(~0 <<
Bits) & (idx < 0 ? (1 << Bits) + idx :
idx);
114 static int signFromPacked(
unsigned packed,
unsigned int nbits) {
return packed & (1 << (nbits-1)) ? 1 : 0;};
117 static int idxFromPacked(
unsigned packed,
unsigned int nbits) {
return packed & (1 << (nbits-1)) ? (packed - (1 << nbits) ) : packed;};
120 unsigned maxabs = 1 << (nbits-1) ;
121 if (idx < -(
int)maxabs && idx >= (int)maxabs)
edm::LogWarning(
"ScaleRangeViolation")
122 <<
"L1MuSignedPacking::packedFromIdx: warning value " << idx
123 <<
"exceeds " << nbits <<
"-bit range !!!";
124 return ~(~0 << nbits) & (idx < 0 ? (1 << nbits) + idx :
idx);
147 unsigned mask = (1 << (
m_nbits-1)) - 1;
148 int absidx = (int) ( packed & mask );
149 unsigned psmask = (1 << (
m_nbits-1) );
150 return absidx * ( ( (packed & psmask) == psmask ) ? -1 : 1 );
155 unsigned maxabs = (1 << (
m_nbits-1)) -1;
157 <<
"L1MuPseudoSignedPacking::packedFromIdx: warning value " << idx
158 <<
"exceeds " <<
m_nbits <<
"-bit range !!!";
159 if (idx < 0) packed |= 1 << (m_nbits-1);
166 unsigned maxabs = (1 << (
m_nbits-1)) -1;
168 <<
"L1MuPseudoSignedPacking::packedFromIdx: warning value " << idx
169 <<
"exceeds " <<
m_nbits <<
"-bit range !!!";
170 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)