CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctEmCand.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 
5 
6 using std::ostream;
7 using std::string;
8 using std::hex;
9 using std::dec;
10 
11 // default constructor
13  m_data(0),
14  m_iso(false),
15  m_captureBlock(0),
16  m_captureIndex(0),
17  m_bx(0)
18 {
19 
20 }
21 
22 // construct from raw data, no source (i.e. no capBlock/capIndex); used in GT
23 L1GctEmCand::L1GctEmCand(uint16_t rawData, bool iso) :
24  m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored
25  m_iso(iso),
26  m_captureBlock(0),
27  m_captureIndex(0),
28  m_bx(0)
29 {
30 
31 }
32 
33 // construct from raw data with source - used in GCT unpacker
34  L1GctEmCand::L1GctEmCand(uint16_t rawData, bool iso, uint16_t block, uint16_t index, int16_t bx) :
35  m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored
36  m_iso(iso),
37  m_captureBlock(block&0xfff),
38  m_captureIndex(index&0xff),
39  m_bx(bx)
40 {
41 
42 }
43 
44 // construct from content - used in GCT emulator
45 // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
46 L1GctEmCand::L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso) :
47  m_data(0), // override below
48  m_iso(iso),
49  m_captureBlock(0),
50  m_captureIndex(0),
51  m_bx(0)
52 
53 {
54  construct(rank, eta, phi);
55 }
56 
57 // construct from content, with source (i.e. capBlock/capIndex); will be used in GCT emulator one day?
58 // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
59 L1GctEmCand::L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso, uint16_t block, uint16_t index, int16_t bx) :
60  m_data(0), // override below
61  m_iso(iso),
62  m_captureBlock(block&0xfff),
63  m_captureIndex(index&0xff),
64  m_bx(bx)
65 {
66  construct(rank, eta, phi);
67 }
68 
69 // construct from RCT output candidate
71  m_data(0), // override below
72  m_iso(c.isolated()),
73  m_captureBlock(0),
74  m_captureIndex(0),
75  m_bx(c.bx())
76 {
77  unsigned eta=((c.regionId().rctEta() & 0x7) | (c.regionId().ieta()<11 ? 0x8 : 0x0));
78  construct(c.rank(), eta, c.regionId().iphi());
79 }
80 
81 // destructor
83 
84 // name of candidate type
85 string L1GctEmCand::name() const {
86  return (isolated() ? "iso EM" : "non iso EM" );
87 }
88 
89 
90 
91 // return region object
93  // get global eta
94  unsigned eta = ( etaSign()==1 ? 10-(etaIndex()&0x7) : 11+(etaIndex()&0x7) );
95  return L1CaloRegionDetId(eta, phiIndex());
96 }
97 
98 // construct from rank, eta, phi
99 void L1GctEmCand::construct(unsigned rank, unsigned eta, unsigned phi) {
100  if (rank>0) {
101  m_data = (rank & 0x3f) + ((eta & 0xf)<<6) + ((phi & 0x1f)<<10);
102  } else {
103  // Default values for zero rank electrons,
104  // different in hardware for positive and negative eta
105  if ((eta & 0x8)==0) { m_data = 0x7000; } else { m_data = 0x7400; }
106  }
107 }
108 
109 // pretty print
110 ostream& operator<<(ostream& s, const L1GctEmCand& cand) {
111  s << "L1GctEmCand : ";
112  s << "rank=" << cand.rank();
113  s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex()&0x7) << ", phi=" << cand.phiIndex();
114  s << ", iso=" << cand.isolated();
115  s << hex << " cap block=" << cand.capBlock() << dec << ", index=" << cand.capIndex() << ", BX=" << cand.bx();
116  return s;
117 }
118 
119 
unsigned capIndex() const
what index within capture block
Definition: L1GctEmCand.h:79
unsigned etaSign() const
get eta sign (1 for -ve Z, 0 for +ve Z)
Definition: L1GctEmCand.h:67
unsigned ieta() const
global eta index (0-21)
unsigned rank() const
get rank bits
Definition: L1GctEmCand.h:61
unsigned rctEta() const
return local RCT eta index (0-10)
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:18
unsigned phiIndex() const
get phi index (0-17)
Definition: L1GctEmCand.h:70
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:22
uint16_t m_data
Definition: L1GctEmCand.h:98
void construct(unsigned rank, unsigned eta, unsigned phi)
Definition: L1GctEmCand.cc:99
L1CaloRegionDetId regionId() const
get DetID object
Definition: L1CaloEmCand.h:65
L1CaloRegionDetId regionId() const
region associated with the candidate
Definition: L1GctEmCand.cc:92
unsigned rank() const
get rank bits
Definition: L1CaloEmCand.h:44
unsigned etaIndex() const
get eta index -6 to -0, +0 to +6 (bit 3 is sign, 1 for -ve Z, 0 for +ve Z)
Definition: L1GctEmCand.h:64
std::string name() const
name of object
Definition: L1GctEmCand.cc:85
virtual ~L1GctEmCand()
destructor (virtual to prevent compiler warnings)
Definition: L1GctEmCand.cc:82
L1GctEmCand()
default constructor (for vector initialisation etc.)
Definition: L1GctEmCand.cc:12
bool isolated() const
which stream did this come from
Definition: L1GctEmCand.h:73
Geom::Phi< T > phi() const
int16_t bx() const
get bunch-crossing index
Definition: L1GctEmCand.h:82
unsigned iphi() const
global phi index (0-17)
volatile std::atomic< bool > shutdown_flag false
unsigned capBlock() const
which capture block did this come from
Definition: L1GctEmCand.h:76