Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:37:02

0001 #ifndef CondFormats_EcalObjects_EcalChannelStatusCode_H
0002 #define CondFormats_EcalObjects_EcalChannelStatusCode_H
0003 /**
0004  * Author: Paolo Meridiani
0005  * Created: 14 Nov 2006
0006  **/
0007 
0008 #include "CondFormats/Serialization/interface/Serializable.h"
0009 
0010 #include <iostream>
0011 #include <cstdint>
0012 
0013 /**
0014    
0015 
0016  */
0017 
0018 class EcalChannelStatusCode {
0019 public:
0020   enum Code {
0021     kOk = 0,
0022     kDAC,
0023     kNoLaser,
0024     kNoisy,
0025     kNNoisy,
0026     kNNNoisy,
0027     kNNNNoisy,
0028     kNNNNNoisy,
0029     kFixedG6,
0030     kFixedG1,
0031     kFixedG0,
0032     kNonRespondingIsolated,
0033     kDeadVFE,
0034     kDeadFE,
0035     kNoDataNoTP
0036   };
0037 
0038   enum Bits { kHV = 0, kLV, kDAQ, kTP, kTrigger, kTemperature, kNextToDead };
0039 
0040 public:
0041   EcalChannelStatusCode() : status_(0) {}
0042   EcalChannelStatusCode(const uint16_t& encodedStatus) : status_(encodedStatus){};
0043 
0044   void print(std::ostream& s) const { s << "status is: " << status_; }
0045 
0046   /// return decoded status
0047   Code getStatusCode() const { return Code(status_ & chStatusMask); }
0048 
0049   /// Return the encoded raw status
0050   uint16_t getEncodedStatusCode() const { return status_; }
0051 
0052   /// Check status of desired bit
0053   bool checkBit(Bits bit) { return status_ & (0x1 << (bit + kBitsOffset)); }
0054 
0055   static const int chStatusMask = 0x1F;
0056 
0057 private:
0058   static const int kBitsOffset = 5;
0059   /* bits 1-5 store a status code:
0060         0   channel ok 
0061     1   DAC settings problem, pedestal not in the design range  
0062     2   channel with no laser, ok elsewhere    
0063     3   noisy   
0064     4   very noisy  
0065     5-7     reserved for more categories of noisy channels  
0066     8   channel at fixed gain 6 (or 6 and 1)
0067     9   channel at fixed gain 1     
0068     10  channel at fixed gain 0 (dead of type this)     
0069     11  non responding isolated channel (dead of type other) 
0070     12  channel and one or more neigbors not responding 
0071                 (e.g.: in a dead VFE 5x1 channel)   
0072     13  channel in TT with no data link, TP data ok    
0073     14  channel in TT with no data link and no TP data  
0074 
0075     bit 6 : HV on/off
0076         bit 7 : LV on/off
0077         bit 8 : DAQ in/out   
0078         bit 9 : TP readout on/off    
0079         bit 10: Trigger in/out   
0080         bit 11: Temperature ok/not ok    
0081         bit 12: channel next to a dead channel 
0082      */
0083   uint16_t status_;
0084 
0085   COND_SERIALIZABLE;
0086 };
0087 #endif