CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/CondFormats/CSCObjects/interface/CSCDQM_DCSBase.h

Go to the documentation of this file.
00001 /*
00002  * =====================================================================================
00003  *
00004  *       Filename:  CSCDQM_DCSBase.h
00005  *
00006  *    Description:  CSCDQM DCS Base Objects
00007  *
00008  *        Version:  1.0
00009  *        Created:  05/04/2009 11:10:14 AM
00010  *       Revision:  none
00011  *       Compiler:  gcc
00012  *
00013  *         Author:  Valdas Rapsevicius (VR), valdas.rapsevicius@cern.ch
00014  *        Company:  CERN, CH
00015  *
00016  * =====================================================================================
00017  */
00018 
00019 #ifndef CSCDQM_DCSBASE_H
00020 #define CSCDQM_DCSBASE_H
00021 
00022 #include <iostream>
00023 #include <sstream>
00024 
00025 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00026 
00027 namespace cscdqm {
00028 
00030   typedef long long TimeType;
00031 
00033   enum DCSBoardType {
00034     ANY  = 0,
00035     ALCT = 1,
00036     CFEB = 2,
00037     DMB  = 3
00038   };
00039 
00041   struct DCSBoardUtility {
00042     
00043     DCSBoardType boardType;
00044     DCSBoardUtility(const DCSBoardType boardType_) : boardType(boardType_) { }
00045 
00051     static DCSBoardType getDCSBoard(const std::string board) {
00052       if (board.compare("ALCT")) return ALCT;
00053       if (board.compare("CFEB")) return CFEB;
00054       if (board.compare("DMB"))  return DMB;
00055       return ANY;
00056     }
00057 
00058     friend std::ostream& operator<<(std::ostream& out, const DCSBoardUtility& b) {
00059       switch (b.boardType) {
00060         case ANY:
00061           return out << "ANY";
00062         case ALCT:
00063           return out << "ALCT";
00064         case CFEB:
00065           return out << "CFEB";
00066         case DMB:
00067           return out << "DMB";
00068       }
00069       return out << "?";
00070     }
00071 
00072   };
00073 
00077   struct DCSAddressType {
00078 
00080     unsigned short iendcap;
00081 
00083     unsigned short istation;
00084 
00086     unsigned short iring;
00087 
00089     unsigned int   ichamber;
00090 
00092     CSCDetId getDetId() const {
00093       return CSCDetId(iendcap, istation, iring, ichamber);
00094     }
00095 
00097     DCSAddressType& operator=(const DCSAddressType& a) {
00098       iendcap = a.iendcap;
00099       istation = a.istation;
00100       iring = a.iring;
00101       ichamber = a.ichamber;
00102       return *this;
00103     }
00104 
00106     friend std::ostream& operator<<(std::ostream& out, const DCSAddressType& a) {
00107       std::ostringstream os;
00108       os << "endcap = " << a.iendcap << " ";
00109       os << "station = " << a.istation << " ";
00110       os << "ring = " << a.iring << " ";
00111       os << "chamber = " << a.ichamber;
00112       return out << os.str();
00113     }
00114 
00115   };
00116 
00117 }
00118 
00119 #endif