File indexing completed on 2024-04-06 12:04:26
0001 #ifndef L1GCTINTERNHTMISS_H
0002 #define L1GCTINTERNHTMISS_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <ostream>
0014 #include <cstdint>
0015
0016 class L1GctInternHtMiss {
0017 public:
0018
0019 enum L1GctInternHtMissType { nulltype, miss_htx, miss_hty, miss_htx_and_hty, jf_miss_htx_and_hty };
0020
0021 enum numberOfBits {
0022
0023
0024
0025 kJetMissHtNBits = 12,
0026 kMissHxAndHyNBits = 14,
0027 kMissHxOrHyNBits = 16
0028 };
0029
0030
0031 L1GctInternHtMiss();
0032
0033
0034 ~L1GctInternHtMiss();
0035
0036
0037
0038
0039 static L1GctInternHtMiss unpackerMissHtx(const uint16_t capBlock,
0040 const uint16_t capIndex,
0041 const int16_t bx,
0042 const uint32_t data);
0043
0044
0045 static L1GctInternHtMiss unpackerMissHty(const uint16_t capBlock,
0046 const uint16_t capIndex,
0047 const int16_t bx,
0048 const uint32_t data);
0049
0050
0051 static L1GctInternHtMiss unpackerMissHtxHty(const uint16_t capBlock,
0052 const uint16_t capIndex,
0053 const int16_t bx,
0054 const uint32_t data);
0055
0056
0057 static L1GctInternHtMiss emulatorJetMissHt(const int htx, const int hty, const bool overFlow, const int16_t bx);
0058
0059
0060 static L1GctInternHtMiss emulatorMissHtxHty(const int htx, const int hty, const bool overFlow, const int16_t bx);
0061
0062
0063 static L1GctInternHtMiss emulatorMissHtx(const int htx, const bool overFlow, const int16_t bx);
0064
0065
0066 static L1GctInternHtMiss emulatorMissHty(const int hty, const bool overFlow, const int16_t bx);
0067
0068
0069
0070
0071 L1GctInternHtMiss::L1GctInternHtMissType type() const { return type_; }
0072
0073
0074 uint16_t capBlock() const { return capBlock_; }
0075
0076
0077 uint16_t capIndex() const { return capIndex_; }
0078
0079
0080 int16_t bx() const { return bx_; }
0081
0082
0083 bool isThereHtx() const {
0084 return (type() == miss_htx || type() == miss_htx_and_hty || type() == jf_miss_htx_and_hty);
0085 }
0086
0087
0088 bool isThereHty() const {
0089 return (type() == miss_hty || type() == miss_htx_and_hty || type() == jf_miss_htx_and_hty);
0090 }
0091
0092
0093
0094
0095 uint32_t raw() const { return data_; }
0096
0097
0098 int16_t htx() const;
0099
0100
0101 int16_t hty() const;
0102
0103
0104 bool overflow() const;
0105
0106
0107
0108
0109 bool operator==(const L1GctInternHtMiss& rhs) const { return (type() == rhs.type() && raw() == rhs.raw()); }
0110
0111
0112 bool operator!=(const L1GctInternHtMiss& rhs) const { return !(*this == rhs); }
0113
0114 private:
0115
0116 enum ShiftsAndMasks {
0117 kDoubleComponentHtyShift = 16,
0118 kSingleComponentOflowMask = (1 << 30),
0119 kDoubleComponentOflowMask = (1 << 15),
0120 kSingleComponentHtMask = 0xffff,
0121 kDoubleComponentHtMask = 0x3fff,
0122 kJetFinderComponentHtMask = 0x0fff,
0123 kSingleComponentRawMask = kSingleComponentOflowMask |
0124 kSingleComponentHtMask,
0125 kDoubleComponentRawMask =
0126 (kDoubleComponentHtMask << kDoubleComponentHtyShift) | kDoubleComponentOflowMask | kDoubleComponentHtMask
0127 };
0128
0129
0130
0131
0132 L1GctInternHtMiss(const L1GctInternHtMissType type,
0133 const uint16_t capBlock,
0134 const uint16_t capIndex,
0135 const int16_t bx,
0136 const uint32_t data);
0137
0138
0139
0140 int16_t convert14BitTwosCompTo16Bit(const uint16_t data) const;
0141
0142
0143
0144
0145 L1GctInternHtMissType type_;
0146
0147
0148 uint16_t capBlock_;
0149 uint16_t capIndex_;
0150 int16_t bx_;
0151
0152
0153 uint32_t data_;
0154 };
0155
0156
0157 std::ostream& operator<<(std::ostream& os, const L1GctInternHtMiss& rhs);
0158
0159 #endif