Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:38:50

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 #include <cstdint>
0017 
0018 class CTPPSPixelDataError {
0019 public:
0020   /// Default constructor

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

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

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

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

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

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

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

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

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

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