Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:46:57

0001 #ifndef HcalChannelStatus_h
0002 #define HcalChannelStatus_h
0003 
0004 /* 
0005 \class HcalChannelStatus
0006 \author Radek Ofierzynski
0007 contains one channel status and corresponding DetId
0008 */
0009 
0010 #include "CondFormats/Serialization/interface/Serializable.h"
0011 #include <cstdint>
0012 
0013 class HcalChannelStatus {
0014 public:
0015   // contains the defined bits for easy access, see https://twiki.cern.ch/twiki/bin/view/CMS/HcalDataValidationWorkflow
0016   enum StatusBit {
0017     HcalCellOff = 0,   // 1=Hcal cell is off
0018     HcalCellMask = 1,  // 1=Hcal cell is masked/to be masked at RecHit Level
0019     // Quality Bits
0020     HcalCellDead = 5,                         // 1=Hcal cell is dead (from DQM algo)
0021     HcalCellHot = 6,                          // 1=Hcal cell is hot (from DQM algo)
0022     HcalCellStabErr = 7,                      // 1=Hcal cell has stability error
0023     HcalCellTimErr = 8,                       // 1=Hcal cell has timing error
0024     HcalCellExcludeFromHBHENoiseSummary = 9,  //1=cell is completely excluded from all HBHENoiseSummary computations
0025     HcalCellExcludeFromHBHENoiseSummaryR45 =
0026         10,  //1=cell's rechit is excluded when calculating the TS4TS5 ratio only in the HBHE Noise Summary
0027     HcalBadLaserSignal = 11,  //1 = channel does not receive good laser calibration signal
0028     // Trigger Bits
0029     HcalCellTrigMask = 15,  // 1=cell is masked from the Trigger
0030     // CaloTower Bits
0031     HcalCellCaloTowerMask = 18,  // 1=cell is always excluded from the CaloTower, regardless of other bit settings.
0032     HcalCellCaloTowerProb = 19   // 1=cell is counted as problematic within the tower.
0033   };
0034 
0035   HcalChannelStatus() : mId(0), mStatus(0) {}
0036   HcalChannelStatus(unsigned long fid, uint32_t status) : mId(fid), mStatus(status) {}
0037 
0038   //  void setDetId(unsigned long fid) {mId = fid;}
0039   void setValue(uint32_t value) { mStatus = value; }
0040 
0041   // for the following, one can use unsigned int values or HcalChannelStatus::StatusBit values
0042   //   e.g. 5 or HcalChannelStatus::HcalCellDead
0043   void setBit(unsigned int bitnumber) {
0044     uint32_t statadd = 0x1 << (bitnumber);
0045     mStatus = mStatus | statadd;
0046   }
0047   void unsetBit(unsigned int bitnumber) {
0048     uint32_t statadd = 0x1 << (bitnumber);
0049     statadd = ~statadd;
0050     mStatus = mStatus & statadd;
0051   }
0052 
0053   bool isBitSet(unsigned int bitnumber) const {
0054     uint32_t statadd = 0x1 << (bitnumber);
0055     return (mStatus & statadd) ? (true) : (false);
0056   }
0057 
0058   uint32_t rawId() const { return mId; }
0059 
0060   uint32_t getValue() const { return mStatus; }
0061 
0062 private:
0063   uint32_t mId;
0064   uint32_t mStatus;
0065 
0066   COND_SERIALIZABLE;
0067 };
0068 #endif