Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:55

0001 /*
0002  * =====================================================================================
0003  *
0004  *       Filename:  CSCDQM_DCSData.h
0005  *
0006  *    Description:  CSCDQM DCS Objects
0007  *
0008  *        Version:  1.0
0009  *        Created:  05/04/2009 11:20:18 AM
0010  *       Revision:  none
0011  *       Compiler:  gcc
0012  *
0013  *         Author:  Valdas Rapsevicius (VR), valdas.rapsevicius@cern.ch
0014  *        Company:  CERN, CH
0015  *
0016  * =====================================================================================
0017  */
0018 
0019 #ifndef CSCDQM_DCSDATA_H
0020 #define CSCDQM_DCSDATA_H
0021 
0022 #include "CondFormats/Serialization/interface/Serializable.h"
0023 
0024 #include <vector>
0025 
0026 #include "CondFormats/CSCObjects/interface/CSCDQM_DCSBase.h"
0027 
0028 namespace cscdqm {
0029 
0030   /**
0031    * Temperature measurement
0032    */
0033   struct TempMeasType {
0034     DCSAddressType adr;
0035     DCSBoardType board;
0036     unsigned short boardId;
0037     int value;
0038 
0039     friend std::ostream& operator<<(std::ostream& out, const TempMeasType& m) {
0040       std::ostringstream os;
0041       os << m.adr << " ";
0042       os << DCSBoardUtility(m.board);
0043       if (m.board == CFEB) {
0044         os << m.boardId;
0045       }
0046       os << " temp = " << m.value << "oC";
0047       return out << os.str();
0048     }
0049 
0050     TempMeasType& operator=(const TempMeasType& m) {
0051       adr = m.adr;
0052       board = m.board;
0053       boardId = m.boardId;
0054       value = m.value;
0055       return *this;
0056     }
0057 
0058     COND_SERIALIZABLE;
0059   };
0060 
0061   /**
0062    * HV V measurement
0063    */
0064   struct HVVMeasType {
0065     DCSAddressType adr;
0066     unsigned int position;
0067     int value;
0068 
0069     friend std::ostream& operator<<(std::ostream& out, const HVVMeasType& m) {
0070       std::ostringstream os;
0071       os << m.adr << " ";
0072       os << "position:" << m.position;
0073       os << " V = " << m.value << "V";
0074       return out << os.str();
0075     }
0076 
0077     HVVMeasType& operator=(const HVVMeasType& m) {
0078       adr = m.adr;
0079       position = m.position;
0080       value = m.value;
0081       return *this;
0082     }
0083 
0084     COND_SERIALIZABLE;
0085   };
0086 
0087   /**
0088    * LV V measurement
0089    */
0090   struct LVVMeasType {
0091     DCSAddressType adr;
0092     DCSBoardType board;
0093     unsigned int boardId;
0094     float nominal_v;
0095 
0096     friend std::ostream& operator<<(std::ostream& out, const LVVMeasType& m) {
0097       std::ostringstream os;
0098       os << m.adr << " ";
0099       os << DCSBoardUtility(m.board);
0100       if (m.board == CFEB) {
0101         os << m.boardId;
0102       }
0103       os << " " << m.nominal_v << "V";
0104       return out << os.str();
0105     }
0106 
0107     LVVMeasType& operator=(const LVVMeasType& m) {
0108       adr = m.adr;
0109       board = m.board;
0110       boardId = m.boardId;
0111       nominal_v = m.nominal_v;
0112       return *this;
0113     }
0114 
0115     COND_SERIALIZABLE;
0116   };
0117 
0118   /**
0119    * LV I measurement
0120    */
0121   struct LVIMeasType {
0122     DCSAddressType adr;
0123     DCSBoardType board;
0124     unsigned int boardId;
0125     float nominal_v;
0126     float value;
0127 
0128     friend std::ostream& operator<<(std::ostream& out, const LVIMeasType& m) {
0129       std::ostringstream os;
0130       os << m.adr << " ";
0131       os << DCSBoardUtility(m.board);
0132       if (m.board == CFEB) {
0133         os << m.boardId;
0134       }
0135       os << " " << m.nominal_v << "V";
0136       os << " " << m.value << "A";
0137       return out << os.str();
0138     }
0139 
0140     LVIMeasType& operator=(const LVIMeasType& m) {
0141       adr = m.adr;
0142       board = m.board;
0143       boardId = m.boardId;
0144       nominal_v = m.nominal_v;
0145       value = m.value;
0146       return *this;
0147     }
0148 
0149     COND_SERIALIZABLE;
0150   };
0151 
0152   /**
0153    * @class DCSData
0154    * @brief CSC DCS Data type
0155    */
0156   class DCSData {
0157   public:
0158     DCSData();
0159     virtual ~DCSData();
0160 
0161     /** Temperature exceptions */
0162     std::vector<TempMeasType> temp_meas;
0163 
0164     /** HV V exceptions */
0165     std::vector<HVVMeasType> hvv_meas;
0166 
0167     /** LV V exceptions */
0168     std::vector<LVVMeasType> lvv_meas;
0169 
0170     /** LV I exceptions */
0171     std::vector<LVIMeasType> lvi_meas;
0172 
0173     /** Temperature mode (most frequent value) */
0174     int temp_mode;
0175 
0176     /** HV V mode (most frequent value) */
0177     int hvv_mode;
0178 
0179     /** LV V mode (most frequent value) */
0180     bool lvv_mode;
0181 
0182     /** LV I mode (most frequent value) */
0183     float lvi_mode;
0184 
0185     /** This payload IOV value: timestamp since */
0186     TimeType iov;
0187 
0188     /** This payload last DCS data change value */
0189     TimeType last_change;
0190 
0191     DCSData& operator=(const DCSData& m) {
0192       iov = m.iov;
0193       last_change = m.last_change;
0194       temp_meas = m.temp_meas;
0195       hvv_meas = m.hvv_meas;
0196       lvv_meas = m.lvv_meas;
0197       lvi_meas = m.lvi_meas;
0198       temp_mode = m.temp_mode;
0199       hvv_mode = m.hvv_mode;
0200       lvv_mode = m.lvv_mode;
0201       lvi_mode = m.lvi_mode;
0202       return *this;
0203     }
0204 
0205     COND_SERIALIZABLE;
0206   };
0207 
0208 }  // namespace cscdqm
0209 
0210 #endif