CMS 3D CMS Logo

L1RPCHwConfig.h
Go to the documentation of this file.
1 #ifndef CondFormats_RPCObjects_L1RPCHwConfig_h
2 #define CondFormats_RPCObjects_L1RPCHwConfig_h
3 // -*- C++ -*-
4 //
5 // Package: RPCObjects
6 // Class : L1RPCHwConfig
7 //
16 //
17 // Original Author:
18 // Created: Wed Apr 9 13:48:06 CEST 2008
19 // $Id: L1RPCHwConfig.h,v 1.4 2008/06/24 11:06:53 michals Exp $
20 //
21 
22 // system include files
23 
24 // user include files
25 
26 // forward declarations
28 
29 #include <set>
30 #include <vector>
31 #include <sstream>
32 
33 #include <iostream>
34 
36 public:
37  L1RPCDevCoords() : m_tower(-255), m_PAC(-255){};
38  L1RPCDevCoords(int tower, int sector, int segment) : m_tower(tower), m_PAC(sector * 12 + segment){};
39  int getTower() { return m_tower; };
40  int getPAC() { return m_PAC; };
41  int getSector() { return m_PAC / 12; };
42  int getSegment() { return m_PAC % 12; };
43 
45  std::stringstream ss;
46  ss << m_tower << " " << m_PAC;
47  return ss.str();
48  };
49 
50  bool operator<(const L1RPCDevCoords& l2) const {
51  if (this->m_tower != l2.m_tower)
52  return this->m_tower < l2.m_tower;
53  return this->m_PAC < l2.m_PAC;
54  }
55 
56  bool operator==(const L1RPCDevCoords& l2) const { return (this->m_tower == l2.m_tower) && (this->m_PAC == l2.m_PAC); }
57 
58  //private:
59  signed short m_tower;
60  signed short m_PAC;
61 
63 };
64 
66 public:
67  L1RPCHwConfig();
68  virtual ~L1RPCHwConfig();
69 
70  bool isActive(int tower, int sector, int segment) const {
71  return m_disabledDevices.find(L1RPCDevCoords(tower, sector, segment)) == m_disabledDevices.end();
72  };
73 
74  bool isActive(int tower, int PAC) const {
75  return m_disabledDevices.end() == m_disabledDevices.find(L1RPCDevCoords(tower, PAC / 12, PAC % 12));
76  };
77 
78  void enablePAC(int tower, int sector, int segment, bool enable);
79 
80  void enableTower(int tower, bool enable);
81 
82  void enableTowerInCrate(int tower, int crate, bool enable);
83 
84  void enableCrate(int logSector, bool enable); // logSector == crate number /// enables one crate, all towers
85 
86  void enableAll(bool enable);
87 
88  int size() const { return m_disabledDevices.size(); };
89  void dump() const {
90  for (std::set<L1RPCDevCoords>::const_iterator it = m_disabledDevices.begin(); it != m_disabledDevices.end(); ++it) {
91  std::cout << it->toString() << std::endl;
92  }
93  };
94 
95  // ---------- const member functions ---------------------
96 
97  // ---------- static member functions --------------------
98 
99  // ---------- member functions ---------------------------
100 
101 private:
102  std::set<L1RPCDevCoords> m_disabledDevices;
103 
104  // ---------- member data --------------------------------
105 
107 };
108 
109 #endif
bool isActive(int tower, int PAC) const
Definition: L1RPCHwConfig.h:74
L1RPCDevCoords(int tower, int sector, int segment)
Definition: L1RPCHwConfig.h:38
void dump() const
Definition: L1RPCHwConfig.h:89
bool isActive(int tower, int sector, int segment) const
Definition: L1RPCHwConfig.h:70
bool operator<(const L1RPCDevCoords &l2) const
Definition: L1RPCHwConfig.h:50
std::string toString() const
Definition: L1RPCHwConfig.h:44
int size() const
Definition: L1RPCHwConfig.h:88
signed short m_tower
Definition: L1RPCHwConfig.h:59
std::set< L1RPCDevCoords > m_disabledDevices
Definition: L1RPCHwConfig.h:93
#define COND_SERIALIZABLE
Definition: Serializable.h:38
signed short m_PAC
Definition: L1RPCHwConfig.h:60
bool operator==(const L1RPCDevCoords &l2) const
Definition: L1RPCHwConfig.h:56