CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctJetCand.cc
Go to the documentation of this file.
1 
2 
4 
5 
6 using std::ostream;
7 using std::string;
8 using std::hex;
9 using std::dec;
10 
12  m_data(0),
13  m_isTau(false),
14  m_isFor(false),
15  m_captureBlock(0),
16  m_captureIndex(0),
17  m_bx(0)
18 {
19 
20 }
21 
22 //constructor for GT
23 L1GctJetCand::L1GctJetCand(uint16_t rawData, bool isTau, bool isFor) :
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(0),
28  m_captureIndex(0),
29  m_bx(0)
30 {
31 }
32 
33 //constructor for GCT unpacker
34 L1GctJetCand::L1GctJetCand(uint16_t rawData, bool isTau, bool isFor, 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_isTau(isTau),
37  m_isFor(isFor),
38  m_captureBlock(block&0xfff),
39  m_captureIndex(index&0xff),
40  m_bx(bx)
41 {
42 }
43 
44 // constructor for use in emulator
45 // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
46 L1GctJetCand::L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor) :
47  m_data(0), // overridden below
48  m_isTau(isTau),
49  m_isFor(isFor),
50  m_captureBlock(0),
51  m_captureIndex(0),
52  m_bx(0)
53 {
54  m_data = (rank & 0x3f) + ((eta & 0xf)<<6) + ((phi & 0x1f)<<10);
55 }
56 
57 // constructor for use in emulator
58 // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
59 L1GctJetCand::L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx) :
60  m_data(0), // overridden below
61  m_isTau(isTau),
62  m_isFor(isFor),
63  m_captureBlock(block&0xfff),
64  m_captureIndex(index&0xff),
65  m_bx(bx)
66 {
67  m_data = (rank & 0x3f) + ((eta & 0xf)<<6) + ((phi & 0x1f)<<10);
68 }
69 
71 
72 // return name
73 string L1GctJetCand::name() const {
74  if (m_isTau) { return "tau jet"; }
75  else if (m_isFor) { return "forward jet"; }
76  else { return "central jet"; }
77 }
78 
79 
80 // pretty print
81 ostream& operator<<(ostream& s, const L1GctJetCand& cand) {
82  if (cand.empty()) {
83  s << "L1GctJetCand empty jet";
84  } else {
85  s << "L1GctJetCand : ";
86  s << "rank=" << cand.rank();
87  s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex()&0x7) << ", phi=" << cand.phiIndex();
88  s << " type=";
89  if (cand.isTau()) { s << "tau"; }
90  else if (cand.isForward()) { s << "forward"; }
91  else { s << "central"; }
92  }
93  s << hex << " cap block=" << cand.capBlock() << dec << ", index=" << cand.capIndex() << ", BX=" << cand.bx();
94  return s;
95 }
96 
98 
99  // get global eta
100  unsigned eta;
101  if ( !isForward() ) {
102  eta = ( etaSign()==1 ? 10-(etaIndex()&0x7) : (etaIndex()&0x7)+11 );
103  }
104  else {
105  eta = ( etaSign()==1 ? 3-(etaIndex()&0x7) : (etaIndex()&0x7)+18 );
106  }
107 
108  return L1CaloRegionDetId(eta, phiIndex());
109 
110 }
111 
112 
bool isTau() const
check if this is a tau
Definition: L1GctJetCand.h:68
unsigned rank() const
get rank bits
Definition: L1GctJetCand.h:53
unsigned capBlock() const
which capture block did this come from
Definition: L1GctJetCand.h:74
int16_t bx() const
get bunch-crossing index
Definition: L1GctJetCand.h:80
unsigned etaIndex() const
get eta index (bit 3 is sign, 1 for -ve Z, 0 for +ve Z)
Definition: L1GctJetCand.h:56
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:18
virtual ~L1GctJetCand()
destructor (virtual to prevent compiler warnings)
Definition: L1GctJetCand.cc:70
T eta() const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
bool isForward() const
check if this is a forward jet
Definition: L1GctJetCand.h:71
L1CaloRegionDetId regionId() const
region associated with the candidate
Definition: L1GctJetCand.cc:97
bool empty() const
was an object really found?
Definition: L1GctJetCand.h:47
L1GctJetCand()
default constructor (for vector initialisation etc.)
Definition: L1GctJetCand.cc:11
unsigned etaSign() const
get eta sign bit (1 for -ve Z, 0 for +ve Z)
Definition: L1GctJetCand.h:59
std::string name() const
name of object
Definition: L1GctJetCand.cc:73
uint16_t m_data
Definition: L1GctJetCand.h:92
unsigned capIndex() const
what index within capture block
Definition: L1GctJetCand.h:77
unsigned phiIndex() const
get phi index (0-17)
Definition: L1GctJetCand.h:62
bool isTau(const Candidate &part)
Definition: pdgIdUtils.h:15
Definition: DDAxes.h:10