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::mId
uint32_t mId
Definition: CastorChannelStatus.h:71
mps_update.status
status
Definition: mps_update.py:69
CastorChannelStatus::StatusBit
StatusBit
Definition: CastorChannelStatus.h:27
CastorChannelStatus::CastorChannelStatus
CastorChannelStatus(unsigned long fid, std::string status)
Definition: CastorChannelStatus.h:31
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
CastorChannelStatus::DEAD
Definition: CastorChannelStatus.h:27
CastorChannelStatus::BAD
Definition: CastorChannelStatus.h:27
CastorChannelStatus::GOOD
Definition: CastorChannelStatus.h:27
CastorChannelStatus::END
Definition: CastorChannelStatus.h:27
CastorChannelStatus::CastorChannelStatus
CastorChannelStatus()
Definition: CastorChannelStatus.h:29
CastorChannelStatus::setBit
void setBit(unsigned int bitnumber)
Definition: CastorChannelStatus.h:51
CastorChannelStatus::mStatus
uint32_t mStatus
Definition: CastorChannelStatus.h:72
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CastorChannelStatus::unsetBit
void unsetBit(unsigned int bitnumber)
Definition: CastorChannelStatus.h:55
Serializable.h
CastorChannelStatus::getValue
uint32_t getValue() const
Definition: CastorChannelStatus.h:68
value
Definition: value.py:1
CastorChannelStatus::rawId
uint32_t rawId() const
Definition: CastorChannelStatus.h:66
CastorChannelStatus::isBitSet
bool isBitSet(unsigned int bitnumber) const
Definition: CastorChannelStatus.h:61
CastorChannelStatus
Definition: CastorChannelStatus.h:15
CastorChannelStatus::CastorChannelStatus
CastorChannelStatus(unsigned long fid, uint32_t status)
Definition: CastorChannelStatus.h:30
relativeConstraints.value
value
Definition: relativeConstraints.py:53
CastorChannelStatus::HOT
Definition: CastorChannelStatus.h:27
CastorChannelStatus::UNKNOWN
Definition: CastorChannelStatus.h:27
CastorChannelStatus::setValue
void setValue(uint32_t value)
Definition: CastorChannelStatus.h:47