File indexing completed on 2024-09-07 04:35:55
0001 #ifndef __l1t_regional_muon_candidate_h__
0002 #define __l1t_regional_muon_candidate_h__
0003
0004 #include "RegionalMuonCandFwd.h"
0005 #include <map>
0006
0007 namespace l1t {
0008 class RegionalMuonCand {
0009 public:
0010
0011
0012 enum bmtfAddress {
0013 kWheelSide = 0,
0014 kWheelNum = 1,
0015 kStat1 = 2,
0016 kStat2 = 3,
0017 kStat3 = 4,
0018 kStat4 = 5,
0019 kSegSelStat1 = 6,
0020 kSegSelStat2 = 7,
0021 kSegSelStat3 = 8,
0022 kSegSelStat4 = 9,
0023 kNumBmtfSubAddr = 10
0024 };
0025
0026
0027 enum omtfAddress { kLayers = 0, kZero = 1, kWeight = 2, kNumOmtfSubAddr = 3 };
0028
0029
0030 enum emtfAddress {
0031 kME1Seg = 0,
0032 kME1Ch = 1,
0033 kME2Seg = 2,
0034 kME2Ch = 3,
0035 kME3Seg = 4,
0036 kME3Ch = 5,
0037 kME4Seg = 6,
0038 kME4Ch = 7,
0039 kTrkNum = 8,
0040 kBX = 9,
0041 kNumEmtfSubAddr = 10
0042 };
0043
0044 explicit RegionalMuonCand(uint64_t dataword);
0045
0046 RegionalMuonCand()
0047 : m_hwPt(0),
0048 m_hwPtUnconstrained(0),
0049 m_hwDXY(0),
0050 m_hwPhi(0),
0051 m_hwEta(0),
0052 m_hwHF(false),
0053 m_hwSign(0),
0054 m_hwSignValid(0),
0055 m_hwQuality(0),
0056 m_dataword(0) {
0057 setTFIdentifiers(0, bmtf);
0058 };
0059
0060 RegionalMuonCand(int pt, int phi, int eta, int sign, int signvalid, int quality, int processor, tftype trackFinder)
0061 : m_hwPt(pt),
0062 m_hwPtUnconstrained(0),
0063 m_hwDXY(0),
0064 m_hwPhi(phi),
0065 m_hwEta(eta),
0066 m_hwHF(false),
0067 m_hwSign(sign),
0068 m_hwSignValid(signvalid),
0069 m_hwQuality(quality),
0070 m_dataword(0) {
0071 setTFIdentifiers(processor, trackFinder);
0072
0073 if (trackFinder == tftype::bmtf) {
0074 m_trackAddress = {{kWheelSide, 0},
0075 {kWheelNum, 0},
0076 {kStat1, 0},
0077 {kStat2, 0},
0078 {kStat3, 0},
0079 {kStat4, 0},
0080 {kSegSelStat1, 0},
0081 {kSegSelStat2, 0},
0082 {kSegSelStat3, 0},
0083 {kSegSelStat4, 0}};
0084 } else if (trackFinder == tftype::omtf_pos || trackFinder == tftype::omtf_neg) {
0085 m_trackAddress = {{kLayers, 0}, {kZero, 0}, {kWeight, 0}};
0086 } else if (trackFinder == tftype::emtf_pos || trackFinder == tftype::emtf_neg) {
0087 m_trackAddress = {{kME1Seg, 0},
0088 {kME1Ch, 0},
0089 {kME2Seg, 0},
0090 {kME2Ch, 0},
0091 {kME3Seg, 0},
0092 {kME3Ch, 0},
0093 {kME4Seg, 0},
0094 {kME4Ch, 0},
0095 {kTrkNum, 0},
0096 {kBX, 0}};
0097 }
0098 };
0099
0100 RegionalMuonCand(int pt,
0101 int phi,
0102 int eta,
0103 int sign,
0104 int signvalid,
0105 int quality,
0106 int processor,
0107 tftype trackFinder,
0108 std::map<int, int> trackAddress)
0109 : m_hwPt(pt),
0110 m_hwPtUnconstrained(0),
0111 m_hwDXY(0),
0112 m_hwPhi(phi),
0113 m_hwEta(eta),
0114 m_hwHF(false),
0115 m_hwSign(sign),
0116 m_hwSignValid(signvalid),
0117 m_hwQuality(quality),
0118 m_trackAddress(trackAddress),
0119 m_dataword(0) {
0120 setTFIdentifiers(processor, trackFinder);
0121 };
0122
0123 virtual ~RegionalMuonCand() {}
0124
0125
0126 void setHwPt(int bits) { m_hwPt = bits; };
0127
0128 void setHwPtUnconstrained(int bits) { m_hwPtUnconstrained = bits; };
0129
0130 void setHwDXY(int bits) { m_hwDXY = bits; };
0131
0132 void setHwPhi(int bits) { m_hwPhi = bits; };
0133
0134 void setHwEta(int bits) { m_hwEta = bits; };
0135
0136 void setHwSign(int bits) { m_hwSign = bits; };
0137
0138 void setHwSignValid(int bits) { m_hwSignValid = bits; };
0139
0140 void setHwQual(int bits) { m_hwQuality = bits; };
0141
0142 void setHwHF(bool bit) { m_hwHF = bit; };
0143
0144 void setTFIdentifiers(int processor, tftype trackFinder);
0145
0146 void setLink(int link) { m_link = link; };
0147
0148 void setMuIdx(int muIdx) { m_muIdx = muIdx; };
0149
0150 void setDataword(uint32_t msbs, uint32_t lsbs) { m_dataword = (((uint64_t)msbs) << 32) + lsbs; };
0151
0152 void setDataword(uint64_t bits) { m_dataword = bits; };
0153
0154 void setTrackSubAddress(bmtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; }
0155
0156 void setTrackSubAddress(omtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; }
0157
0158 void setTrackSubAddress(emtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; }
0159
0160 void setTrackAddress(const std::map<int, int>& address) { m_trackAddress = address; }
0161
0162
0163 const int hwPt() const { return m_hwPt; };
0164
0165 const int hwPtUnconstrained() const { return m_hwPtUnconstrained; };
0166
0167 const int hwDXY() const { return m_hwDXY; };
0168
0169 const int hwPhi() const { return m_hwPhi; };
0170
0171 const int hwEta() const { return m_hwEta; };
0172
0173 const int hwSign() const { return m_hwSign; };
0174
0175 const int hwSignValid() const { return m_hwSignValid; };
0176
0177 const int hwQual() const { return m_hwQuality; };
0178
0179 const int link() const { return m_link; };
0180
0181 const int muIdx() const { return m_muIdx; };
0182
0183 const int processor() const { return m_processor; };
0184
0185 const tftype trackFinderType() const { return m_trackFinder; };
0186
0187 const int hwHF() const { return m_hwHF; };
0188
0189 const uint64_t dataword() const { return m_dataword; };
0190
0191 const uint32_t dataword32Msb() const { return (uint32_t)((m_dataword >> 32) & 0xFFFFFFFF); };
0192
0193 const uint32_t dataword32Lsb() const { return (uint32_t)(m_dataword & 0xFFFFFFFF); };
0194
0195 const std::map<int, int>& trackAddress() const { return m_trackAddress; }
0196
0197 int trackSubAddress(bmtfAddress subAddress) const { return m_trackAddress.at(subAddress); }
0198
0199 int trackSubAddress(omtfAddress subAddress) const { return m_trackAddress.at(subAddress); }
0200
0201 int trackSubAddress(emtfAddress subAddress) const { return m_trackAddress.at(subAddress); }
0202
0203 bool operator==(const RegionalMuonCand& rhs) const;
0204 inline bool operator!=(const RegionalMuonCand& rhs) const { return !(operator==(rhs)); };
0205
0206 private:
0207 int m_hwPt;
0208 int m_hwPtUnconstrained;
0209 int m_hwDXY;
0210 int m_hwPhi;
0211 int m_hwEta;
0212 bool m_hwHF;
0213 int m_hwSign;
0214 int m_hwSignValid;
0215 int m_hwQuality;
0216 int m_link;
0217 int m_processor;
0218 tftype m_trackFinder;
0219 std::map<int, int> m_trackAddress;
0220
0221
0222 uint64_t m_dataword;
0223 int m_muIdx{-1};
0224 };
0225
0226 }
0227
0228 #endif