CMS 3D CMS Logo

L1GctInternHtMiss.h
Go to the documentation of this file.
1 #ifndef L1GCTINTERNHTMISS_H
2 #define L1GCTINTERNHTMISS_H
3 
4 
13 // C++ headers
14 #include <ostream>
15 #include <cstdint>
16 
18 {
19 
20  public:
21 
28 
29  enum numberOfBits {
30  // TODO - tidy up all these enums.
31  // These numbers of bits are needed to specify data sizes in the emulator
32  // Other masks are below in the private section.
36  };
37 
40 
43 
44 
45  /* Named Constructors */
46 
48  static L1GctInternHtMiss unpackerMissHtx(const uint16_t capBlock,
49  const uint16_t capIndex,
50  const int16_t bx,
51  const uint32_t data);
52 
54  static L1GctInternHtMiss unpackerMissHty(const uint16_t capBlock,
55  const uint16_t capIndex,
56  const int16_t bx,
57  const uint32_t data);
58 
60  static L1GctInternHtMiss unpackerMissHtxHty(const uint16_t capBlock,
61  const uint16_t capIndex,
62  const int16_t bx,
63  const uint32_t data);
64 
65 
67  static L1GctInternHtMiss emulatorJetMissHt(const int htx,
68  const int hty,
69  const bool overFlow,
70  const int16_t bx);
71 
73  static L1GctInternHtMiss emulatorMissHtxHty(const int htx,
74  const int hty,
75  const bool overFlow,
76  const int16_t bx);
77 
79  static L1GctInternHtMiss emulatorMissHtx(const int htx,
80  const bool overFlow,
81  const int16_t bx);
82 
84  static L1GctInternHtMiss emulatorMissHty(const int hty,
85  const bool overFlow,
86  const int16_t bx);
87 
88 
89  /* Metadata */
90 
93 
95  uint16_t capBlock() const { return capBlock_; }
96 
98  uint16_t capIndex() const { return capIndex_; }
99 
101  int16_t bx() const { return bx_; }
102 
104  bool isThereHtx() const { return (type() == miss_htx || type() == miss_htx_and_hty || type() == jf_miss_htx_and_hty); }
105 
107  bool isThereHty() const { return (type() == miss_hty || type() == miss_htx_and_hty || type() == jf_miss_htx_and_hty); }
108 
109 
110  /* Access to the actual data */
111 
113  uint32_t raw() const { return data_; }
114 
116  int16_t htx() const;
117 
119  int16_t hty() const;
120 
122  bool overflow() const;
123 
124 
125  /* Operators */
126 
128  bool operator==(const L1GctInternHtMiss& rhs) const { return (type() == rhs.type() && raw() == rhs.raw()); }
129 
131  bool operator!=(const L1GctInternHtMiss& rhs) const { return !(*this == rhs); }
132 
133 
134  private:
135 
137  enum ShiftsAndMasks { kDoubleComponentHtyShift = 16, // Bit shift for Hty in miss_htx_and_hty
138  kSingleComponentOflowMask = (1 << 30), // Overflow bit mask in miss_htx or miss_hty
139  kDoubleComponentOflowMask = (1 << 15), // Overflow bit mask in miss_htx_and_hty
140  kSingleComponentHtMask = 0xffff, // Ht component mask in miss_htx or miss_hty
141  kDoubleComponentHtMask = 0x3fff, // Ht component mask in miss_htx_and_hty
142  kJetFinderComponentHtMask = 0x0fff, // Ht component mask in jf_miss_htx_and_hty
143  kSingleComponentRawMask = kSingleComponentOflowMask | kSingleComponentHtMask, // To mask off all the non-data bits in raw data (e.g. BC0, etc)
146 
147  /* Private ctors and methods */
148 
151  const uint16_t capBlock,
152  const uint16_t capIndex,
153  const int16_t bx,
154  const uint32_t data);
155 
157 
158  int16_t convert14BitTwosCompTo16Bit(const uint16_t data) const;
159 
160 
161  /* Private data */
162 
165 
166  // source of the data
167  uint16_t capBlock_;
168  uint16_t capIndex_;
169  int16_t bx_;
170 
172  uint32_t data_;
173 };
174 
175 // Pretty-print operator for L1GctInternHtMiss
176 std::ostream& operator<<(std::ostream& os, const L1GctInternHtMiss& rhs);
177 
178 #endif
type
Definition: HCALResponse.h:21
bool operator!=(const L1GctInternHtMiss &rhs) const
Inequality operator.
static L1GctInternHtMiss emulatorMissHty(const int hty, const bool overFlow, const int16_t bx)
Named ctor for making missing Ht y component object from emulator.
bool overflow() const
Get overflow.
bool operator==(const L1GctInternHtMiss &rhs) const
Equality operator.
uint16_t capIndex() const
Get index within capture block.
~L1GctInternHtMiss()
destructor
uint32_t data_
The captured raw data.
L1GctInternHtMissType
Enum for the variants of Internal HtMiss.
bool isThereHty() const
Is there a valid Ht y-component stored?
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)...
L1GctInternHtMiss::L1GctInternHtMissType type() const
&#39;type&#39; of object?
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.
L1GctInternHtMissType type_
&#39;Type&#39; of the data
int16_t hty() const
Get Ht y-component.
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)...
bool isThereHtx() const
Is there a valid Ht x-component stored?
static L1GctInternHtMiss emulatorMissHtx(const int htx, const bool overFlow, const int16_t bx)
Named ctor for making missing Ht x component object from emulator.
uint32_t raw() const
Get the raw data.
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).
L1 GCT internal Ht Miss component(s) Ht_x and/or Ht_y.
uint16_t capBlock() const
Get capture block.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
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.
int16_t convert14BitTwosCompTo16Bit(const uint16_t data) const
Converts 14-bit two&#39;s complement numbers to 16-bit two&#39;s complement (i.e. an int16_t) ...
int16_t bx() const
Get BX number.
ShiftsAndMasks
Useful bit masks and bit shifts.
L1GctInternHtMiss()
default constructor (for vector initialisation etc.)
std::ostream & operator<<(std::ostream &os, const L1GctInternHtMiss &rhs)
int16_t htx() const
Get Ht x-component value.