CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuDTSecProcId.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTSecProcId
4 //
5 // Description: Sector Processor identifier
6 //
7 //
8 // $Date: 2007/02/27 11:44:00 $
9 // $Revision: 1.2 $
10 //
11 // Author :
12 // N. Neumeister CERN EP
13 //
14 //--------------------------------------------------
15 
16 //-----------------------
17 // This Class's Header --
18 //-----------------------
19 
21 
22 //---------------
23 // C++ Headers --
24 //---------------
25 
26 #include <iostream>
27 #include <iomanip>
28 #include <cstdlib>
29 
30 //-------------------------------
31 // Collaborating Class Headers --
32 //-------------------------------
33 
34 using namespace std;
35 
36 // --------------------------------
37 // class L1MuDTSecProcId
38 //---------------------------------
39 
40 //----------------
41 // Constructors --
42 //----------------
43 
45  m_wheel(0), m_sector(0) {}
46 
47 L1MuDTSecProcId::L1MuDTSecProcId(int wheel_id, int sector_id) :
48  m_wheel(wheel_id), m_sector(sector_id) {
49 
50  if ( !(wheel_id >= -3 && wheel_id <= 3) ) {
51  // cerr << "SecProcId : wheel out of range: " << wheel_id << endl;
52  }
53  if ( !(sector_id >= 0 && sector_id < 12) ) {
54  // cerr << "SecProcId : sector out of range: " << sector_id << endl;
55  }
56 
57 }
58 
59 
61  m_wheel(id.m_wheel), m_sector(id.m_sector) {}
62 
63 
64 //--------------
65 // Destructor --
66 //--------------
67 
69 
70 //--------------
71 // Operations --
72 //--------------
73 
74 //
75 // Assignment operator
76 //
78 
79  if ( this != &id ) {
80  m_wheel = id.m_wheel;
81  m_sector = id.m_sector;
82  }
83  return *this;
84 
85 }
86 
87 
88 //
89 // return logical wheel
90 //
92 
93  return ( m_wheel/abs(m_wheel)*(abs(m_wheel)-1) );
94 
95 }
96 
97 
98 //
99 // Equal operator
100 //
102 
103  if ( wheel() != id.wheel() ) return false;
104  if ( sector() != id.sector() ) return false;
105  return true;
106 
107 }
108 
109 
110 //
111 // Unequal operator
112 //
114 
115  if ( m_wheel != id.wheel() ) return true;
116  if ( m_sector != id.sector() ) return true;
117  return false;
118 
119 }
120 
121 
122 //
123 // Less operator
124 //
126 
127  if ( sector() < id.sector() ) return true;
128  if ( sector() > id.sector() ) return false;
129  if ( wheel() < 0 && id.wheel() < 0 ) {
130  if ( -wheel() < -id.wheel() ) return true;
131  }
132  else {
133  if ( wheel() < id.wheel() ) return true;
134  }
135  return false;
136 
137 }
138 
139 
140 //
141 // output stream operator
142 //
143 ostream& operator<<(ostream& s, const L1MuDTSecProcId& id) {
144 
145  s.setf(ios::right,ios::adjustfield);
146  s << "Sector Processor ( " << setw(2) << id.wheel() << ","
147  << setw(2) << id.sector() << " )";
148  return s;
149 
150 }
bool operator==(const L1MuDTSecProcId &) const
equal operator
#define abs(x)
Definition: mlp_lapack.h:159
L1MuDTSecProcId()
default constructor
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
int sector() const
return sector number
bool operator!=(const L1MuDTSecProcId &) const
unequal operator
virtual ~L1MuDTSecProcId()
destructor
int locwheel() const
return physical wheel number (-2,-1,0,+1,+2)
L1MuDTSecProcId & operator=(const L1MuDTSecProcId &)
assignment operator
int wheel() const
return wheel number
string s
Definition: asciidump.py:422
bool operator<(const L1MuDTSecProcId &) const
less operator