CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1MuGMTCand.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuGMTCand
4 //
5 // Description: L1 Global Muon Trigger Candidate
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 //
12 // Migrated to CMSSW:
13 // I. Mikulec
14 //
15 //--------------------------------------------------
16 
17 //-----------------------
18 // This Class's Header --
19 //-----------------------
20 
22 
23 //---------------
24 // C++ Headers --
25 //---------------
26 
27 #include <iostream>
28 #include <iomanip>
29 #include <cmath>
30 
31 //-------------------------------
32 // Collaborating Class Headers --
33 //-------------------------------
34 
36 
37 //---------------------------------
38 // class L1MuGMTCand
39 //---------------------------------
40 
41 using namespace std;
42 
43 const float L1MuGMTCand::m_invalidValue = -10.;
44 
45 //----------------
46 // Constructors --
47 //----------------
48 
49 L1MuGMTCand::L1MuGMTCand() : m_name("L1MuGMTCand"), m_bx(0), m_dataWord(0) {
53 }
54 
56  : m_name(mu.m_name),
57  m_bx(mu.m_bx),
58  m_dataWord(mu.m_dataWord),
59  m_phiValue(mu.m_phiValue),
60  m_etaValue(mu.m_etaValue),
61  m_ptValue(mu.m_ptValue) {}
62 
63 L1MuGMTCand::L1MuGMTCand(unsigned data, int bx) : m_name("L1MuGMTCand"), m_bx(bx), m_dataWord(data) {
67 }
68 
69 //--------------
70 // Destructor --
71 //--------------
73 
74 //--------------
75 // Operations --
76 //--------------
77 
78 //
79 // reset Muon Track Candidate
80 //
82  m_bx = 0;
83  m_dataWord = 0;
87 }
88 
89 //
90 // return phi of track candidate in radians
91 //
92 float L1MuGMTCand::phiValue() const {
93  if (m_phiValue == m_invalidValue) {
94  edm::LogWarning("ValueInvalid") << "L1MuGMTCand::phiValue requested physical value is invalid";
95  }
96  return m_phiValue;
97 }
98 
99 //
100 // return eta of track candidate
101 //
102 float L1MuGMTCand::etaValue() const {
103  if (m_etaValue == m_invalidValue) {
104  edm::LogWarning("ValueInvalid") << "L1MuGMTCand::etaValue requested physical value is invalid";
105  }
106  return m_etaValue;
107 }
108 
109 //
110 // return pt-value of track candidate in GeV
111 //
112 float L1MuGMTCand::ptValue() const {
113  if (m_ptValue == m_invalidValue) {
114  edm::LogWarning("ValueInvalid") << "L1MuRegionalCand::ptValue requested physical value is invalid";
115  }
116  return m_ptValue;
117 }
118 
119 //
120 // Equal operator
121 //
122 bool L1MuGMTCand::operator==(const L1MuGMTCand& cand) const {
123  if (m_bx != cand.m_bx)
124  return false;
125  if (m_dataWord != cand.m_dataWord)
126  return false;
127  return true;
128 }
129 
130 //
131 // Unequal operator
132 //
133 bool L1MuGMTCand::operator!=(const L1MuGMTCand& cand) const {
134  if (m_bx != cand.m_bx)
135  return true;
136  if (m_dataWord != cand.m_dataWord)
137  return true;
138  return false;
139 }
140 
141 //
142 // print parameters of track candidate
143 //
144 void L1MuGMTCand::print() const {
145  if (!empty()) {
147  edm::LogVerbatim("GMT_Candidate_info") << setiosflags(ios::right | ios::adjustfield | ios::showpoint | ios::fixed)
148  << "bx = " << setw(2) << bx() << " " << endl
149  << "pt(index) = " << setw(2) << ptIndex() << " "
150  << "charge = " << setw(2) << charge() << " "
151  << "eta(index) = " << setw(2) << etaIndex() << " "
152  << "phi(index) = " << setw(3) << phiIndex() << " "
153  << "quality = " << setw(1) << quality() << " "
154  << "isolated = " << setw(1) << isol() << " "
155  << "mip = " << setw(1) << mip() << endl;
156  } else {
157  edm::LogVerbatim("GMT_Candidate_info") << setiosflags(ios::right | ios::adjustfield | ios::showpoint | ios::fixed)
158  << "bx = " << setw(2) << bx() << " " << endl
159  << "pt = " << setw(5) << setprecision(1) << ptValue() << " GeV "
160  << "charge = " << setw(2) << charge() << " "
161  << "eta = " << setw(5) << setprecision(2) << etaValue() << " "
162  << "phi = " << setw(5) << setprecision(3) << phiValue() << " rad "
163  << "quality = " << setw(1) << quality() << " "
164  << "isolated = " << setw(1) << isol() << " "
165  << "mip = " << setw(1) << mip() << endl;
166  }
167  }
168 }
169 
170 //
171 // output stream operator for track candidate
172 //
173 ostream& operator<<(ostream& s, const L1MuGMTCand& id) {
174  if (!id.empty()) {
175  s << setiosflags(ios::showpoint | ios::fixed) << "bx = " << setw(2) << id.bx() << " "
176  << "pt = " << setw(5) << setprecision(1) << id.ptValue() << " GeV "
177  << "charge = " << setw(2) << id.charge() << " "
178  << "eta = " << setw(5) << setprecision(2) << id.etaValue() << " "
179  << "phi = " << setw(5) << setprecision(3) << id.phiValue() << " rad "
180  << "quality = " << setw(1) << id.quality() << " "
181  << "isolated = " << setw(1) << id.isol() << " "
182  << "mip = " << setw(1) << id.mip() << " ";
183  }
184  return s;
185 }
float etaValue() const
Definition: L1MuGMTCand.cc:102
Log< level::Info, true > LogVerbatim
float phiValue() const
Definition: L1MuGMTCand.cc:92
unsigned int phiIndex() const
get phi-code
Definition: L1MuGMTCand.h:70
void reset()
reset muon candidate
Definition: L1MuGMTCand.cc:81
bool operator!=(const L1MuGMTCand &) const
unequal operator
Definition: L1MuGMTCand.cc:133
unsigned int etaIndex() const
get eta-code
Definition: L1MuGMTCand.h:105
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
float m_ptValue
Definition: L1MuGMTCand.h:215
bool isol() const
get isolation
Definition: L1MuGMTCand.h:111
L1MuGMTCand()
constructor
Definition: L1MuGMTCand.cc:49
float m_etaValue
Definition: L1MuGMTCand.h:214
float m_phiValue
Definition: L1MuGMTCand.h:213
bool empty() const
is it an empty muon candidate?
Definition: L1MuGMTCand.h:61
static const float m_invalidValue
Definition: L1MuGMTCand.h:216
int bx() const
get bunch crossing identifier
Definition: L1MuGMTCand.h:117
const int mu
Definition: Constants.h:22
bool mip() const
get mip
Definition: L1MuGMTCand.h:114
unsigned m_dataWord
Definition: L1MuGMTCand.h:211
float ptValue() const
Definition: L1MuGMTCand.cc:112
unsigned int quality() const
get quality
Definition: L1MuGMTCand.h:90
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
bool operator==(const L1MuGMTCand &) const
equal operator
Definition: L1MuGMTCand.cc:122
Log< level::Warning, false > LogWarning
virtual ~L1MuGMTCand()
destructor
Definition: L1MuGMTCand.cc:72
unsigned int ptIndex() const
get pt-code
Definition: L1MuGMTCand.h:73
void print() const
print parameters of muon candidate
Definition: L1MuGMTCand.cc:144
int charge() const
get charge (+1 -1)
Definition: L1MuGMTCand.h:132