CTPPSPixelDataError

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#ifndef DataFormats_CTPPSPixelDataError_h
#define DataFormats_CTPPSPixelDataError_h

//---------------------------------------------------------------------------
//!  \class CTPPSPixelDataError
//!  \brief Pixel error -- collection of errors
//!
//!  Class storing info about pixel errors
//!
//---------------------------------------------------------------------------

#include "FWCore/Utilities/interface/typedefs.h"

#include <string>
#include <array>
#include <cstdint>

class CTPPSPixelDataError {
public:
  /// Default constructor
  CTPPSPixelDataError();
  /// Constructor for 32-bit error word
  CTPPSPixelDataError(uint32_t errorWord32, const int errorType, int fedId);
  /// Constructor with 64-bit error word and type included (header or trailer word)
  CTPPSPixelDataError(uint64_t errorWord64, const int errorType, int fedId);
  /// Destructor
  ~CTPPSPixelDataError();

  /// the 32-bit word that contains the error information
  inline uint32_t errorWord32() const { return errorWord32_; }
  /// the 64-bit word that contains the error information
  inline uint64_t errorWord64() const { return errorWord64_; }
  /// the number associated with the error type (26-31 for ROC number errors, 32-33 for calibration errors)
  inline int errorType() const { return errorType_; }
  /// the fedId where the error occured
  inline int fedId() const { return fedId_; }
  /// the error message to be displayed with the error
  inline const std::string& errorMessage() const {
    if (errorType_ >= 25 && errorType_ <= 37)
      return errorMessages_[errorType_ - 24];
    return errorMessages_[0];
  }

private:
  static const std::array<std::string, 14> errorMessages_;

  uint64_t errorWord64_;
  uint32_t errorWord32_;
  int errorType_;
  int fedId_;
};

/// Comparison operators
inline bool operator<(const CTPPSPixelDataError& one, const CTPPSPixelDataError& other) {
  return one.fedId() < other.fedId();
}

#endif