CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/CondFormats/CastorObjects/interface/CastorChannelStatus.h

Go to the documentation of this file.
00001 #ifndef CastorChannelStatus_h
00002 #define CastorChannelStatus_h
00003 
00004 /* 
00005 \class CastorChannelStatus
00006 \author Radek Ofierzynski
00007 contains one channel status and corresponding DetId
00008 */
00009 
00010 #include <boost/cstdint.hpp>
00011 #include <string>
00012 
00013 class CastorChannelStatus
00014 {
00015  public:
00016   // contains the defined bits for easy access, see https://twiki.cern.ch/twiki/bin/view/CMS/CastorDataValidationWorkflow
00017   /* Original Hcal stuff
00018   enum StatusBit {       
00019     HcalCellOff=0,      // 1=Hcal cell is off
00020     HcalCellL1Mask=1,   // 1=Hcal cell is masked/to be masked by L1 trigger
00021     HcalCellDead=5,     // 1=Hcal cell is dead (from DQM algo)
00022     HcalCellHot=6,      // 1=Hcal cell is hot (from DQM algo)
00023     HcalCellStabErr=7,  // 1=Hcal cell has stability error
00024     HcalCellTimErr=8    // 1=Hcal cell has timing error
00025   };*/
00026   enum StatusBit {
00027     UNKNOWN = 0,
00028     BAD = 1,
00029     GOOD = 2,
00030     HOT = 3,
00031     DEAD = 4,
00032     END = 5
00033   };
00034 
00035   CastorChannelStatus(): mId(0), mStatus(0) {}
00036   CastorChannelStatus(unsigned long fid, uint32_t status): mId(fid), mStatus(status) {}
00037   CastorChannelStatus(unsigned long fid, std::string status): mId(fid)
00038                      {
00039                         if      (status=="BAD")    mStatus = BAD;
00040                         else if (status=="GOOD")   mStatus = GOOD;
00041                         else if (status=="HOT")    mStatus = HOT;
00042                         else if (status=="DEAD")   mStatus = DEAD;
00043                         else if (status=="END")    mStatus = END;
00044                         else                       mStatus = UNKNOWN;
00045                      }
00046 
00047   //  void setDetId(unsigned long fid) {mId = fid;}
00048   void setValue(uint32_t value) {mStatus = value;}
00049 
00050   // for the following, one can use unsigned int values or CastorChannelStatus::StatusBit values
00051   //   e.g. 4 or CastorChannelStatus::DEAD
00052   void setBit(unsigned int bitnumber) 
00053   {
00054     uint32_t statadd = 0x1<<(bitnumber);
00055     mStatus = mStatus|statadd;
00056   }
00057   void unsetBit(unsigned int bitnumber) 
00058   {
00059     uint32_t statadd = 0x1<<(bitnumber);
00060     statadd = ~statadd;
00061     mStatus = mStatus&statadd;
00062   }
00063   
00064   bool isBitSet(unsigned int bitnumber) const
00065   {
00066     uint32_t statadd = 0x1<<(bitnumber);
00067     return (mStatus&statadd)?(true):(false);
00068   }
00069   
00070   uint32_t rawId() const {return mId;}
00071   
00072   uint32_t getValue() const {return mStatus;}
00073   
00074  private:
00075   uint32_t mId;
00076   uint32_t mStatus;
00077 
00078 };
00079 #endif