CMS 3D CMS Logo

L1MuDTEtaPattern.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTEtaPattern
4 //
5 // Description: Pattern for Eta for Eta Track Finder
6 //
7 //
8 // $Date: 2009/02/03 23:33:45 $
9 // $Revision: 1.3 $
10 //
11 // Author :
12 // N. Neumeister CERN EP
13 // J. Troconiz UAM Madrid
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 <bitset>
30 #include <cstdlib>
31 
32 //-------------------------------
33 // Collaborating Class Headers --
34 //-------------------------------
35 
36 using namespace std;
37 
38 // --------------------------------
39 // class L1MuDTEtaPattern
40 //---------------------------------
41 
42 //----------------
43 // Constructors --
44 //----------------
45 
47  m_id(0), m_eta(0), m_qual(0) {
48 
49  for (int i = 0; i < 3; i++) {
50  m_wheel[i] = 0;
51  m_position[i] = 0;
52  }
53 
54 }
55 
56 
57 L1MuDTEtaPattern::L1MuDTEtaPattern(int id, int w1, int w2, int w3,
58  int p1, int p2, int p3,
59  int eta, int qual) :
60 
61  m_id(id), m_eta(eta), m_qual(qual) {
62 
63  m_wheel[0] = w1;
64  m_wheel[1] = w2;
65  m_wheel[2] = w3;
66  m_position[0] = p1;
67  m_position[1] = p2;
68  m_position[2] = p3;
69 
70 }
71 
72 
73 L1MuDTEtaPattern::L1MuDTEtaPattern(int id, const string& pat, int eta, int qual) :
74  m_id(id), m_eta(eta), m_qual(qual) {
75 
76  for ( int i = 0; i < 3; i++ ) {
77  string sub = pat.substr(3*i,3);
78  if ( sub == "___" ) {
79  m_wheel[i] = 0;
80  m_position[i] = 0;
81  }
82  else {
83  m_wheel[i] = atoi(sub.substr(0,2).c_str());
84  m_position[i] = atoi(sub.substr(2,1).c_str());
85  }
86  }
87 }
88 
89 
91  m_id(p.m_id), m_eta(p.m_eta), m_qual(p.m_qual) {
92 
93  for (int i = 0; i < 3; i++) {
94  m_wheel[i] = p.m_wheel[i];
95  m_position[i] = p.m_position[i];
96  }
97 
98 }
99 
100 
101 //--------------
102 // Destructor --
103 //--------------
104 
106 
107 
108 //--------------
109 // Operations --
110 //--------------
111 
112 //
113 // Assignment operator
114 //
116 
117  if ( this != &p ) {
118  m_id = p.m_id;
119  m_eta = p.m_eta;
120  m_qual = p.m_qual;
121  for (int i = 0; i < 3; i++) {
122  m_wheel[i] = p.m_wheel[i];
123  m_position[i] = p.m_position[i];
124  }
125  }
126  return *this;
127 
128 }
129 
130 
131 //
132 // Equal operator
133 //
135 
136  if ( m_id != p.id() ) return false;
137  if ( m_eta != p.eta() ) return false;
138  if ( m_qual != p.quality() ) return false;
139  for (int i = 0; i < 3; i++) {
140  if ( m_wheel[i] != p.m_wheel[i] ) return false;
141  if ( m_position[i] != p.m_position[i] ) return false;
142  }
143  return true;
144 
145 }
146 
147 
148 //
149 // Unequal operator
150 //
152 
153  if ( m_id != p.id() ) return true;
154  if ( m_eta != p.eta() ) return true;
155  if ( m_qual != p.quality() ) return true;
156  for (int i = 0; i < 3; i++) {
157  if ( m_wheel[i] != p.m_wheel[i] ) return true;
158  if ( m_position[i] != p.m_position[i] ) return true;
159  }
160  return false;
161 
162 }
163 
164 
165 
166 //
167 // output stream operator
168 //
169 ostream& operator<<(ostream& s, const L1MuDTEtaPattern& p) {
170 
171  s.setf(ios::right,ios::adjustfield);
172  s << "ID = " << setw(8) << p.id() << " "
173  << "quality = " << setw(2) << p.quality() << " "
174  << "eta = " << setw(1) << p.eta() << endl;
175  for (int i = 0; i < 3; i++) {
176  s << "station = " << i+1 << " : ";
177  for (int j = 0; j < 5; j++) {
178  bitset<7> pos;
179  if ( p.m_position[i] && (p.m_wheel[i] == j-2) ) pos.set(p.m_position[i]-1);
180  s << pos << " ";
181  }
182  s << endl;
183  }
184 
185  return s;
186 
187 }
188 
189 
190 //
191 // input stream operator
192 //
193 istream& operator>>(istream& s, L1MuDTEtaPattern& p) {
194 
195  string pat;
196 
197  s >> p.m_id >> pat >> p.m_qual >> p.m_eta;
198 
199  for ( int i = 0; i < 3; i++ ) {
200  string sub = pat.substr(3*i,3);
201  if ( sub == "___" ) {
202  p.m_wheel[i] = 0;
203  p.m_position[i] = 0;
204  }
205  else {
206  p.m_wheel[i] = atoi(sub.substr(0,2).c_str());
207  p.m_position[i] = atoi(sub.substr(2,1).c_str());
208  }
209  }
210 
211  return s;
212 
213 }
int i
Definition: DBlmapReader.cc:9
friend std::istream & operator>>(std::istream &, L1MuDTEtaPattern &)
input stream operator
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
int quality() const
return quality
L1MuDTEtaPattern & operator=(const L1MuDTEtaPattern &)
assignment operator
Definition: HeavyIon.h:7
int id() const
return id
int eta() const
return eta
bool operator!=(const L1MuDTEtaPattern &) const
unequal operator
bool operator==(const L1MuDTEtaPattern &) const
equal operator
int j
Definition: DBlmapReader.cc:9
double p2[4]
Definition: TauolaWrapper.h:90
L1MuDTEtaPattern()
default constructor
common ppss p3p6s2 common epss epspn46 common const1 w3
Definition: inclppp.h:1
double p1[4]
Definition: TauolaWrapper.h:89
friend std::ostream & operator<<(std::ostream &, const L1MuDTEtaPattern &)
output stream operator
virtual ~L1MuDTEtaPattern()
destructor
double p3[4]
Definition: TauolaWrapper.h:91