CMS 3D CMS Logo

L1GctJet.cc
Go to the documentation of this file.
3 
5 
6 L1GctJet::L1GctJet(const uint16_t rawsum,
7  const unsigned eta,
8  const unsigned phi,
9  const bool overFlow,
10  const bool forwardJet,
11  const bool tauVeto,
12  const int16_t bx)
13  : m_rawsum(rawsum & kRawsumMaxValue),
14  m_id(eta, phi),
15  m_overFlow(overFlow || (rawsum > kRawsumMaxValue)),
16  m_forwardJet(forwardJet),
17  m_tauVeto(tauVeto || forwardJet),
18  m_bx(bx) {}
19 
21 
22 std::ostream& operator<<(std::ostream& os, const L1GctJet& cand) {
23  os << "L1 Gct jet";
24  os << " energy sum " << cand.m_rawsum;
25  if (cand.overFlow()) {
26  os << ", overflow bit set;";
27  }
28  os << " Eta " << cand.globalEta();
29  os << " Phi " << cand.globalPhi();
30  if (cand.isForwardJet()) {
31  os << ", Forward jet";
32  }
33  if (cand.isCentralJet()) {
34  os << ", Central jet";
35  }
36  if (cand.isTauJet()) {
37  os << ", Tau jet";
38  }
39  if (cand.isNullJet()) {
40  os << ", Null jet";
41  }
42 
43  return os;
44 }
45 
47 bool L1GctJet::operator==(const L1GctJet& cand) const {
48  bool result = true;
49  result &= (this->rawsum() == cand.rawsum());
50  result &= (this->overFlow() == cand.overFlow());
51  result &= (this->isForwardJet() == cand.isForwardJet());
52  result &= (this->tauVeto() == cand.tauVeto());
53  result &= (this->globalEta() == cand.globalEta());
54  result &= (this->globalPhi() == cand.globalPhi());
55  result |= (this->isNullJet() && cand.isNullJet());
56  return result;
57 }
58 
60 bool L1GctJet::operator!=(const L1GctJet& cand) const {
61  bool result = false;
62  result |= !(this->rawsum() == cand.rawsum());
63  result |= !(this->overFlow() == cand.overFlow());
64  result |= !(this->isForwardJet() == cand.isForwardJet());
65  result |= !(this->tauVeto() == cand.tauVeto());
66  result |= !(this->globalEta() == cand.globalEta());
67  result |= !(this->globalPhi() == cand.globalPhi());
68  result &= !(this->isNullJet() && cand.isNullJet());
69  return result;
70 }
71 
72 void L1GctJet::setupJet(const uint16_t rawsum,
73  const unsigned eta,
74  const unsigned phi,
75  const bool overFlow,
76  const bool forwardJet,
77  const bool tauVeto,
78  const int16_t bx) {
79  L1CaloRegionDetId temp(eta, phi);
80  m_rawsum = rawsum & kRawsumMaxValue;
81  m_id = temp;
82  m_overFlow = (overFlow || rawsum > kRawsumMaxValue);
83  m_forwardJet = forwardJet;
84  m_tauVeto = tauVeto || forwardJet;
85  m_bx = bx;
86 }
87 
89 unsigned L1GctJet::hwEta() const {
90  // Force into 4 bits.
91  // Count eta bins separately for central and forward jets. Set MSB to indicate the Wheel
92  return (((m_id.rctEta() % 7) & 0x7) | (m_id.ieta() < 11 ? 0x8 : 0));
93 }
94 
96 unsigned L1GctJet::hwPhi() const {
97  // Force into 5 bits.
98  return m_id.iphi() & 0x1f;
99 }
100 
103  return L1GctJetCand(rank(lut), hwPhi(), hwEta(), isTauJet(), isForwardJet(), (uint16_t)0, (uint16_t)0, m_bx);
104 }
105 
107 L1GctJetCand L1GctJet::jetCand(const std::vector<lutPtr>& luts) const {
109  if (rctEta() < luts.size())
110  result = jetCand(luts.at(rctEta()));
111  return result;
112 }
113 
115 uint16_t L1GctJet::rank(const lutPtr lut) const { return lutValue(lut); }
116 
117 unsigned L1GctJet::calibratedEt(const lutPtr lut) const { return m_rawsum; }
118 
119 // internal function to find the lut contents for a jet
120 uint16_t L1GctJet::lutValue(const lutPtr lut) const {
121  uint16_t result;
122  if (m_overFlow) {
123  // Set output values to maximum
124  result = 0x3f;
125  } else {
126  unsigned addrBits = m_rawsum;
127  // Set the MSB for tau jets
128  if (!m_tauVeto && !m_forwardJet) {
130  }
131  uint16_t address = static_cast<uint16_t>(addrBits);
132  result = lut->lutValue(address);
133  }
134  return result;
135 }
bool m_tauVeto
Definition: L1GctJet.h:127
bool tauVeto() const
Definition: L1GctJet.h:58
unsigned hwEta() const
eta value as encoded in hardware at the GCT output
Definition: L1GctJet.cc:89
void setupJet(const uint16_t rawsum, const unsigned eta, const unsigned phi, const bool overFlow, const bool forwardJet, const bool tauVeto=true, const int16_t bx=0)
Setup an existing jet all in one go.
Definition: L1GctJet.cc:72
unsigned ieta() const
global eta index (0-21)
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:17
unsigned rctEta() const
return local RCT eta index (0-10)
~L1GctJet()
Definition: L1GctJet.cc:20
unsigned hwPhi() const
phi value as encoded in hardware at the GCT output
Definition: L1GctJet.cc:96
A Level-1 jet candidate, used within GCT emulation.
Definition: L1GctJet.h:26
uint16_t rank(const lutPtr lut) const
The two separate Lut outputs.
Definition: L1GctJet.cc:115
uint16_t rawsum() const
Definition: L1GctJet.h:56
int16_t m_bx
Definition: L1GctJet.h:128
L1GctJet(const uint16_t rawsum=0, const unsigned eta=0, const unsigned phi=0, const bool overFlow=false, const bool forwardJet=true, const bool tauVeto=true, const int16_t bx=0)
Definition: L1GctJet.cc:6
bool isTauJet() const
test whether this jet candidate is a valid tau jet
Definition: L1GctJet.h:64
uint16_t m_rawsum
Definition: L1GctJet.h:122
bool isNullJet() const
test whether this jet candidate has been filled
Definition: L1GctJet.h:73
bool operator==(const L1GctJet &cand) const
test whether two jets are the same
Definition: L1GctJet.cc:47
bool m_forwardJet
Definition: L1GctJet.h:126
unsigned calibratedEt(const lutPtr lut) const
Definition: L1GctJet.cc:117
int16_t bx() const
the bunch crossing number
Definition: L1GctJet.h:111
L1CaloRegionDetId m_id
region id, encodes eta and phi
Definition: L1GctJet.h:124
unsigned globalPhi() const
phi value in global CMS coordinates
Definition: L1GctJet.h:96
uint16_t lutValue(const lutPtr lut) const
Definition: L1GctJet.cc:120
unsigned globalEta() const
eta value in global CMS coordinates
Definition: L1GctJet.h:93
bool operator!=(const L1GctJet &cand) const
test whether two jets are different
Definition: L1GctJet.cc:60
static const unsigned JET_ENERGY_BITWIDTH
Input bitwidth of jet energy; must be 10 or more.
bool m_overFlow
Definition: L1GctJet.h:125
bool overFlow() const
get overflow
Definition: L1GctJet.h:61
unsigned iphi() const
global phi index (0-17)
bool isForwardJet() const
test whether this jet candidate is a forward jet
Definition: L1GctJet.h:70
unsigned rctEta() const
eta value in global CMS coordinates
Definition: L1GctJet.h:99
bool isCentralJet() const
test whether this jet candidate is a (non-tau) central jet
Definition: L1GctJet.h:67
L1GctJetCand jetCand(const lutPtr lut) const
Functions to convert from internal format to external jet candidates at the output of the jetFinder...
Definition: L1GctJet.cc:102
std::shared_ptr< L1GctJetEtCalibrationLut > lutPtr
Definition: L1GctJet.h:32
friend std::ostream & operator<<(std::ostream &os, const L1GctJet &cand)
Definition: L1GctJet.cc:22