CMS 3D CMS Logo

EMTFUnpackerTools.h
Go to the documentation of this file.
1 // Tools for unpacking and packing EMTF data
2 
3 #ifndef EventFilter_L1TRawToDigi_EMTFUnpackerTools_h
4 #define EventFilter_L1TRawToDigi_EMTFUnpackerTools_h
5 
6 // Generally useful includes
7 #include <iostream>
8 #include <iomanip> // For things like std::setw
9 #include <array>
15 
16 namespace l1t {
17  namespace stage2 {
18  namespace emtf {
19  namespace L1TMuonEndCap =
20  ::emtf; // use alias 'L1TMuonEndCap' for the namespace 'emtf' used in L1Trigger/L1TMuonEndCap
21 
22  void ImportME(EMTFHit& _hit, const l1t::emtf::ME _ME, const int _endcap, const int _evt_sector);
23  void ImportRPC(EMTFHit& _hit, const l1t::emtf::RPC _RPC, const int _endcap, const int _evt_sector);
24  void ImportSP(EMTFTrack& _track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector);
25 
26  // Integer version of pow() - returns base^exp
27  inline int PowInt(int base, int exp) {
28  if (exp == 0)
29  return 1;
30  if (exp == 1)
31  return base;
32  return base * PowInt(base, exp - 1);
33  }
34 
35  // Compute the two's complement of an integer
36  inline int TwosCompl(int nBits, int bits) {
37  if (bits >> (nBits - 1) == 0)
38  return bits;
39  else
40  return bits - PowInt(2, nBits);
41  };
42 
43  // Get the integer value of specified bits from a 16-bit word (0xffff)
44  inline uint16_t GetHexBits(uint16_t word, uint16_t lowBit, uint16_t highBit) {
45  return ((word >> lowBit) & (PowInt(2, (1 + highBit - lowBit)) - 1));
46  }
47 
48  // Get the integer value of specified bits from a 32-bit word (0xffffffff)
49  inline uint32_t GetHexBits(uint32_t word, uint32_t lowBit, uint32_t highBit) {
50  return ((word >> lowBit) & (PowInt(2, (1 + highBit - lowBit)) - 1));
51  }
52 
53  // Get the integer value of specified bits from two 16-bit words (0xffff, 0xffff)
54  inline uint32_t GetHexBits(
55  uint16_t word1, uint16_t lowBit1, uint16_t highBit1, uint16_t word2, uint16_t lowBit2, uint16_t highBit2) {
56  uint16_t word1_sel = (word1 >> lowBit1) & (PowInt(2, (1 + highBit1 - lowBit1)) - 1);
57  uint16_t word2_sel = (word2 >> lowBit2) & (PowInt(2, (1 + highBit2 - lowBit2)) - 1);
58  return ((word2_sel << (1 + highBit1 - lowBit1)) | word1_sel);
59  }
60 
61  } // End namespace emtf
62  } // End namespace stage2
63 } // End namespace l1t
64 
65 #endif /* define EventFilter_L1TRawToDigi_EMTFUnpackerTools_h */
MessageLogger.h
l1t::stage2::emtf::ImportRPC
void ImportRPC(EMTFHit &_hit, const l1t::emtf::RPC _RPC, const int _endcap, const int _evt_sector)
Definition: EMTFUnpackerTools.cc:37
l1t::emtf::RPC
Definition: RPC.h:11
l1t::emtf::ME
Definition: ME.h:11
EMTFTrack.h
l1t::stage2::emtf::TwosCompl
int TwosCompl(int nBits, int bits)
Definition: EMTFUnpackerTools.h:36
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
TrackTools.h
l1t::emtf::SP
Definition: SP.h:11
emtf
Definition: Event.h:15
EMTFDaqOut.h
l1t::EMTFTrack
Definition: EMTFTrack.h:34
l1t::EMTFHit
Definition: EMTFHit.h:22
l1t
delete x;
Definition: CaloConfig.h:22
EMTFHit.h
SiStripSourceConfigTier0_cff.stage2
stage2
Definition: SiStripSourceConfigTier0_cff.py:71
l1t::stage2::emtf::ImportSP
void ImportSP(EMTFTrack &_track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector)
Definition: EMTFUnpackerTools.cc:63
bits
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
Definition: EventSelector-behavior.doc:35
l1t::stage2::emtf::ImportME
void ImportME(EMTFHit &_hit, const l1t::emtf::ME _ME, const int _endcap, const int _evt_sector)
Definition: EMTFUnpackerTools.cc:8
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92
l1t::stage2::emtf::GetHexBits
uint16_t GetHexBits(uint16_t word, uint16_t lowBit, uint16_t highBit)
Definition: EMTFUnpackerTools.h:44
l1t::stage2::emtf::PowInt
int PowInt(int base, int exp)
Definition: EMTFUnpackerTools.h:27