3 #ifndef EventFilter_L1TRawToDigi_EMTFUnpackerTools_h
4 #define EventFilter_L1TRawToDigi_EMTFUnpackerTools_h
19 namespace L1TMuonEndCap =
33 return base *
PowInt(base, exp - 1);
38 if (bits >> (nBits - 1) == 0)
41 return bits -
PowInt(2, nBits);
45 inline uint16_t
GetHexBits(uint16_t
word, uint16_t lowBit, uint16_t highBit) {
46 return ((word >> lowBit) & (
PowInt(2, (1 + highBit - lowBit)) - 1));
50 inline uint32_t
GetHexBits(uint32_t
word, uint32_t lowBit, uint32_t highBit) {
51 return ((word >> lowBit) & (
PowInt(2, (1 + highBit - lowBit)) - 1));
56 uint16_t word1, uint16_t lowBit1, uint16_t highBit1, uint16_t word2, uint16_t lowBit2, uint16_t highBit2) {
57 uint16_t word1_sel = (word1 >> lowBit1) & (
PowInt(2, (1 + highBit1 - lowBit1)) - 1);
58 uint16_t word2_sel = (word2 >> lowBit2) & (
PowInt(2, (1 + highBit2 - lowBit2)) - 1);
59 return ((word2_sel << (1 + highBit1 - lowBit1)) | word1_sel);
int PowInt(int base, int exp)
void ImportME(EMTFHit &_hit, const l1t::emtf::ME _ME, const int _endcap, const int _evt_sector)
Exp< T >::type exp(const T &t)
void ImportGEM(EMTFHit &_hit, const l1t::emtf::GEM &_GEM, const int _endcap, const int _evt_sector)
void ImportRPC(EMTFHit &_hit, const l1t::emtf::RPC _RPC, const int _endcap, const int _evt_sector)
int TwosCompl(int nBits, int bits)
void ImportSP(EMTFTrack &_track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector)
uint16_t GetHexBits(uint16_t word, uint16_t lowBit, uint16_t highBit)