CMS 3D CMS Logo

Public Member Functions

L1MuSignedPacking< Bits > Class Template Reference

#include <L1MuPacking.h>

Inheritance diagram for L1MuSignedPacking< Bits >:
L1MuPacking

List of all members.

Public Member Functions

virtual int idxFromPacked (unsigned packed) const
 get the value from the packed notation (+/-)
virtual unsigned packedFromIdx (int idx) const
 get the packed notation of a value, check range
virtual int signFromPacked (unsigned packed) const
 get the sign from the packed notation (0=positive, 1=negative)

Detailed Description

template<unsigned int Bits>
class L1MuSignedPacking< Bits >

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

Definition at line 86 of file L1MuPacking.h.


Member Function Documentation

template<unsigned int Bits>
virtual int L1MuSignedPacking< Bits >::idxFromPacked ( unsigned  packed) const [inline, virtual]

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

Implements L1MuPacking.

Definition at line 92 of file L1MuPacking.h.

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

{ return packed & (1 << (Bits-1)) ? (packed - (1 << Bits) ) : packed;};
template<unsigned int Bits>
virtual unsigned L1MuSignedPacking< Bits >::packedFromIdx ( int  idx) const [inline, virtual]

get the packed notation of a value, check range

Implements L1MuPacking.

Definition at line 94 of file L1MuPacking.h.

References UserOptions_cff::idx.

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

                                                { 
    unsigned maxabs = 1 << (Bits-1) ;
    if (idx < -(int)maxabs && idx >= (int)maxabs) edm::LogWarning("ScaleRangeViolation") 
                                                       << "L1MuSignedPacking::packedFromIdx: warning value " << idx 
                                                       << "exceeds " << Bits << "-bit range !!!";    
    return  ~(~0 << Bits) & (idx < 0 ? (1 << Bits) + idx : idx);
  };
template<unsigned int Bits>
virtual int L1MuSignedPacking< Bits >::signFromPacked ( unsigned  packed) const [inline, virtual]

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

Implements L1MuPacking.

Definition at line 89 of file L1MuPacking.h.

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