test
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 //
9 // Author :
10 // N. Neumeister CERN EP
11 //
12 //--------------------------------------------------
13 
14 //-----------------------
15 // This Class's Header --
16 //-----------------------
17 
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 
24 #include <iostream>
25 #include <iomanip>
26 #include <cstdlib>
27 
28 //-------------------------------
29 // Collaborating Class Headers --
30 //-------------------------------
31 
32 using namespace std;
33 
34 // --------------------------------
35 // class L1MuDTSecProcId
36 //---------------------------------
37 
38 //----------------
39 // Constructors --
40 //----------------
41 
43  m_wheel(0), m_sector(0) {}
44 
45 L1MuDTSecProcId::L1MuDTSecProcId(int wheel_id, int sector_id) :
46  m_wheel(wheel_id), m_sector(sector_id) {
47 
48  if ( !(wheel_id >= -3 && wheel_id <= 3) ) {
49  // cerr << "SecProcId : wheel out of range: " << wheel_id << endl;
50  }
51  if ( !(sector_id >= 0 && sector_id < 12) ) {
52  // cerr << "SecProcId : sector out of range: " << sector_id << endl;
53  }
54 
55 }
56 
57 
59  m_wheel(id.m_wheel), m_sector(id.m_sector) {}
60 
61 
62 //--------------
63 // Destructor --
64 //--------------
65 
67 
68 //--------------
69 // Operations --
70 //--------------
71 
72 //
73 // Assignment operator
74 //
76 
77  if ( this != &id ) {
78  m_wheel = id.m_wheel;
79  m_sector = id.m_sector;
80  }
81  return *this;
82 
83 }
84 
85 
86 //
87 // return logical wheel
88 //
90 
91  return ( m_wheel/abs(m_wheel)*(abs(m_wheel)-1) );
92 
93 }
94 
95 
96 //
97 // Equal operator
98 //
100 
101  if ( wheel() != id.wheel() ) return false;
102  if ( sector() != id.sector() ) return false;
103  return true;
104 
105 }
106 
107 
108 //
109 // Unequal operator
110 //
112 
113  if ( m_wheel != id.wheel() ) return true;
114  if ( m_sector != id.sector() ) return true;
115  return false;
116 
117 }
118 
119 
120 //
121 // Less operator
122 //
124 
125  if ( sector() < id.sector() ) return true;
126  if ( sector() > id.sector() ) return false;
127  if ( wheel() < 0 && id.wheel() < 0 ) {
128  if ( -wheel() < -id.wheel() ) return true;
129  }
130  else {
131  if ( wheel() < id.wheel() ) return true;
132  }
133  return false;
134 
135 }
136 
137 
138 //
139 // output stream operator
140 //
141 ostream& operator<<(ostream& s, const L1MuDTSecProcId& id) {
142 
143  s.setf(ios::right,ios::adjustfield);
144  s << "Sector Processor ( " << setw(2) << id.wheel() << ","
145  << setw(2) << id.sector() << " )";
146  return s;
147 
148 }
bool operator==(const L1MuDTSecProcId &) const
equal operator
L1MuDTSecProcId()
default constructor
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
int sector() const
return sector number
bool operator!=(const L1MuDTSecProcId &) const
unequal operator
virtual ~L1MuDTSecProcId()
destructor
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int locwheel() const
return physical wheel number (-2,-1,0,+1,+2)
L1MuDTSecProcId & operator=(const L1MuDTSecProcId &)
assignment operator
int wheel() const
return wheel number
bool operator<(const L1MuDTSecProcId &) const
less operator