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

Member Function Documentation

◆ idxFromPacked()

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

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

Implements L1MuPacking.

Definition at line 105 of file L1MuPacking.h.

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

105  {
106  return packed & (1 << (Bits - 1)) ? (packed - (1 << Bits)) : packed;
107  };

◆ packedFromIdx()

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

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

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

109  {
110  unsigned maxabs = 1U << (Bits - 1);
111  if (idx < -(int)maxabs && idx >= (int)maxabs)
112  edm::LogWarning("ScaleRangeViolation")
113  << "L1MuSignedPacking::packedFromIdx: warning value " << idx << "exceeds " << Bits << "-bit range !!!";
114  return ~(std::numeric_limits<unsigned>::max() << Bits) & (idx < 0 ? (1U << Bits) + idx : idx);
115  };
Log< level::Warning, false > LogWarning

◆ signFromPacked()

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

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