File indexing completed on 2024-04-06 12:04:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef DataFormatsL1GlobalMuonTrigger_L1MuRegionalCand_h
0016 #define DataFormatsL1GlobalMuonTrigger_L1MuRegionalCand_h
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 class L1MuRegionalCand {
0027 public:
0028
0029 L1MuRegionalCand(unsigned dataword = 0, int bx = 0);
0030
0031
0032 L1MuRegionalCand(unsigned type_idx,
0033 unsigned phi,
0034 unsigned eta,
0035 unsigned pt,
0036 unsigned charge,
0037 unsigned ch_valid,
0038 unsigned finehalo,
0039 unsigned quality,
0040 int bx);
0041
0042
0043 virtual ~L1MuRegionalCand() {}
0044
0045
0046
0047
0048
0049
0050 virtual bool empty() const {
0051 return (readDataField(PT_START, PT_LENGTH) == 0) || (readDataField(PHI_START, PHI_LENGTH) == 0xff);
0052 }
0053
0054
0055 float phiValue() const;
0056
0057
0058 float etaValue() const;
0059
0060
0061 float ptValue() const;
0062
0063
0064 int chargeValue() const { return readDataField(CHARGE_START, CHARGE_LENGTH) == 0 ? 1 : -1; }
0065
0066
0067 bool chargeValid() const { return charge_valid_packed() == 1; }
0068
0069
0070 bool isFineHalo() const { return finehalo_packed() == 1; }
0071
0072
0073 unsigned int quality() const { return quality_packed(); }
0074
0075
0076 unsigned type_idx() const { return (int)readDataField(TYPE_START, TYPE_LENGTH); };
0077
0078
0079 int bx() const { return m_bx; }
0080
0081
0082
0083
0084
0085
0086 unsigned phi_packed() const { return readDataField(PHI_START, PHI_LENGTH); }
0087
0088
0089 unsigned pt_packed() const { return readDataField(PT_START, PT_LENGTH); }
0090
0091
0092 unsigned int quality_packed() const { return readDataField(QUAL_START, QUAL_LENGTH); }
0093
0094
0095 unsigned eta_packed() const { return readDataField(ETA_START, ETA_LENGTH); }
0096
0097
0098 unsigned finehalo_packed() const { return readDataField(FINEHALO_START, FINEHALO_LENGTH); }
0099
0100
0101 unsigned charge_packed() const { return readDataField(CHARGE_START, CHARGE_LENGTH); }
0102
0103
0104 unsigned charge_valid_packed() const { return readDataField(CHVALID_START, CHVALID_LENGTH); }
0105
0106
0107 unsigned getDataWord() const { return m_dataWord; };
0108
0109
0110
0111
0112
0113
0114 void setType(unsigned type) { writeDataField(TYPE_START, TYPE_LENGTH, type); }
0115
0116
0117 void setBx(int bx) { m_bx = bx; }
0118
0119
0120 void setPhiPacked(unsigned phi) { writeDataField(PHI_START, PHI_LENGTH, phi); }
0121
0122
0123 void setPtPacked(unsigned pt) { writeDataField(PT_START, PT_LENGTH, pt); }
0124
0125
0126 void setQualityPacked(unsigned qual) { writeDataField(QUAL_START, QUAL_LENGTH, qual); }
0127
0128
0129 void setChargePacked(unsigned ch) { writeDataField(CHARGE_START, CHARGE_LENGTH, ch); }
0130
0131
0132 void setChargeValidPacked(unsigned valid) { writeDataField(CHVALID_START, CHVALID_LENGTH, valid); }
0133
0134
0135 void setEtaPacked(unsigned eta) { writeDataField(ETA_START, ETA_LENGTH, eta); }
0136
0137
0138 void setFineHaloPacked(unsigned fh) { writeDataField(FINEHALO_START, FINEHALO_LENGTH, fh); }
0139
0140
0141
0142
0143
0144
0145 void setPhiValue(float phiVal) { m_phiValue = phiVal; }
0146
0147
0148 void setPtValue(float ptVal) { m_ptValue = ptVal; }
0149
0150
0151 void setEtaValue(float etaVal) { m_etaValue = etaVal; }
0152
0153
0154 void setChargeValue(int charge) { writeDataField(CHARGE_START, CHARGE_LENGTH, charge == 1 ? 0 : 1); }
0155
0156
0157 void setChargeValid(bool valid) { writeDataField(CHVALID_START, CHVALID_LENGTH, valid ? 1 : 0); }
0158
0159
0160 void setFineHalo(bool fh) { writeDataField(FINEHALO_START, FINEHALO_LENGTH, fh ? 1 : 0); }
0161
0162
0163 virtual void reset();
0164
0165
0166 void setDataWord(unsigned dataword) { m_dataWord = dataword; }
0167
0168
0169 virtual void print() const;
0170
0171 private:
0172 unsigned readDataField(unsigned start, unsigned count) const;
0173 void writeDataField(unsigned start, unsigned count, unsigned value);
0174
0175 private:
0176 int m_bx;
0177 unsigned m_dataWord;
0178
0179 float m_phiValue;
0180 float m_etaValue;
0181 float m_ptValue;
0182 static const float m_invalidValue;
0183
0184 public:
0185
0186 enum { PHI_START = 0 };
0187 enum { PHI_LENGTH = 8 };
0188 enum { PT_START = 8 };
0189 enum { PT_LENGTH = 5 };
0190 enum { QUAL_START = 13 };
0191 enum { QUAL_LENGTH = 3 };
0192 enum { ETA_START = 16 };
0193 enum { ETA_LENGTH = 6 };
0194 enum { FINEHALO_START = 22 };
0195 enum { FINEHALO_LENGTH = 1 };
0196 enum { CHARGE_START = 23 };
0197 enum { CHARGE_LENGTH = 1 };
0198 enum { CHVALID_START = 24 };
0199 enum {
0200 CHVALID_LENGTH = 1
0201 };
0202
0203
0204 enum { TYPE_START = 30 };
0205 enum {
0206 TYPE_LENGTH = 2
0207 };
0208
0209 };
0210 #endif