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
L1RPCDevCoords::m_PAC
signed short m_PAC
Definition: L1RPCHwConfig.h:60
remoteMonitoring_LED_IterMethod_cfg.enable
enable
Definition: remoteMonitoring_LED_IterMethod_cfg.py:423
gather_cfg.cout
cout
Definition: gather_cfg.py:144
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
L1RPCHwConfig::isActive
bool isActive(int tower, int sector, int segment) const
Definition: L1RPCHwConfig.h:70
L1RPCDevCoords::getPAC
int getPAC()
Definition: L1RPCHwConfig.h:40
L1RPCDevCoords::toString
std::string toString() const
Definition: L1RPCHwConfig.h:44
L1RPCDevCoords::getTower
int getTower()
Definition: L1RPCHwConfig.h:39
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
L1RPCHwConfig::enableTower
void enableTower(int tower, bool enable)
Definition: L1RPCHwConfig.cc:50
L1RPCHwConfig::L1RPCHwConfig
L1RPCHwConfig()
Definition: L1RPCHwConfig.cc:31
L1RPCDevCoords::getSector
int getSector()
Definition: L1RPCHwConfig.h:41
L1RPCHwConfig::enableAll
void enableAll(bool enable)
Definition: L1RPCHwConfig.cc:72
L1RPCHwConfig::~L1RPCHwConfig
virtual ~L1RPCHwConfig()
Definition: L1RPCHwConfig.cc:38
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1RPCDevCoords::operator<
bool operator<(const L1RPCDevCoords &l2) const
Definition: L1RPCHwConfig.h:50
L1RPCHwConfig
Definition: L1RPCHwConfig.h:65
L1RPCHwConfig::dump
void dump() const
Definition: L1RPCHwConfig.h:89
L1RPCDevCoords::operator==
bool operator==(const L1RPCDevCoords &l2) const
Definition: L1RPCHwConfig.h:56
L1RPCHwConfig::size
int size() const
Definition: L1RPCHwConfig.h:88
Serializable.h
L1RPCDevCoords
Definition: L1RPCHwConfig.h:35
L1RPCDevCoords::m_tower
signed short m_tower
Definition: L1RPCHwConfig.h:59
L1RPCDevCoords::L1RPCDevCoords
L1RPCDevCoords(int tower, int sector, int segment)
Definition: L1RPCHwConfig.h:38
L1RPCHwConfig::enablePAC
void enablePAC(int tower, int sector, int segment, bool enable)
Definition: L1RPCHwConfig.cc:40
L1RPCHwConfig::m_disabledDevices
std::set< L1RPCDevCoords > m_disabledDevices
Definition: L1RPCHwConfig.h:93
L1RPCHwConfig::enableTowerInCrate
void enableTowerInCrate(int tower, int crate, bool enable)
Definition: L1RPCHwConfig.cc:58
L1RPCDevCoords::getSegment
int getSegment()
Definition: L1RPCHwConfig.h:42
L1RPCHwConfig::isActive
bool isActive(int tower, int PAC) const
Definition: L1RPCHwConfig.h:74
L1RPCHwConfig::enableCrate
void enableCrate(int logSector, bool enable)
Definition: L1RPCHwConfig.cc:64
L1RPCDevCoords::L1RPCDevCoords
L1RPCDevCoords()
Definition: L1RPCHwConfig.h:37