CMS 3D CMS Logo

L1GctInternHtMiss.h
Go to the documentation of this file.
1 #ifndef L1GCTINTERNHTMISS_H
2 #define L1GCTINTERNHTMISS_H
3 
12 // C++ headers
13 #include <ostream>
14 #include <cstdint>
15 
17 public:
20 
21  enum numberOfBits {
22  // TODO - tidy up all these enums.
23  // These numbers of bits are needed to specify data sizes in the emulator
24  // Other masks are below in the private section.
28  };
29 
32 
35 
36  /* Named Constructors */
37 
39  static L1GctInternHtMiss unpackerMissHtx(const uint16_t capBlock,
40  const uint16_t capIndex,
41  const int16_t bx,
42  const uint32_t data);
43 
45  static L1GctInternHtMiss unpackerMissHty(const uint16_t capBlock,
46  const uint16_t capIndex,
47  const int16_t bx,
48  const uint32_t data);
49 
51  static L1GctInternHtMiss unpackerMissHtxHty(const uint16_t capBlock,
52  const uint16_t capIndex,
53  const int16_t bx,
54  const uint32_t data);
55 
57  static L1GctInternHtMiss emulatorJetMissHt(const int htx, const int hty, const bool overFlow, const int16_t bx);
58 
60  static L1GctInternHtMiss emulatorMissHtxHty(const int htx, const int hty, const bool overFlow, const int16_t bx);
61 
63  static L1GctInternHtMiss emulatorMissHtx(const int htx, const bool overFlow, const int16_t bx);
64 
66  static L1GctInternHtMiss emulatorMissHty(const int hty, const bool overFlow, const int16_t bx);
67 
68  /* Metadata */
69 
72 
74  uint16_t capBlock() const { return capBlock_; }
75 
77  uint16_t capIndex() const { return capIndex_; }
78 
80  int16_t bx() const { return bx_; }
81 
83  bool isThereHtx() const {
84  return (type() == miss_htx || type() == miss_htx_and_hty || type() == jf_miss_htx_and_hty);
85  }
86 
88  bool isThereHty() const {
89  return (type() == miss_hty || type() == miss_htx_and_hty || type() == jf_miss_htx_and_hty);
90  }
91 
92  /* Access to the actual data */
93 
95  uint32_t raw() const { return data_; }
96 
98  int16_t htx() const;
99 
101  int16_t hty() const;
102 
104  bool overflow() const;
105 
106  /* Operators */
107 
109  bool operator==(const L1GctInternHtMiss& rhs) const { return (type() == rhs.type() && raw() == rhs.raw()); }
110 
112  bool operator!=(const L1GctInternHtMiss& rhs) const { return !(*this == rhs); }
113 
114 private:
117  kDoubleComponentHtyShift = 16, // Bit shift for Hty in miss_htx_and_hty
118  kSingleComponentOflowMask = (1 << 30), // Overflow bit mask in miss_htx or miss_hty
119  kDoubleComponentOflowMask = (1 << 15), // Overflow bit mask in miss_htx_and_hty
120  kSingleComponentHtMask = 0xffff, // Ht component mask in miss_htx or miss_hty
121  kDoubleComponentHtMask = 0x3fff, // Ht component mask in miss_htx_and_hty
122  kJetFinderComponentHtMask = 0x0fff, // Ht component mask in jf_miss_htx_and_hty
124  kSingleComponentHtMask, // To mask off all the non-data bits in raw data (e.g. BC0, etc)
127  };
128 
129  /* Private ctors and methods */
130 
133  const uint16_t capBlock,
134  const uint16_t capIndex,
135  const int16_t bx,
136  const uint32_t data);
137 
139 
140  int16_t convert14BitTwosCompTo16Bit(const uint16_t data) const;
141 
142  /* Private data */
143 
146 
147  // source of the data
148  uint16_t capBlock_;
149  uint16_t capIndex_;
150  int16_t bx_;
151 
153  uint32_t data_;
154 };
155 
156 // Pretty-print operator for L1GctInternHtMiss
157 std::ostream& operator<<(std::ostream& os, const L1GctInternHtMiss& rhs);
158 
159 #endif
L1GctInternHtMiss::kJetMissHtNBits
Definition: L1GctInternHtMiss.h:25
L1GctInternHtMiss::miss_htx
Definition: L1GctInternHtMiss.h:19
L1GctInternHtMiss::L1GctInternHtMiss
L1GctInternHtMiss()
default constructor (for vector initialisation etc.)
Definition: L1GctInternHtMiss.cc:6
L1GctInternHtMiss::kDoubleComponentHtMask
Definition: L1GctInternHtMiss.h:121
L1GctInternHtMiss::capIndex_
uint16_t capIndex_
Definition: L1GctInternHtMiss.h:149
operator<<
std::ostream & operator<<(std::ostream &os, const L1GctInternHtMiss &rhs)
Definition: L1GctInternHtMiss.cc:135
L1GctInternHtMiss::overflow
bool overflow() const
Get overflow.
Definition: L1GctInternHtMiss.cc:104
L1GctInternHtMiss::convert14BitTwosCompTo16Bit
int16_t convert14BitTwosCompTo16Bit(const uint16_t data) const
Converts 14-bit two's complement numbers to 16-bit two's complement (i.e. an int16_t)
Definition: L1GctInternHtMiss.cc:123
L1GctInternHtMiss::data_
uint32_t data_
The captured raw data.
Definition: L1GctInternHtMiss.h:153
L1GctInternHtMiss::jf_miss_htx_and_hty
Definition: L1GctInternHtMiss.h:19
L1GctInternHtMiss::emulatorMissHty
static L1GctInternHtMiss emulatorMissHty(const int hty, const bool overFlow, const int16_t bx)
Named ctor for making missing Ht y component object from emulator.
Definition: L1GctInternHtMiss.cc:73
L1GctInternHtMiss::numberOfBits
numberOfBits
Definition: L1GctInternHtMiss.h:21
L1GctInternHtMiss::~L1GctInternHtMiss
~L1GctInternHtMiss()
destructor
Definition: L1GctInternHtMiss.cc:9
L1GctInternHtMiss::type_
L1GctInternHtMissType type_
'Type' of the data
Definition: L1GctInternHtMiss.h:145
L1GctInternHtMiss
L1 GCT internal Ht Miss component(s) Ht_x and/or Ht_y.
Definition: L1GctInternHtMiss.h:16
L1GctInternHtMiss::emulatorJetMissHt
static L1GctInternHtMiss emulatorJetMissHt(const int htx, const int hty, const bool overFlow, const int16_t bx)
Named ctor for making missing Ht x & y components object from emulator (jetFinder output).
Definition: L1GctInternHtMiss.cc:36
L1GctInternHtMiss::unpackerMissHtxHty
static L1GctInternHtMiss unpackerMissHtxHty(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
Named ctor for making missing Ht x & y components object from unpacker raw data (wheel input).
Definition: L1GctInternHtMiss.cc:28
L1GctInternHtMiss::type
L1GctInternHtMiss::L1GctInternHtMissType type() const
'type' of object?
Definition: L1GctInternHtMiss.h:71
L1GctInternHtMiss::isThereHtx
bool isThereHtx() const
Is there a valid Ht x-component stored?
Definition: L1GctInternHtMiss.h:83
L1GctInternHtMiss::kSingleComponentRawMask
Definition: L1GctInternHtMiss.h:123
L1GctInternHtMiss::unpackerMissHty
static L1GctInternHtMiss unpackerMissHty(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
Named ctor for making missing Ht y-component object from unpacker raw data.
Definition: L1GctInternHtMiss.cc:20
L1GctInternHtMiss::hty
int16_t hty() const
Get Ht y-component.
Definition: L1GctInternHtMiss.cc:93
L1GctInternHtMiss::kSingleComponentHtMask
Definition: L1GctInternHtMiss.h:120
L1GctInternHtMiss::capBlock
uint16_t capBlock() const
Get capture block.
Definition: L1GctInternHtMiss.h:74
L1GctInternHtMiss::kSingleComponentOflowMask
Definition: L1GctInternHtMiss.h:118
L1GctInternHtMiss::operator==
bool operator==(const L1GctInternHtMiss &rhs) const
Equality operator.
Definition: L1GctInternHtMiss.h:109
L1GctInternHtMiss::L1GctInternHtMissType
L1GctInternHtMissType
Enum for the variants of Internal HtMiss.
Definition: L1GctInternHtMiss.h:19
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
L1GctInternHtMiss::kDoubleComponentOflowMask
Definition: L1GctInternHtMiss.h:119
L1GctInternHtMiss::bx
int16_t bx() const
Get BX number.
Definition: L1GctInternHtMiss.h:80
L1GctInternHtMiss::bx_
int16_t bx_
Definition: L1GctInternHtMiss.h:150
L1GctInternHtMiss::kMissHxAndHyNBits
Definition: L1GctInternHtMiss.h:26
L1GctInternHtMiss::isThereHty
bool isThereHty() const
Is there a valid Ht y-component stored?
Definition: L1GctInternHtMiss.h:88
L1GctInternHtMiss::htx
int16_t htx() const
Get Ht x-component value.
Definition: L1GctInternHtMiss.cc:82
L1GctInternHtMiss::miss_hty
Definition: L1GctInternHtMiss.h:19
L1GctInternHtMiss::kJetFinderComponentHtMask
Definition: L1GctInternHtMiss.h:122
L1GctInternHtMiss::raw
uint32_t raw() const
Get the raw data.
Definition: L1GctInternHtMiss.h:95
L1GctInternHtMiss::emulatorMissHtx
static L1GctInternHtMiss emulatorMissHtx(const int htx, const bool overFlow, const int16_t bx)
Named ctor for making missing Ht x component object from emulator.
Definition: L1GctInternHtMiss.cc:64
L1GctInternHtMiss::operator!=
bool operator!=(const L1GctInternHtMiss &rhs) const
Inequality operator.
Definition: L1GctInternHtMiss.h:112
L1GctInternHtMiss::nulltype
Definition: L1GctInternHtMiss.h:19
L1GctInternHtMiss::capBlock_
uint16_t capBlock_
Definition: L1GctInternHtMiss.h:148
L1GctInternHtMiss::emulatorMissHtxHty
static L1GctInternHtMiss emulatorMissHtxHty(const int htx, const int hty, const bool overFlow, const int16_t bx)
Named ctor for making missing Ht x & y components object from emulator (wheel input).
Definition: L1GctInternHtMiss.cc:50
L1GctInternHtMiss::capIndex
uint16_t capIndex() const
Get index within capture block.
Definition: L1GctInternHtMiss.h:77
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
L1GctInternHtMiss::kDoubleComponentHtyShift
Definition: L1GctInternHtMiss.h:117
L1GctInternHtMiss::kMissHxOrHyNBits
Definition: L1GctInternHtMiss.h:27
L1GctInternHtMiss::miss_htx_and_hty
Definition: L1GctInternHtMiss.h:19
L1GctInternHtMiss::ShiftsAndMasks
ShiftsAndMasks
Useful bit masks and bit shifts.
Definition: L1GctInternHtMiss.h:116
L1GctInternHtMiss::kDoubleComponentRawMask
Definition: L1GctInternHtMiss.h:125
L1GctInternHtMiss::unpackerMissHtx
static L1GctInternHtMiss unpackerMissHtx(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
Named ctor for making missing Ht x-component object from unpacker raw data.
Definition: L1GctInternHtMiss.cc:12