File indexing completed on 2024-04-06 12:19:51
0001 #ifndef L1GCTJET_H_
0002 #define L1GCTJET_H_
0003
0004 #include <functional>
0005 #include <vector>
0006 #include <ostream>
0007 #include <memory>
0008
0009 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h"
0010 #include <cstdint>
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 class L1GctJetCand;
0024 class L1GctJetEtCalibrationLut;
0025
0026 class L1GctJet {
0027 public:
0028
0029 enum numberOfBits { kRawsumBitWidth = 10, kRawsumMaxValue = (1 << kRawsumBitWidth) - 1 };
0030
0031
0032 typedef std::shared_ptr<L1GctJetEtCalibrationLut> lutPtr;
0033
0034
0035 L1GctJet(const uint16_t rawsum = 0,
0036 const unsigned eta = 0,
0037 const unsigned phi = 0,
0038 const bool overFlow = false,
0039 const bool forwardJet = true,
0040 const bool tauVeto = true,
0041 const int16_t bx = 0);
0042 ~L1GctJet();
0043
0044
0045 void setRawsum(const uint16_t rawsum) {
0046 m_rawsum = rawsum & kRawsumMaxValue;
0047 m_overFlow |= (rawsum > kRawsumMaxValue);
0048 }
0049 void setDetId(const L1CaloRegionDetId detId) { m_id = detId; }
0050 void setOverFlow(const bool overFlow) { m_overFlow = overFlow; }
0051 void setTauVeto(const bool tauVeto) { m_tauVeto = tauVeto; }
0052 void setForward(const bool forward) { m_forwardJet = forward; }
0053 void setBx(const int16_t bx) { m_bx = bx; }
0054
0055
0056 uint16_t rawsum() const { return m_rawsum; }
0057 L1CaloRegionDetId id() const { return m_id(); }
0058 bool tauVeto() const { return m_tauVeto; }
0059
0060
0061 bool overFlow() const { return m_overFlow; }
0062
0063
0064 bool isTauJet() const { return (!m_forwardJet && !m_tauVeto); }
0065
0066
0067 bool isCentralJet() const { return (!m_forwardJet && m_tauVeto); }
0068
0069
0070 bool isForwardJet() const { return m_forwardJet; }
0071
0072
0073 bool isNullJet() const { return ((m_rawsum == 0) && (globalEta() == 0) && (globalPhi() == 0)); }
0074
0075 friend std::ostream& operator<<(std::ostream& os, const L1GctJet& cand);
0076
0077
0078 bool operator==(const L1GctJet& cand) const;
0079
0080
0081 bool operator!=(const L1GctJet& cand) const;
0082
0083
0084 void setupJet(const uint16_t rawsum,
0085 const unsigned eta,
0086 const unsigned phi,
0087 const bool overFlow,
0088 const bool forwardJet,
0089 const bool tauVeto = true,
0090 const int16_t bx = 0);
0091
0092
0093 unsigned globalEta() const { return m_id.ieta(); }
0094
0095
0096 unsigned globalPhi() const { return m_id.iphi(); }
0097
0098
0099 unsigned rctEta() const { return m_id.rctEta(); }
0100
0101
0102 unsigned rctPhi() const { return m_id.rctPhi(); }
0103
0104
0105 unsigned hwEta() const;
0106
0107
0108 unsigned hwPhi() const;
0109
0110
0111 int16_t bx() const { return m_bx; }
0112
0113
0114 L1GctJetCand jetCand(const lutPtr lut) const;
0115 L1GctJetCand jetCand(const std::vector<lutPtr>& luts) const;
0116
0117
0118 uint16_t rank(const lutPtr lut) const;
0119 unsigned calibratedEt(const lutPtr lut) const;
0120
0121 private:
0122 uint16_t m_rawsum;
0123
0124 L1CaloRegionDetId m_id;
0125 bool m_overFlow;
0126 bool m_forwardJet;
0127 bool m_tauVeto;
0128 int16_t m_bx;
0129
0130 uint16_t lutValue(const lutPtr lut) const;
0131 };
0132
0133 std::ostream& operator<<(std::ostream& os, const L1GctJet& cand);
0134
0135 #endif