CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <boost/cstdint.hpp>
13 #include <string>
14 
16 {
17  public:
18  // contains the defined bits for easy access, see https://twiki.cern.ch/twiki/bin/view/CMS/CastorDataValidationWorkflow
19  /* Original Hcal stuff
20  enum StatusBit {
21  HcalCellOff=0, // 1=Hcal cell is off
22  HcalCellL1Mask=1, // 1=Hcal cell is masked/to be masked by L1 trigger
23  HcalCellDead=5, // 1=Hcal cell is dead (from DQM algo)
24  HcalCellHot=6, // 1=Hcal cell is hot (from DQM algo)
25  HcalCellStabErr=7, // 1=Hcal cell has stability error
26  HcalCellTimErr=8 // 1=Hcal cell has timing error
27  };*/
28  enum StatusBit {
29  UNKNOWN = 0,
30  BAD = 1,
31  GOOD = 2,
32  HOT = 3,
33  DEAD = 4,
34  END = 5
35  };
36 
38  CastorChannelStatus(unsigned long fid, uint32_t status): mId(fid), mStatus(status) {}
39  CastorChannelStatus(unsigned long fid, std::string status): mId(fid)
40  {
41  if (status=="BAD") mStatus = BAD;
42  else if (status=="GOOD") mStatus = GOOD;
43  else if (status=="HOT") mStatus = HOT;
44  else if (status=="DEAD") mStatus = DEAD;
45  else if (status=="END") mStatus = END;
46  else mStatus = UNKNOWN;
47  }
48 
49  // void setDetId(unsigned long fid) {mId = fid;}
50  void setValue(uint32_t value) {mStatus = value;}
51 
52  // for the following, one can use unsigned int values or CastorChannelStatus::StatusBit values
53  // e.g. 4 or CastorChannelStatus::DEAD
54  void setBit(unsigned int bitnumber)
55  {
56  uint32_t statadd = 0x1<<(bitnumber);
57  mStatus = mStatus|statadd;
58  }
59  void unsetBit(unsigned int bitnumber)
60  {
61  uint32_t statadd = 0x1<<(bitnumber);
62  statadd = ~statadd;
63  mStatus = mStatus&statadd;
64  }
65 
66  bool isBitSet(unsigned int bitnumber) const
67  {
68  uint32_t statadd = 0x1<<(bitnumber);
69  return (mStatus&statadd)?(true):(false);
70  }
71 
72  uint32_t rawId() const {return mId;}
73 
74  uint32_t getValue() const {return mStatus;}
75 
76  private:
77  uint32_t mId;
78  uint32_t mStatus;
79 
80 
82 };
83 #endif
CastorChannelStatus(unsigned long fid, uint32_t status)
void unsetBit(unsigned int bitnumber)
bool isBitSet(unsigned int bitnumber) const
CastorChannelStatus(unsigned long fid, std::string status)
uint32_t getValue() const
#define COND_SERIALIZABLE
Definition: Serializable.h:37
void setValue(uint32_t value)
void setBit(unsigned int bitnumber)
uint32_t rawId() const
tuple status
Definition: mps_update.py:57