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 94 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 100 of file L1MuPacking.h.

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

100  {
101  return packed & (1 << (Bits - 1)) ? (packed - (1 << Bits)) : packed;
102  };
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 104 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().

104  {
105  unsigned maxabs = 1U << (Bits - 1);
106  if (idx < -(int)maxabs && idx >= (int)maxabs)
107  edm::LogWarning("ScaleRangeViolation")
108  << "L1MuSignedPacking::packedFromIdx: warning value " << idx << "exceeds " << Bits << "-bit range !!!";
109  return ~(std::numeric_limits<unsigned>::max() << Bits) & (idx < 0 ? (1U << Bits) + idx : idx);
110  };
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 97 of file L1MuPacking.h.

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