CMS 3D CMS Logo

L1MuBMSecProcId.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuBMSecProcId
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 L1MuBMSecProcId
36 //---------------------------------
37 
38 //----------------
39 // Constructors --
40 //----------------
41 
42 L1MuBMSecProcId::L1MuBMSecProcId() : m_wheel(0), m_sector(0) {}
43 
44 L1MuBMSecProcId::L1MuBMSecProcId(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 L1MuBMSecProcId::L1MuBMSecProcId(const L1MuBMSecProcId& 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 L1MuBMSecProcId::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 L1MuBMSecProcId& id) {
125  s.setf(ios::right, ios::adjustfield);
126  s << "Sector Processor ( " << setw(2) << id.wheel() << "," << setw(2) << id.sector() << " )";
127  return s;
128 }
L1MuBMSecProcId::m_sector
int m_sector
Definition: L1MuBMSecProcId.h:83
L1MuBMSecProcId
Definition: L1MuBMSecProcId.h:40
L1MuBMSecProcId::operator!=
bool operator!=(const L1MuBMSecProcId &) const
unequal operator
Definition: L1MuBMSecProcId.cc:95
L1MuBMSecProcId::~L1MuBMSecProcId
virtual ~L1MuBMSecProcId()
destructor
Definition: L1MuBMSecProcId.cc:59
L1MuBMSecProcId::sector
int sector() const
return sector number
Definition: L1MuBMSecProcId.h:58
operator<<
ostream & operator<<(ostream &s, const L1MuBMSecProcId &id)
Definition: L1MuBMSecProcId.cc:124
L1MuBMSecProcId::wheel
int wheel() const
return wheel number
Definition: L1MuBMSecProcId.h:55
alignCSCRings.s
s
Definition: alignCSCRings.py:92
L1MuBMSecProcId::locwheel
int locwheel() const
return physical wheel number (-2,-1,0,+1,+2)
Definition: L1MuBMSecProcId.cc:79
L1MuBMSecProcId::operator<
bool operator<(const L1MuBMSecProcId &) const
less operator
Definition: L1MuBMSecProcId.cc:106
L1MuBMSecProcId::m_wheel
int m_wheel
Definition: L1MuBMSecProcId.h:82
L1MuBMSecProcId.h
L1MuBMSecProcId::L1MuBMSecProcId
L1MuBMSecProcId()
default constructor
Definition: L1MuBMSecProcId.cc:42
L1MuBMSecProcId::operator==
bool operator==(const L1MuBMSecProcId &) const
equal operator
Definition: L1MuBMSecProcId.cc:84
std
Definition: JetResolutionObject.h:76
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1MuBMSecProcId::operator=
L1MuBMSecProcId & operator=(const L1MuBMSecProcId &)
assignment operator
Definition: L1MuBMSecProcId.cc:68