CMS 3D CMS Logo

L1GctInternEmCand.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 
6 
7 using std::dec;
8 using std::hex;
9 using std::ostream;
10 using std::string;
11 
12 // default constructor
13 L1GctInternEmCand::L1GctInternEmCand() : m_data(0), m_captureBlock(0), m_captureIndex(0), m_iso(false), m_bx(0) {}
14 
15 // construct from raw data (for use in unpacking)
16 L1GctInternEmCand::L1GctInternEmCand(uint16_t data, bool iso, unsigned block, unsigned index, int16_t bx)
17  : m_data(data), m_captureBlock(block & 0xfff), m_captureIndex(index & 0xff), m_iso(iso), m_bx(bx) {}
18 
19 // construct from eta/phi etc
21  unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi, bool iso, unsigned block, unsigned index, int16_t bx)
22  : m_data(0), // Over-ridden in construct()
23  m_captureBlock(block & 0xfff),
24  m_captureIndex(index & 0xff),
25  m_iso(iso),
26  m_bx(bx) {
27  construct(rank, eta, etaSgn, phi);
28 }
29 
30 // destructor
32 
33 // name of candidate type
34 string L1GctInternEmCand::name() const { return (isolated() ? "iso EM" : "non iso EM"); }
35 
36 // was a candidate found
37 bool L1GctInternEmCand::empty() const { return (rank() == 0); }
38 
39 // pretty print
40 ostream& operator<<(ostream& s, const L1GctInternEmCand& cand) {
41  s << "L1GctInternEmCand : ";
42  s << "rank=" << cand.rank();
43  s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex() & 0xf) << ", phi=" << cand.phiIndex();
44  s << ", iso=" << cand.isolated();
45  s << " cap block=" << hex << cand.capBlock();
46  s << ", index=" << dec << cand.capIndex() << ", BX=" << cand.bx();
47  return s;
48 }
49 
50 // return region object
52  // get global eta
53  unsigned eta = (etaSign() == 1 ? 10 - (etaIndex() & 0xf) : 11 + (etaIndex() & 0xf));
54  return L1CaloRegionDetId(eta, phiIndex());
55 }
56 
57 // construct from rank, eta, phi
58 void L1GctInternEmCand::construct(unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi) {
59  m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((etaSgn & 0x1) << 10) + ((phi & 0x1f) << 11);
60 }
virtual ~L1GctInternEmCand()
destructor (virtual to prevent compiler warnings)
bool isolated() const
which stream did this come from
std::string name() const
name of object
void construct(unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi)
unsigned phiIndex() const
get phi index (0-17)
unsigned rank() const
get rank bits
unsigned etaSign() const
get eta sign (1 for -ve Z, 0 for +ve Z)
bool empty() const
was an object really found?
ostream & operator<<(ostream &s, const L1GctInternEmCand &cand)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
L1GctInternEmCand()
default constructor (for vector initialisation etc.)
unsigned etaIndex() const
get eta index - Barrel 1:4, Endcap 5:7, HF 8:11
L1CaloRegionDetId regionId() const
region associated with the candidate