|
|
Go to the documentation of this file.
20 #ifndef CondFormatsL1TObjects_L1MuPacking_h
21 #define CondFormatsL1TObjects_L1MuPacking_h
56 template <
unsigned int Bits>
62 int idxFromPacked(
unsigned packed)
const override {
return (
int)packed; };
67 <<
"L1MuUnignedPacking::packedFromIdx: warning value " <<
idx <<
"exceeds " <<
Bits <<
"-bit range !!!";
75 static int signFromPacked(
unsigned packed,
unsigned int nbits) {
return 0; };
77 static int idxFromPacked(
unsigned packed,
unsigned int nbits) {
return (
int)packed; };
80 if (
idx >= (1 << nbits))
82 <<
"L1MuUnignedPacking::packedFromIdx: warning value " <<
idx <<
"exceeds " << nbits <<
"-bit range !!!";
93 template <
unsigned int Bits>
97 int signFromPacked(
unsigned packed)
const override {
return packed & (1 << (
Bits - 1)) ? 1 : 0; };
101 return packed & (1 << (
Bits - 1)) ? (packed - (1 <<
Bits)) : packed;
105 unsigned maxabs = 1
U << (
Bits - 1);
106 if (
idx < -(
int)maxabs &&
idx >= (
int)maxabs)
108 <<
"L1MuSignedPacking::packedFromIdx: warning value " <<
idx <<
"exceeds " <<
Bits <<
"-bit range !!!";
116 static int signFromPacked(
unsigned packed,
unsigned int nbits) {
return packed & (1 << (nbits - 1)) ? 1 : 0; };
120 return packed & (1 << (nbits - 1)) ? (packed - (1 << nbits)) : packed;
124 unsigned maxabs = 1
U << (nbits - 1);
125 if (
idx < -(
int)maxabs &&
idx >= (
int)maxabs)
127 <<
"L1MuSignedPacking::packedFromIdx: warning value " <<
idx <<
"exceeds " << nbits <<
"-bit range !!!";
151 unsigned mask = (1 << (
m_nbits - 1)) - 1;
152 int absidx = (
int)(packed & mask);
153 unsigned psmask = (1 << (
m_nbits - 1));
154 return absidx * (((packed & psmask) == psmask) ? -1 : 1);
159 unsigned maxabs = (1 << (
m_nbits - 1)) - 1;
161 edm::LogWarning(
"ScaleRangeViolation") <<
"L1MuPseudoSignedPacking::packedFromIdx: warning value " <<
idx
162 <<
"exceeds " <<
m_nbits <<
"-bit range !!!";
171 unsigned maxabs = (1 << (
m_nbits - 1)) - 1;
173 edm::LogWarning(
"ScaleRangeViolation") <<
"L1MuPseudoSignedPacking::packedFromIdx: warning value " <<
idx
174 <<
"exceeds " <<
m_nbits <<
"-bit range !!!";
unsigned packedFromIdx(int idx) const override
get the packed notation of a value, check range
static int idxFromPacked(unsigned packed, unsigned int nbits)
get the value from the packed notation (always positive)
int idxFromPacked(unsigned packed) const override
get the value from the packed notation (always positive)
static int signFromPacked(unsigned packed, unsigned int nbits)
get the sign from the packed notation (0=positive, 1=negative)
#define COND_SERIALIZABLE
static int signFromPacked(unsigned packed, unsigned int nbits)
get the sign from the packed notation. always psitive (0)
static int idxFromPacked(unsigned packed, unsigned int nbits)
get the value from the packed notation (+/-)
int idxFromPacked(unsigned packed) const override
get the value from the packed notation (+/-)
virtual int idxFromPacked(unsigned packed) const =0
get the value from the packed notation
static unsigned packedFromIdx(int idx, unsigned int nbits)
get the packed notation of a value, check range
int signFromPacked(unsigned packed) const override
get the (pseudo-)sign from the packed notation (0=positive, 1=negative)
virtual unsigned packedFromIdx(int idx, int sig) const
get the packed notation of a value, check range; sets the sign separately, 1 is neg....
virtual unsigned packedFromIdx(int idx) const =0
get the packed notation of a value
~L1MuPseudoSignedPacking() override
int signFromPacked(unsigned packed) const override
get the sign from the packed notation. always psitive (0)
int idxFromPacked(unsigned packed) const override
get the value from the packed notation (+/-)
static unsigned packedFromIdx(int idx, unsigned int nbits)
get the packed notation of a value, check the range
int signFromPacked(unsigned packed) const override
get the sign from the packed notation (0=positive, 1=negative)
Abs< T >::type abs(const T &t)
L1MuPseudoSignedPacking(unsigned int nbits)
L1MuPseudoSignedPacking()
unsigned packedFromIdx(int idx) const override
get the packed notation of a value, check range
virtual int signFromPacked(unsigned packed) const =0
get the sign from the packed notation (0=positive, 1=negative)
unsigned packedFromIdx(int idx) const override
get the packed notation of a value, check the range