Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:12

0001 #ifndef DataFormats_CTPPSPixelDataError_h
0002 #define DataFormats_CTPPSPixelDataError_h
0003 
0004 //---------------------------------------------------------------------------

0005 //!  \class CTPPSPixelDataError

0006 //!  \brief Pixel error -- collection of errors

0007 //!

0008 //!  Class storing info about pixel errors

0009 //!

0010 //---------------------------------------------------------------------------

0011 
0012 #include "FWCore/Utilities/interface/typedefs.h"
0013 
0014 #include <string>
0015 #include <array>
0016 
0017 class CTPPSPixelDataError {
0018 public:
0019   /// Default constructor

0020   CTPPSPixelDataError();
0021   /// Constructor for 32-bit error word

0022   CTPPSPixelDataError(uint32_t errorWord32, const int errorType, int fedId);
0023   /// Constructor with 64-bit error word and type included (header or trailer word)

0024   CTPPSPixelDataError(uint64_t errorWord64, const int errorType, int fedId);
0025   /// Destructor

0026   ~CTPPSPixelDataError();
0027 
0028   /// the 32-bit word that contains the error information

0029   inline uint32_t errorWord32() const { return errorWord32_; }
0030   /// the 64-bit word that contains the error information

0031   inline uint64_t errorWord64() const { return errorWord64_; }
0032   /// the number associated with the error type (26-31 for ROC number errors, 32-33 for calibration errors)

0033   inline int errorType() const { return errorType_; }
0034   /// the fedId where the error occured

0035   inline int fedId() const { return fedId_; }
0036   /// the error message to be displayed with the error

0037   inline const std::string& errorMessage() const {
0038     if (errorType_ >= 25 && errorType_ <= 37)
0039       return errorMessages_[errorType_ - 24];
0040     return errorMessages_[0];
0041   }
0042 
0043 private:
0044   static const std::array<std::string, 14> errorMessages_;
0045 
0046   uint64_t errorWord64_;
0047   uint32_t errorWord32_;
0048   int errorType_;
0049   int fedId_;
0050 };
0051 
0052 /// Comparison operators

0053 inline bool operator<(const CTPPSPixelDataError& one, const CTPPSPixelDataError& other) {
0054   return one.fedId() < other.fedId();
0055 }
0056 
0057 #endif