CMS 3D CMS Logo

L1GctJetCand.cc
Go to the documentation of this file.
1 
2 
4 
5 using std::dec;
6 using std::hex;
7 using std::ostream;
8 using std::string;
9 
11  : m_data(0), m_isTau(false), m_isFor(false), m_captureBlock(0), m_captureIndex(0), m_bx(0) {}
12 
13 //constructor for GT
14 L1GctJetCand::L1GctJetCand(uint16_t rawData, bool isTau, bool isFor)
15  : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored
16  m_isTau(isTau),
17  m_isFor(isFor),
18  m_captureBlock(0),
19  m_captureIndex(0),
20  m_bx(0) {}
21 
22 //constructor for GCT unpacker
23 L1GctJetCand::L1GctJetCand(uint16_t rawData, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx)
24  : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored
25  m_isTau(isTau),
26  m_isFor(isFor),
27  m_captureBlock(block & 0xfff),
28  m_captureIndex(index & 0xff),
29  m_bx(bx) {}
30 
31 // constructor for use in emulator
32 // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
33 L1GctJetCand::L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor)
34  : m_data(0), // overridden below
35  m_isTau(isTau),
36  m_isFor(isFor),
37  m_captureBlock(0),
38  m_captureIndex(0),
39  m_bx(0) {
40  m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((phi & 0x1f) << 10);
41 }
42 
43 // constructor for use in emulator
44 // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
46  unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx)
47  : m_data(0), // overridden below
48  m_isTau(isTau),
49  m_isFor(isFor),
50  m_captureBlock(block & 0xfff),
51  m_captureIndex(index & 0xff),
52  m_bx(bx) {
53  m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((phi & 0x1f) << 10);
54 }
55 
57 
58 // return name
59 string L1GctJetCand::name() const {
60  if (m_isTau) {
61  return "tau jet";
62  } else if (m_isFor) {
63  return "forward jet";
64  } else {
65  return "central jet";
66  }
67 }
68 
69 // pretty print
70 ostream& operator<<(ostream& s, const L1GctJetCand& cand) {
71  if (cand.empty()) {
72  s << "L1GctJetCand empty jet";
73  } else {
74  s << "L1GctJetCand : ";
75  s << "rank=" << cand.rank();
76  s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex() & 0x7) << ", phi=" << cand.phiIndex();
77  s << " type=";
78  if (cand.isTau()) {
79  s << "tau";
80  } else if (cand.isForward()) {
81  s << "forward";
82  } else {
83  s << "central";
84  }
85  }
86  s << hex << " cap block=" << cand.capBlock() << dec << ", index=" << cand.capIndex() << ", BX=" << cand.bx();
87  return s;
88 }
89 
91  // get global eta
92  unsigned eta;
93  if (!isForward()) {
94  eta = (etaSign() == 1 ? 10 - (etaIndex() & 0x7) : (etaIndex() & 0x7) + 11);
95  } else {
96  eta = (etaSign() == 1 ? 3 - (etaIndex() & 0x7) : (etaIndex() & 0x7) + 18);
97  }
98 
99  return L1CaloRegionDetId(eta, phiIndex());
100 }
L1CaloRegionDetId regionId() const override
region associated with the candidate
Definition: L1GctJetCand.cc:90
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:17
std::string name() const
name of object
Definition: L1GctJetCand.cc:59
~L1GctJetCand() override
destructor (virtual to prevent compiler warnings)
Definition: L1GctJetCand.cc:56
ostream & operator<<(ostream &s, const L1GctJetCand &cand)
Definition: L1GctJetCand.cc:70
L1GctJetCand()
default constructor (for vector initialisation etc.)
Definition: L1GctJetCand.cc:10
unsigned etaSign() const override
get eta sign bit (1 for -ve Z, 0 for +ve Z)
Definition: L1GctJetCand.h:59
unsigned rank() const override
get rank bits
Definition: L1GctJetCand.h:53
unsigned phiIndex() const override
get phi index (0-17)
Definition: L1GctJetCand.h:62
uint16_t m_data
Definition: L1GctJetCand.h:91
unsigned etaIndex() const override
get eta index (bit 3 is sign, 1 for -ve Z, 0 for +ve Z)
Definition: L1GctJetCand.h:56
bool isForward() const
check if this is a forward jet
Definition: L1GctJetCand.h:71
bool isTau(const Candidate &part)
Definition: pdgIdUtils.h:11