File indexing completed on 2024-04-06 12:01:57
0001 #ifndef CastorChannelStatus_h
0002 #define CastorChannelStatus_h
0003
0004
0005
0006
0007
0008
0009
0010 #include "CondFormats/Serialization/interface/Serializable.h"
0011
0012 #include <string>
0013 #include <cstdint>
0014
0015 class CastorChannelStatus {
0016 public:
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 enum StatusBit { UNKNOWN = 0, BAD = 1, GOOD = 2, HOT = 3, DEAD = 4, END = 5 };
0028
0029 CastorChannelStatus() : mId(0), mStatus(0) {}
0030 CastorChannelStatus(unsigned long fid, uint32_t status) : mId(fid), mStatus(status) {}
0031 CastorChannelStatus(unsigned long fid, std::string status) : mId(fid) {
0032 if (status == "BAD")
0033 mStatus = BAD;
0034 else if (status == "GOOD")
0035 mStatus = GOOD;
0036 else if (status == "HOT")
0037 mStatus = HOT;
0038 else if (status == "DEAD")
0039 mStatus = DEAD;
0040 else if (status == "END")
0041 mStatus = END;
0042 else
0043 mStatus = UNKNOWN;
0044 }
0045
0046
0047 void setValue(uint32_t value) { mStatus = value; }
0048
0049
0050
0051 void setBit(unsigned int bitnumber) {
0052 uint32_t statadd = 0x1 << (bitnumber);
0053 mStatus = mStatus | statadd;
0054 }
0055 void unsetBit(unsigned int bitnumber) {
0056 uint32_t statadd = 0x1 << (bitnumber);
0057 statadd = ~statadd;
0058 mStatus = mStatus & statadd;
0059 }
0060
0061 bool isBitSet(unsigned int bitnumber) const {
0062 uint32_t statadd = 0x1 << (bitnumber);
0063 return (mStatus & statadd) ? (true) : (false);
0064 }
0065
0066 uint32_t rawId() const { return mId; }
0067
0068 uint32_t getValue() const { return mStatus; }
0069
0070 private:
0071 uint32_t mId;
0072 uint32_t mStatus;
0073
0074 COND_SERIALIZABLE;
0075 };
0076 #endif