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.5 2010/02/26 15:50:38 fruboes Exp $
20 //
21 
22 // system include files
23 
24 // user include files
25 
26 // forward declarations
27 #include <set>
28 #include <vector>
29 #include <sstream>
30 
31 #include <iostream>
32 
34  public:
35  L1RPCDevCoords(): m_tower(-255), m_PAC(-255) {};
36  L1RPCDevCoords(int tower, int sector, int segment): m_tower(tower), m_PAC(sector*12+segment) {};
37  int getTower() {return m_tower;};
38  int getPAC() {return m_PAC;};
39  int getSector() {return m_PAC/12;};
40  int getSegment() {return m_PAC%12;};
41 
42  std::string toString() const {
43  std::stringstream ss;
44  ss << m_tower << " " << m_PAC;
45  return ss.str();
46  };
47 
48  bool operator<(const L1RPCDevCoords & l2 ) const{
49  if (this->m_tower != l2.m_tower)
50  return this->m_tower < l2.m_tower;
51  return this->m_PAC < l2.m_PAC;
52  }
53 
54  bool operator==(const L1RPCDevCoords & l2) const{
55  return (this->m_tower == l2.m_tower) && (this->m_PAC == l2.m_PAC);
56  }
57 
58 
59  //private:
60  signed short m_tower;
61  signed short m_PAC;
62 
63 };
64 
65 
67 {
68 
69  public:
70  L1RPCHwConfig();
71  virtual ~L1RPCHwConfig();
72 
73 
74 
75  bool isActive(int tower, int sector, int segment) const
76  {
77  return m_disabledDevices.find( L1RPCDevCoords(tower, sector, segment) )==m_disabledDevices.end();
78  };
79 
80  bool isActive(int tower, int PAC) const
81  {
82  return m_disabledDevices.end()==m_disabledDevices.find( L1RPCDevCoords(tower, PAC/12, PAC%12) );
83  };
84 
85  void enablePAC(int tower, int sector, int segment, bool enable);
86 
87  void enableTower(int tower, bool enable);
88 
89  void enableTowerInCrate(int tower, int crate, bool enable);
90 
91  void enableCrate(int logSector, bool enable); // logSector == crate number /// enables one crate, all towers
92 
93  void enableAll(bool enable);
94 
95  int size() const {return m_disabledDevices.size(); } ;
96  void dump() const {
97  for(std::set<L1RPCDevCoords>::const_iterator it=m_disabledDevices.begin(); it!=m_disabledDevices.end();++it){
98  std::cout << it->toString() << std::endl;
99  }
100  };
101 
102  // ---------- const member functions ---------------------
103 
104  // ---------- static member functions --------------------
105 
106  // ---------- member functions ---------------------------
107 
108 
109  private:
110 
111  std::set<L1RPCDevCoords> m_disabledDevices;
112 
113  // ---------- member data --------------------------------
114 
115 };
116 
117 
118 #endif
bool isActive(int tower, int PAC) const
Definition: L1RPCHwConfig.h:80
void enableTower(int tower, bool enable)
void enableCrate(int logSector, bool enable)
L1RPCDevCoords(int tower, int sector, int segment)
Definition: L1RPCHwConfig.h:36
void dump() const
Definition: L1RPCHwConfig.h:96
virtual ~L1RPCHwConfig()
bool isActive(int tower, int sector, int segment) const
Definition: L1RPCHwConfig.h:75
bool operator<(const L1RPCDevCoords &l2) const
Definition: L1RPCHwConfig.h:48
std::string toString() const
Definition: L1RPCHwConfig.h:42
int size() const
Definition: L1RPCHwConfig.h:95
void enableAll(bool enable)
signed short m_tower
Definition: L1RPCHwConfig.h:60
std::set< L1RPCDevCoords > m_disabledDevices
void enablePAC(int tower, int sector, int segment, bool enable)
signed short m_PAC
Definition: L1RPCHwConfig.h:61
void enableTowerInCrate(int tower, int crate, bool enable)
tuple cout
Definition: gather_cfg.py:121
bool operator==(const L1RPCDevCoords &l2) const
Definition: L1RPCHwConfig.h:54