Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:41

0001 //---------------------------------------------------
0002 
0003 // Author : Freya.Blekman@NOSPAM.cern.ch
0004 // Name   : SiPixelCalibDigiError
0005 
0006 //---------------------------------------------------
0007 
0008 #ifndef DataFormats_SiPixelCalibDigi_SiPixelCalibDigiError_H
0009 #define DataFormats_SiPixelCalibDigi_SiPixelCalibDigiError_H
0010 
0011 #include <iostream>
0012 #include <utility>
0013 #include <string>
0014 #include <cstdint>
0015 
0016 class SiPixelCalibDigiError {
0017 private:
0018   uint16_t fRow;       // row number
0019   uint16_t fCol;       // column number
0020   uint8_t fErrorType;  // error type in case we want to label errors
0021 
0022 public:
0023   SiPixelCalibDigiError() : fRow(0), fCol(0), fErrorType(0) { ; }
0024 
0025   SiPixelCalibDigiError(uint16_t row, uint16_t col) : fRow(row), fCol(col), fErrorType(0) { ; }
0026   SiPixelCalibDigiError(uint16_t row, uint16_t col, uint16_t error) : fRow(row), fCol(col), fErrorType(error) { ; }
0027 
0028   virtual ~SiPixelCalibDigiError() { ; }
0029 
0030   //- Accessible methods
0031 
0032   //-- Setter/Getter
0033 
0034   uint16_t getRow() const { return fRow; }
0035   void setRow(const uint16_t& in) { fRow = in; }
0036 
0037   uint16_t getCol() const { return fCol; }
0038   void setCol(const uint16_t& in) { fCol = in; }
0039 
0040   uint16_t getErrorType() const { return fErrorType; }
0041   void setErrorType(const uint16_t& in) { fErrorType = in; }
0042   std::string printError() const;
0043 };
0044 inline bool operator<(const SiPixelCalibDigiError& one, const SiPixelCalibDigiError other) {
0045   if (one.getCol() != other.getCol())
0046     return one.getCol() < other.getCol();
0047 
0048   return one.getRow() < other.getRow();
0049 }
0050 inline std::ostream& operator<<(std::ostream& output, const SiPixelCalibDigiError& err) {
0051   std::string errorstr = err.printError();
0052   return output << "pixel SiCalibDigi error in row " << err.getRow() << ", column " << err.getCol() << " of type "
0053                 << err.getErrorType() << " (" << errorstr << ")";
0054 }
0055 #endif