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

virtual int idxFromPacked (unsigned packed) const
 get the value from the packed notation (+/-) More...
 
virtual unsigned packedFromIdx (int idx) const
 get the packed notation of a value, check range More...
 
virtual int signFromPacked (unsigned packed) const
 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>
virtual int L1MuSignedPacking< Bits >::idxFromPacked ( unsigned  packed) const
inlinevirtual

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 { return packed & (1 << (Bits-1)) ? (packed - (1 << Bits) ) : packed;};
template<unsigned int Bits>
virtual unsigned L1MuSignedPacking< Bits >::packedFromIdx ( int  idx) const
inlinevirtual

get the packed notation of a value, check range

Implements L1MuPacking.

Definition at line 102 of file L1MuPacking.h.

References training_settings::idx, and createfilelist::int.

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

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

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