CMS 3D CMS Logo

CastorChannelStatus.h
Go to the documentation of this file.
1 #ifndef CastorChannelStatus_h
2 #define CastorChannelStatus_h
3 
4 /*
5 \class CastorChannelStatus
6 \author Radek Ofierzynski
7 contains one channel status and corresponding DetId
8 */
9 
11 
12 #include <string>
13 #include <cstdint>
14 
16 public:
17  // contains the defined bits for easy access, see https://twiki.cern.ch/twiki/bin/view/CMS/CastorDataValidationWorkflow
18  /* Original Hcal stuff
19  enum StatusBit {
20  HcalCellOff=0, // 1=Hcal cell is off
21  HcalCellL1Mask=1, // 1=Hcal cell is masked/to be masked by L1 trigger
22  HcalCellDead=5, // 1=Hcal cell is dead (from DQM algo)
23  HcalCellHot=6, // 1=Hcal cell is hot (from DQM algo)
24  HcalCellStabErr=7, // 1=Hcal cell has stability error
25  HcalCellTimErr=8 // 1=Hcal cell has timing error
26  };*/
27  enum StatusBit { UNKNOWN = 0, BAD = 1, GOOD = 2, HOT = 3, DEAD = 4, END = 5 };
28 
30  CastorChannelStatus(unsigned long fid, uint32_t status) : mId(fid), mStatus(status) {}
31  CastorChannelStatus(unsigned long fid, std::string status) : mId(fid) {
32  if (status == "BAD")
33  mStatus = BAD;
34  else if (status == "GOOD")
35  mStatus = GOOD;
36  else if (status == "HOT")
37  mStatus = HOT;
38  else if (status == "DEAD")
39  mStatus = DEAD;
40  else if (status == "END")
41  mStatus = END;
42  else
43  mStatus = UNKNOWN;
44  }
45 
46  // void setDetId(unsigned long fid) {mId = fid;}
47  void setValue(uint32_t value) { mStatus = value; }
48 
49  // for the following, one can use unsigned int values or CastorChannelStatus::StatusBit values
50  // e.g. 4 or CastorChannelStatus::DEAD
51  void setBit(unsigned int bitnumber) {
52  uint32_t statadd = 0x1 << (bitnumber);
53  mStatus = mStatus | statadd;
54  }
55  void unsetBit(unsigned int bitnumber) {
56  uint32_t statadd = 0x1 << (bitnumber);
57  statadd = ~statadd;
58  mStatus = mStatus & statadd;
59  }
60 
61  bool isBitSet(unsigned int bitnumber) const {
62  uint32_t statadd = 0x1 << (bitnumber);
63  return (mStatus & statadd) ? (true) : (false);
64  }
65 
66  uint32_t rawId() const { return mId; }
67 
68  uint32_t getValue() const { return mStatus; }
69 
70 private:
71  uint32_t mId;
72  uint32_t mStatus;
73 
75 };
76 #endif
CastorChannelStatus(unsigned long fid, uint32_t status)
void unsetBit(unsigned int bitnumber)
uint32_t rawId() const
CastorChannelStatus(unsigned long fid, std::string status)
bool isBitSet(unsigned int bitnumber) const
Definition: value.py:1
uint32_t getValue() const
#define COND_SERIALIZABLE
Definition: Serializable.h:39
void setValue(uint32_t value)
void setBit(unsigned int bitnumber)