CMS 3D CMS Logo

CSCDQM_DCSBase.h
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: CSCDQM_DCSBase.h
5  *
6  * Description: CSCDQM DCS Base Objects
7  *
8  * Version: 1.0
9  * Created: 05/04/2009 11:10:14 AM
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: Valdas Rapsevicius (VR), valdas.rapsevicius@cern.ch
14  * Company: CERN, CH
15  *
16  * =====================================================================================
17  */
18 
19 #ifndef CSCDQM_DCSBASE_H
20 #define CSCDQM_DCSBASE_H
21 
23 
24 #include <iostream>
25 #include <sstream>
26 
28 
29 namespace cscdqm {
30 
32  typedef long long TimeType;
33 
35  enum DCSBoardType {
36  ANY = 0,
37  ALCT = 1,
38  CFEB = 2,
39  DMB = 3
40  };
41 
43  struct DCSBoardUtility {
44 
46  DCSBoardUtility(const DCSBoardType boardType_) : boardType(boardType_) { }
47 
53  static DCSBoardType getDCSBoard(const std::string board) {
54  if (board.compare("ALCT")) return ALCT;
55  if (board.compare("CFEB")) return CFEB;
56  if (board.compare("DMB")) return DMB;
57  return ANY;
58  }
59 
60  friend std::ostream& operator<<(std::ostream& out, const DCSBoardUtility& b) {
61  switch (b.boardType) {
62  case ANY:
63  return out << "ANY";
64  case ALCT:
65  return out << "ALCT";
66  case CFEB:
67  return out << "CFEB";
68  case DMB:
69  return out << "DMB";
70  }
71  return out << "?";
72  }
73 
74  };
75 
79  struct DCSAddressType {
80 
82  unsigned short iendcap;
83 
85  unsigned short istation;
86 
88  unsigned short iring;
89 
91  unsigned int ichamber;
92 
94  CSCDetId getDetId() const {
95  return CSCDetId(iendcap, istation, iring, ichamber);
96  }
97 
100  iendcap = a.iendcap;
101  istation = a.istation;
102  iring = a.iring;
103  ichamber = a.ichamber;
104  return *this;
105  }
106 
108  friend std::ostream& operator<<(std::ostream& out, const DCSAddressType& a) {
109  std::ostringstream os;
110  os << "endcap = " << a.iendcap << " ";
111  os << "station = " << a.istation << " ";
112  os << "ring = " << a.iring << " ";
113  os << "chamber = " << a.ichamber;
114  return out << os.str();
115  }
116 
117 
119 };
120 
121 }
122 
123 #endif
unsigned short iendcap
long long TimeType
friend std::ostream & operator<<(std::ostream &out, const DCSAddressType &a)
unsigned short istation
unsigned short iring
static DCSBoardType getDCSBoard(const std::string board)
Get DCSBoardType from string.
friend std::ostream & operator<<(std::ostream &out, const DCSBoardUtility &b)
DCSAddressType & operator=(const DCSAddressType &a)
double b
Definition: hdecay.h:120
#define COND_SERIALIZABLE
Definition: Serializable.h:38
double a
Definition: hdecay.h:121
DCSBoardUtility(const DCSBoardType boardType_)
CSCDetId getDetId() const