CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctInternEmCand.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 
6 
7 using std::ostream;
8 using std::string;
9 using std::hex;
10 using std::dec;
11 
12 // default constructor
14  m_data(0),
15  m_captureBlock(0),
16  m_captureIndex(0),
17  m_iso(false),
18  m_bx(0)
19 {
20 
21 }
22 
23 // construct from raw data (for use in unpacking)
24 L1GctInternEmCand::L1GctInternEmCand(uint16_t data, bool iso, unsigned block, unsigned index, int16_t bx) :
25  m_data(data),
26  m_captureBlock(block&0xfff),
27  m_captureIndex(index&0xff),
28  m_iso(iso),
29  m_bx(bx)
30  {
31 
32  }
33 
34 // construct from eta/phi etc
35 L1GctInternEmCand::L1GctInternEmCand(unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi, bool iso, unsigned block, unsigned index, int16_t bx) :
36  m_data(0), // Over-ridden in construct()
37  m_captureBlock(block&0xfff),
38  m_captureIndex(index&0xff),
39  m_iso(iso),
40  m_bx(bx)
41 {
42  construct(rank, eta, etaSgn, phi);
43  }
44 
45 // destructor
47 
48 // name of candidate type
49 string L1GctInternEmCand::name() const {
50  return (isolated() ? "iso EM" : "non iso EM" );
51 }
52 
53 // was a candidate found
54 bool L1GctInternEmCand::empty() const {
55  return (rank() == 0);
56 }
57 
58 // pretty print
59 ostream& operator<<(ostream& s, const L1GctInternEmCand& cand) {
60  s << "L1GctInternEmCand : ";
61  s << "rank=" << cand.rank();
62  s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex()&0xf) << ", phi=" << cand.phiIndex();
63  s << ", iso=" << cand.isolated();
64  s << " cap block=" << hex << cand.capBlock();
65  s << ", index=" << dec << cand.capIndex() << ", BX=" << cand.bx();
66  return s;
67 }
68 
69 // return region object
71  // get global eta
72  unsigned eta = ( etaSign()==1 ? 10-(etaIndex()&0xf) : 11+(etaIndex()&0xf) );
73  return L1CaloRegionDetId(eta, phiIndex());
74 }
75 
76 // construct from rank, eta, phi
77 void L1GctInternEmCand::construct(unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi) {
78  m_data = (rank & 0x3f) + ((eta & 0xf)<<6) + ((etaSgn & 0x1)<<10) + ((phi & 0x1f)<<11);
79 }
L1CaloRegionDetId regionId() const
region associated with the candidate
int16_t bx() const
get bunch-crossing index
bool empty() const
was an object really found?
virtual ~L1GctInternEmCand()
destructor (virtual to prevent compiler warnings)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
unsigned etaIndex() const
get eta index - Barrel 1:4, Endcap 5:7, HF 8:11
unsigned capBlock() const
which capture block did this come from
void construct(unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi)
bool isolated() const
which stream did this come from
unsigned phiIndex() const
get phi index (0-17)
unsigned capIndex() const
what index within capture block
unsigned etaSign() const
get eta sign (1 for -ve Z, 0 for +ve Z)
std::string name() const
name of object
Geom::Phi< T > phi() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
unsigned rank() const
get rank bits
L1GctInternEmCand()
default constructor (for vector initialisation etc.)
volatile std::atomic< bool > shutdown_flag false