CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/CondFormats/HcalObjects/interface/HcalChannelStatus.h

Go to the documentation of this file.
00001 #ifndef HcalChannelStatus_h
00002 #define HcalChannelStatus_h
00003 
00004 /* 
00005 \class HcalChannelStatus
00006 \author Radek Ofierzynski
00007 contains one channel status and corresponding DetId
00008 */
00009 
00010 #include <boost/cstdint.hpp>
00011 
00012 
00013 class HcalChannelStatus
00014 {
00015  public:
00016   // contains the defined bits for easy access, see https://twiki.cern.ch/twiki/bin/view/CMS/HcalDataValidationWorkflow
00017   enum StatusBit {       
00018     HcalCellOff=0,             // 1=Hcal cell is off
00019     HcalCellMask=1,            // 1=Hcal cell is masked/to be masked at RecHit Level
00020     // Quality Bits
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     // Trigger Bits
00026     HcalCellTrigMask=15,       // 1=cell is masked from the Trigger 
00027     // CaloTower Bits
00028     HcalCellCaloTowerMask=18,  // 1=cell is always excluded from the CaloTower, regardless of other bit settings.
00029     HcalCellCaloTowerProb=19   // 1=cell is counted as problematic within the tower.
00030   };
00031 
00032   HcalChannelStatus(): mId(0), mStatus(0) {}
00033   HcalChannelStatus(unsigned long fid, uint32_t status): mId(fid), mStatus(status) {}
00034 
00035   //  void setDetId(unsigned long fid) {mId = fid;}
00036   void setValue(uint32_t value) {mStatus = value;}
00037 
00038   // for the following, one can use unsigned int values or HcalChannelStatus::StatusBit values
00039   //   e.g. 5 or HcalChannelStatus::HcalCellDead
00040   void setBit(unsigned int bitnumber) 
00041   {
00042     uint32_t statadd = 0x1<<(bitnumber);
00043     mStatus = mStatus|statadd;
00044   }
00045   void unsetBit(unsigned int bitnumber) 
00046   {
00047     uint32_t statadd = 0x1<<(bitnumber);
00048     statadd = ~statadd;
00049     mStatus = mStatus&statadd;
00050   }
00051   
00052   bool isBitSet(unsigned int bitnumber) const
00053   {
00054     uint32_t statadd = 0x1<<(bitnumber);
00055     return (mStatus&statadd)?(true):(false);
00056   }
00057   
00058   uint32_t rawId() const {return mId;}
00059   
00060   uint32_t getValue() const {return mStatus;}
00061   
00062  private:
00063   uint32_t mId;
00064   uint32_t mStatus;
00065 
00066 };
00067 #endif