CMS 3D CMS Logo

List of all members | Static Public Member Functions | Private Member Functions
L1MuSignedPackingGeneric Class Referenceabstract

#include <L1MuPacking.h>

Inheritance diagram for L1MuSignedPackingGeneric:
L1MuPacking

Static Public Member Functions

static int idxFromPacked (unsigned packed, unsigned int nbits)
 get the value from the packed notation (+/-) More...
 
static unsigned packedFromIdx (int idx, unsigned int nbits)
 get the packed notation of a value, check range More...
 
static int signFromPacked (unsigned packed, unsigned int nbits)
 get the sign from the packed notation (0=positive, 1=negative) More...
 

Private Member Functions

int idxFromPacked (unsigned packed) const =0
 get the value from the packed notation More...
 
unsigned packedFromIdx (int idx) const =0
 get the packed notation of a value More...
 
int signFromPacked (unsigned packed) const =0
 get the sign from the packed notation (0=positive, 1=negative) More...
 

Additional Inherited Members

- Public Member Functions inherited from L1MuPacking
virtual ~L1MuPacking ()
 

Detailed Description

Definition at line 118 of file L1MuPacking.h.

Member Function Documentation

◆ idxFromPacked() [1/2]

static int L1MuSignedPackingGeneric::idxFromPacked ( unsigned  packed,
unsigned int  nbits 
)
inlinestatic

get the value from the packed notation (+/-)

Definition at line 124 of file L1MuPacking.h.

Referenced by L1MuBinnedScale::get_idx().

124  {
125  return packed & (1 << (nbits - 1)) ? (packed - (1 << nbits)) : packed;
126  };

◆ idxFromPacked() [2/2]

int L1MuSignedPackingGeneric::idxFromPacked ( unsigned  packed) const
privatepure virtual

get the value from the packed notation

Implements L1MuPacking.

◆ packedFromIdx() [1/2]

static unsigned L1MuSignedPackingGeneric::packedFromIdx ( int  idx,
unsigned int  nbits 
)
inlinestatic

get the packed notation of a value, check range

Definition at line 128 of file L1MuPacking.h.

References heavyIonCSV_trainingSettings::idx, createfilelist::int, WZElectronSkims53X_cff::max, and mitigatedMETSequence_cff::U.

Referenced by L1MuBinnedScale::getPacked().

128  {
129  unsigned maxabs = 1U << (nbits - 1);
130  if (idx < -(int)maxabs && idx >= (int)maxabs)
131  edm::LogWarning("ScaleRangeViolation")
132  << "L1MuSignedPacking::packedFromIdx: warning value " << idx << "exceeds " << nbits << "-bit range !!!";
133  return ~(std::numeric_limits<unsigned>::max() << nbits) & (idx < 0 ? (1U << nbits) + idx : idx);
134  };
Log< level::Warning, false > LogWarning

◆ packedFromIdx() [2/2]

unsigned L1MuSignedPackingGeneric::packedFromIdx ( int  idx) const
privatepure virtual

get the packed notation of a value

Implements L1MuPacking.

◆ signFromPacked() [1/2]

static int L1MuSignedPackingGeneric::signFromPacked ( unsigned  packed,
unsigned int  nbits 
)
inlinestatic

get the sign from the packed notation (0=positive, 1=negative)

Definition at line 121 of file L1MuPacking.h.

121 { return packed & (1 << (nbits - 1)) ? 1 : 0; };

◆ signFromPacked() [2/2]

int L1MuSignedPackingGeneric::signFromPacked ( unsigned  packed) const
privatepure virtual

get the sign from the packed notation (0=positive, 1=negative)

Implements L1MuPacking.