test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
44  std::string toString() const {
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{
57  return (this->m_tower == l2.m_tower) && (this->m_PAC == l2.m_PAC);
58  }
59 
60 
61  //private:
62  signed short m_tower;
63  signed short m_PAC;
64 
65 
67 };
68 
69 
71 {
72 
73  public:
74  L1RPCHwConfig();
75  virtual ~L1RPCHwConfig();
76 
77 
78 
79  bool isActive(int tower, int sector, int segment) const
80  {
81  return m_disabledDevices.find( L1RPCDevCoords(tower, sector, segment) )==m_disabledDevices.end();
82  };
83 
84  bool isActive(int tower, int PAC) const
85  {
86  return m_disabledDevices.end()==m_disabledDevices.find( L1RPCDevCoords(tower, PAC/12, PAC%12) );
87  };
88 
89  void enablePAC(int tower, int sector, int segment, bool enable);
90 
91  void enableTower(int tower, bool enable);
92 
93  void enableTowerInCrate(int tower, int crate, bool enable);
94 
95  void enableCrate(int logSector, bool enable); // logSector == crate number /// enables one crate, all towers
96 
97  void enableAll(bool enable);
98 
99  int size() const {return m_disabledDevices.size(); } ;
100  void dump() const {
101  for(std::set<L1RPCDevCoords>::const_iterator it=m_disabledDevices.begin(); it!=m_disabledDevices.end();++it){
102  std::cout << it->toString() << std::endl;
103  }
104  };
105 
106  // ---------- const member functions ---------------------
107 
108  // ---------- static member functions --------------------
109 
110  // ---------- member functions ---------------------------
111 
112 
113  private:
114 
115  std::set<L1RPCDevCoords> m_disabledDevices;
116 
117  // ---------- member data --------------------------------
118 
119 
121 };
122 
123 
124 #endif
bool isActive(int tower, int PAC) const
Definition: L1RPCHwConfig.h:84
void enableTower(int tower, bool enable)
void enableCrate(int logSector, bool enable)
L1RPCDevCoords(int tower, int sector, int segment)
Definition: L1RPCHwConfig.h:38
void dump() const
virtual ~L1RPCHwConfig()
bool isActive(int tower, int sector, int segment) const
Definition: L1RPCHwConfig.h:79
bool operator<(const L1RPCDevCoords &l2) const
Definition: L1RPCHwConfig.h:50
std::string toString() const
Definition: L1RPCHwConfig.h:44
int size() const
Definition: L1RPCHwConfig.h:99
void enableAll(bool enable)
signed short m_tower
Definition: L1RPCHwConfig.h:62
std::set< L1RPCDevCoords > m_disabledDevices
#define COND_SERIALIZABLE
Definition: Serializable.h:37
void enablePAC(int tower, int sector, int segment, bool enable)
signed short m_PAC
Definition: L1RPCHwConfig.h:63
void enableTowerInCrate(int tower, int crate, bool enable)
tuple cout
Definition: gather_cfg.py:145
bool operator==(const L1RPCDevCoords &l2) const
Definition: L1RPCHwConfig.h:56