SiPixelRawDataError

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 60
#ifndef DataFormats_SiPixelRawDataError_h
#define DataFormats_SiPixelRawDataError_h

//---------------------------------------------------------------------------
//!  \class SiPixelRawDataError
//!  \brief Pixel error -- collection of errors and error information
//!
//!  Class to contain and store all information about errors
//!
//!
//!  \author Andrew York, University of Tennessee
//---------------------------------------------------------------------------

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

#include <string>
#include <cstdint>

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

  void setWord32(
      cms_uint32_t errorWord32);  // function to allow user to input the error word (if 32-bit) after instantiation
  void setWord64(
      cms_uint64_t errorWord64);  // function to allow user to input the error word (if 64-bit) after instantiation
  void setType(int errorType);    // function to allow user to input the error type after instantiation
  void setFedId(int fedId);       // function to allow user to input the fedID after instantiation
  void setMessage();              // function to create an error message based on errorType

  inline cms_uint32_t getWord32() const { return errorWord32_; }  // the 32-bit word that contains the error information
  inline cms_uint64_t getWord64() const { return errorWord64_; }  // the 64-bit word that contains the error information
  inline int getType() const {
    return errorType_;
  }  // the number associated with the error type (26-31 for ROC number errors, 32-33 for calibration errors)
  inline int getFedId() const { return fedId_; }                   // the fedId where the error occured
  inline std::string getMessage() const { return errorMessage_; }  // the error message to be displayed with the error

private:
  cms_uint32_t errorWord32_;
  cms_uint64_t errorWord64_;
  int errorType_;
  int fedId_;
  std::string errorMessage_;
};

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

#endif