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 // return whether an object was found
80 bool L1GctJetCand::empty() const {
81  return (rank() == 0);
82 }
83 
84 // pretty print
85 ostream& operator<<(ostream& s, const L1GctJetCand& cand) {
86  if (cand.empty()) {
87  s << "L1GctJetCand empty jet";
88  } else {
89  s << "L1GctJetCand : ";
90  s << "rank=" << cand.rank();
91  s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex()&0x7) << ", phi=" << cand.phiIndex();
92  s << " type=";
93  if (cand.isTau()) { s << "tau"; }
94  else if (cand.isForward()) { s << "forward"; }
95  else { s << "central"; }
96  }
97  s << hex << " cap block=" << cand.capBlock() << dec << ", index=" << cand.capIndex() << ", BX=" << cand.bx();
98  return s;
99 }
100 
102 
103  // get global eta
104  unsigned eta;
105  if ( !isForward() ) {
106  eta = ( etaSign()==1 ? 10-(etaIndex()&0x7) : (etaIndex()&0x7)+11 );
107  }
108  else {
109  eta = ( etaSign()==1 ? 3-(etaIndex()&0x7) : (etaIndex()&0x7)+18 );
110  }
111 
112  return L1CaloRegionDetId(eta, phiIndex());
113 
114 }
115 
117 unsigned L1GctJetCand::rank() const { return m_data & 0x3f; }
118 
120 unsigned L1GctJetCand::etaIndex() const { return (m_data>>6) & 0xf; }
121 
123 unsigned L1GctJetCand::phiIndex() const { return (m_data>>10) & 0x1f; }
124 
bool isTau() const
check if this is a tau
Definition: L1GctJetCand.h:68
unsigned rank() const
get rank bits
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)
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
bool empty() const
was an object really found?
Definition: L1GctJetCand.cc:80
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)
string s
Definition: asciidump.py:422
bool isTau(const Candidate &part)
Definition: pdgIdUtils.h:15
Definition: DDAxes.h:10