test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctJet.cc
Go to the documentation of this file.
3 
5 
6 
7 
8 L1GctJet::L1GctJet(const uint16_t rawsum, const unsigned eta, const unsigned phi, const bool overFlow,
9  const bool forwardJet, const bool tauVeto, const int16_t bx) :
10  m_rawsum(rawsum & kRawsumMaxValue),
11  m_id(eta, phi),
12  m_overFlow(overFlow || (rawsum>kRawsumMaxValue)),
13  m_forwardJet(forwardJet),
14  m_tauVeto(tauVeto || forwardJet),
15  m_bx(bx)
16 {
17 }
18 
20 {
21 }
22 
23 std::ostream& operator << (std::ostream& os, const L1GctJet& cand)
24 {
25  os << "L1 Gct jet";
26  os << " energy sum " << cand.m_rawsum;
27  if (cand.overFlow()) { os << ", overflow bit set;"; }
28  os << " Eta " << cand.globalEta();
29  os << " Phi " << cand.globalPhi();
30  if (cand.isForwardJet()) { os << ", Forward jet"; }
31  if (cand.isCentralJet()) { os << ", Central jet"; }
32  if (cand.isTauJet()) { os << ", Tau jet"; }
33  if (cand.isNullJet()) { os << ", Null jet"; }
34 
35  return os;
36 }
37 
39 bool L1GctJet::operator== (const L1GctJet& cand) const
40 {
41  bool result=true;
42  result &= (this->rawsum()==cand.rawsum());
43  result &= (this->overFlow()==cand.overFlow());
44  result &= (this->isForwardJet()==cand.isForwardJet());
45  result &= (this->tauVeto()==cand.tauVeto());
46  result &= (this->globalEta()==cand.globalEta());
47  result &= (this->globalPhi()==cand.globalPhi());
48  result |= (this->isNullJet() && cand.isNullJet());
49  return result;
50 }
51 
53 bool L1GctJet::operator!= (const L1GctJet& cand) const
54 {
55  bool result=false;
56  result |= !(this->rawsum()==cand.rawsum());
57  result |= !(this->overFlow()==cand.overFlow());
58  result |= !(this->isForwardJet()==cand.isForwardJet());
59  result |= !(this->tauVeto()==cand.tauVeto());
60  result |= !(this->globalEta()==cand.globalEta());
61  result |= !(this->globalPhi()==cand.globalPhi());
62  result &= !(this->isNullJet() && cand.isNullJet());
63  return result;
64 }
65 
66 void L1GctJet::setupJet(const uint16_t rawsum, const unsigned eta, const unsigned phi, const bool overFlow,
67  const bool forwardJet, const bool tauVeto, const int16_t bx)
68 {
69  L1CaloRegionDetId temp(eta, phi);
70  m_rawsum = rawsum & kRawsumMaxValue;
71  m_id = temp;
72  m_overFlow = (overFlow || rawsum>kRawsumMaxValue);
73  m_forwardJet = forwardJet;
74  m_tauVeto = tauVeto || forwardJet;
75  m_bx = bx;
76 }
77 
79 unsigned L1GctJet::hwEta() const
80 {
81  // Force into 4 bits.
82  // Count eta bins separately for central and forward jets. Set MSB to indicate the Wheel
83  return (((m_id.rctEta() % 7) & 0x7) | (m_id.ieta()<11 ? 0x8 : 0));
84 }
85 
87 unsigned L1GctJet::hwPhi() const
88 {
89  // Force into 5 bits.
90  return m_id.iphi() & 0x1f;
91 }
92 
95 {
96  return L1GctJetCand(rank(lut), hwPhi(), hwEta(), isTauJet(), isForwardJet(), (uint16_t) 0, (uint16_t) 0, m_bx);
97 }
98 
100 L1GctJetCand L1GctJet::jetCand(const std::vector<lutPtr>& luts) const
101 {
103  if (rctEta() < luts.size()) result = jetCand(luts.at(rctEta()));
104  return result;
105 }
106 
108 uint16_t L1GctJet::rank(const lutPtr lut) const
109 {
110  return lutValue(lut);
111 }
112 
113 unsigned L1GctJet::calibratedEt(const lutPtr lut) const
114 {
115  return m_rawsum;
116 }
117 
118 // internal function to find the lut contents for a jet
119 uint16_t L1GctJet::lutValue(const lutPtr lut) const
120 {
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:122
bool tauVeto() const
Definition: L1GctJet.h:56
unsigned hwEta() const
eta value as encoded in hardware at the GCT output
Definition: L1GctJet.cc:79
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:66
unsigned ieta() const
global eta index (0-21)
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:18
unsigned rctEta() const
return local RCT eta index (0-10)
~L1GctJet()
Definition: L1GctJet.cc:19
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
unsigned hwPhi() const
phi value as encoded in hardware at the GCT output
Definition: L1GctJet.cc:87
A Level-1 jet candidate, used within GCT emulation.
Definition: L1GctJet.h:27
uint16_t rank(const lutPtr lut) const
The two separate Lut outputs.
Definition: L1GctJet.cc:108
uint16_t rawsum() const
Definition: L1GctJet.h:54
tuple result
Definition: mps_fire.py:84
int16_t m_bx
Definition: L1GctJet.h:123
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:8
bool isTauJet() const
test whether this jet candidate is a valid tau jet
Definition: L1GctJet.h:62
uint16_t m_rawsum
Definition: L1GctJet.h:117
bool isNullJet() const
test whether this jet candidate has been filled
Definition: L1GctJet.h:71
tuple lut
Definition: lumiPlot.py:244
bool operator==(const L1GctJet &cand) const
test whether two jets are the same
Definition: L1GctJet.cc:39
bool m_forwardJet
Definition: L1GctJet.h:121
m_id("(unknown)")
unsigned calibratedEt(const lutPtr lut) const
Definition: L1GctJet.cc:113
int16_t bx() const
the bunch crossing number
Definition: L1GctJet.h:104
L1CaloRegionDetId m_id
region id, encodes eta and phi
Definition: L1GctJet.h:119
unsigned globalPhi() const
phi value in global CMS coordinates
Definition: L1GctJet.h:89
uint16_t lutValue(const lutPtr lut) const
Definition: L1GctJet.cc:119
unsigned globalEta() const
eta value in global CMS coordinates
Definition: L1GctJet.h:86
boost::shared_ptr< L1GctJetEtCalibrationLut > lutPtr
Definition: L1GctJet.h:38
bool operator!=(const L1GctJet &cand) const
test whether two jets are different
Definition: L1GctJet.cc:53
Geom::Phi< T > phi() const
static const unsigned JET_ENERGY_BITWIDTH
Input bitwidth of jet energy; must be 10 or more.
bool m_overFlow
Definition: L1GctJet.h:120
bool overFlow() const
get overflow
Definition: L1GctJet.h:59
unsigned iphi() const
global phi index (0-17)
bool isForwardJet() const
test whether this jet candidate is a forward jet
Definition: L1GctJet.h:68
unsigned rctEta() const
eta value in global CMS coordinates
Definition: L1GctJet.h:92
bool isCentralJet() const
test whether this jet candidate is a (non-tau) central jet
Definition: L1GctJet.h:65
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:94