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

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

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

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

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

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  };

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

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

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

97 { return packed & (1 << (Bits - 1)) ? 1 : 0; };
edm::module::AbilityBits::Bits
Bits
Definition: moduleAbilityEnums.h:54
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
createfilelist.int
int
Definition: createfilelist.py:10