CMS 3D CMS Logo

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 
42 L1MuDTSecProcId::L1MuDTSecProcId() : m_wheel(0), m_sector(0) {}
43 
44 L1MuDTSecProcId::L1MuDTSecProcId(int wheel_id, int sector_id) : m_wheel(wheel_id), m_sector(sector_id) {
45  if (!(wheel_id >= -3 && wheel_id <= 3)) {
46  // cerr << "SecProcId : wheel out of range: " << wheel_id << endl;
47  }
48  if (!(sector_id >= 0 && sector_id < 12)) {
49  // cerr << "SecProcId : sector out of range: " << sector_id << endl;
50  }
51 }
52 
53 L1MuDTSecProcId::L1MuDTSecProcId(const L1MuDTSecProcId& id) : m_wheel(id.m_wheel), m_sector(id.m_sector) {}
54 
55 //--------------
56 // Destructor --
57 //--------------
58 
60 
61 //--------------
62 // Operations --
63 //--------------
64 
65 //
66 // Assignment operator
67 //
69  if (this != &id) {
70  m_wheel = id.m_wheel;
71  m_sector = id.m_sector;
72  }
73  return *this;
74 }
75 
76 //
77 // return logical wheel
78 //
79 int L1MuDTSecProcId::locwheel() const { return (m_wheel / abs(m_wheel) * (abs(m_wheel) - 1)); }
80 
81 //
82 // Equal operator
83 //
85  if (wheel() != id.wheel())
86  return false;
87  if (sector() != id.sector())
88  return false;
89  return true;
90 }
91 
92 //
93 // Unequal operator
94 //
96  if (m_wheel != id.wheel())
97  return true;
98  if (m_sector != id.sector())
99  return true;
100  return false;
101 }
102 
103 //
104 // Less operator
105 //
107  if (sector() < id.sector())
108  return true;
109  if (sector() > id.sector())
110  return false;
111  if (wheel() < 0 && id.wheel() < 0) {
112  if (-wheel() < -id.wheel())
113  return true;
114  } else {
115  if (wheel() < id.wheel())
116  return true;
117  }
118  return false;
119 }
120 
121 //
122 // output stream operator
123 //
124 ostream& operator<<(ostream& s, const L1MuDTSecProcId& id) {
125  s.setf(ios::right, ios::adjustfield);
126  s << "Sector Processor ( " << setw(2) << id.wheel() << "," << setw(2) << id.sector() << " )";
127  return s;
128 }
L1MuDTSecProcId::m_sector
int m_sector
Definition: L1MuDTSecProcId.h:83
L1MuDTSecProcId::operator!=
bool operator!=(const L1MuDTSecProcId &) const
unequal operator
Definition: L1MuDTSecProcId.cc:95
L1MuDTSecProcId.h
L1MuDTSecProcId::operator=
L1MuDTSecProcId & operator=(const L1MuDTSecProcId &)
assignment operator
Definition: L1MuDTSecProcId.cc:68
L1MuDTSecProcId::locwheel
int locwheel() const
return physical wheel number (-2,-1,0,+1,+2)
Definition: L1MuDTSecProcId.cc:79
alignCSCRings.s
s
Definition: alignCSCRings.py:92
L1MuDTSecProcId::wheel
int wheel() const
return wheel number
Definition: L1MuDTSecProcId.h:55
L1MuDTSecProcId::operator==
bool operator==(const L1MuDTSecProcId &) const
equal operator
Definition: L1MuDTSecProcId.cc:84
L1MuDTSecProcId::sector
int sector() const
return sector number
Definition: L1MuDTSecProcId.h:58
L1MuDTSecProcId
Definition: L1MuDTSecProcId.h:40
L1MuDTSecProcId::L1MuDTSecProcId
L1MuDTSecProcId()
default constructor
Definition: L1MuDTSecProcId.cc:42
L1MuDTSecProcId::operator<
bool operator<(const L1MuDTSecProcId &) const
less operator
Definition: L1MuDTSecProcId.cc:106
L1MuDTSecProcId::m_wheel
int m_wheel
Definition: L1MuDTSecProcId.h:82
std
Definition: JetResolutionObject.h:76
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
L1MuDTSecProcId::~L1MuDTSecProcId
virtual ~L1MuDTSecProcId()
destructor
Definition: L1MuDTSecProcId.cc:59
operator<<
ostream & operator<<(ostream &s, const L1MuDTSecProcId &id)
Definition: L1MuDTSecProcId.cc:124
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22