CMS 3D CMS Logo

List of all members | Public Member Functions
L1MuSignedPacking< Bits > Class Template Reference

#include <L1MuPacking.h>

Inheritance diagram for L1MuSignedPacking< Bits >:
L1MuPacking

Public Member Functions

int idxFromPacked (unsigned packed) const override
 get the value from the packed notation (+/-) More...
 
unsigned packedFromIdx (int idx) const override
 get the packed notation of a value, check range More...
 
int signFromPacked (unsigned packed) const override
 get the sign from the packed notation (0=positive, 1=negative) More...
 
- Public Member Functions inherited from L1MuPacking
virtual ~L1MuPacking ()
 

Detailed Description

template<unsigned int Bits>
class L1MuSignedPacking< Bits >

Packing of a signed int in a bit field (2's complement)

Definition at line 95 of file L1MuPacking.h.

Member Function Documentation

template<unsigned int Bits>
int L1MuSignedPacking< Bits >::idxFromPacked ( unsigned  packed) const
inlineoverridevirtual

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

Implements L1MuPacking.

Definition at line 101 of file L1MuPacking.h.

Referenced by L1MuGMTMerger::projectedPhi(), and L1MuGMTLFMatchQualLUT::TheLookupFunction().

101 { return packed & (1 << (Bits-1)) ? (packed - (1 << Bits) ) : packed;};
template<unsigned int Bits>
unsigned L1MuSignedPacking< Bits >::packedFromIdx ( int  idx) const
inlineoverridevirtual

get the packed notation of a value, check range

Implements L1MuPacking.

Definition at line 103 of file L1MuPacking.h.

References training_settings::idx, createfilelist::int, SiStripPI::max, and mitigatedMETSequence_cff::U.

Referenced by L1MuGMTMatcher::lookup_mq(), L1MuDTTrack::setEta(), L1MuGMTLFCOUDeltaEtaLUT::TheLookupFunction(), L1MuGMTLFDeltaEtaLUT::TheLookupFunction(), and L1MuGMTLFPhiProLUT::TheLookupFunction().

103  {
104  unsigned maxabs = 1U << (Bits-1) ;
105  if (idx < -(int)maxabs && idx >= (int)maxabs) edm::LogWarning("ScaleRangeViolation")
106  << "L1MuSignedPacking::packedFromIdx: warning value " << idx
107  << "exceeds " << Bits << "-bit range !!!";
108  return ~(std::numeric_limits<unsigned>::max() << Bits) & (idx < 0 ? (1U << Bits) + idx : idx);
109  };
template<unsigned int Bits>
int L1MuSignedPacking< Bits >::signFromPacked ( unsigned  packed) const
inlineoverridevirtual

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

Implements L1MuPacking.

Definition at line 98 of file L1MuPacking.h.

98 { return packed & (1 << (Bits-1)) ? 1 : 0;};