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