PixelROCTrimBits

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
#ifndef PixelROCTrimBits_h
#define PixelROCTrimBits_h
/*! \file CalibFormats/SiPixelObjects/interface/PixelROCTrimBits.h
*   \brief This class implements..
*
*    A longer explanation will be placed here later
*/

#include <sstream>
#include <fstream>
#include "CalibFormats/SiPixelObjects/interface/PixelROCName.h"
#include <string>

namespace pos {
  /*! \class PixelROCTrimBits PixelROCTrimBits.h "interface/PixelROCTrimBits.h"
*   \brief This class implements..
*
*   A longer explanation will be placed here later
*/
  class PixelROCTrimBits;
  std::ostream& operator<<(std::ostream& s, const PixelROCTrimBits& trimbits);

  class PixelROCTrimBits {
  public:
    PixelROCTrimBits();

    void setROCTrimBits(PixelROCName rocid, std::string bits);

    int read(PixelROCName rocid, std::string in);
    int read(PixelROCName rocid, std::ifstream& in);
    int read(PixelROCName rocid, std::istringstream& in);

    int readBinary(PixelROCName rocid, std::ifstream& in);

    friend std::ostream& operator<<(std::ostream& s, const PixelROCTrimBits& trimbits);

    unsigned int trim(unsigned int col, unsigned int row) const;

    void setTrim(unsigned int col, unsigned int row, unsigned int trim);

    void writeBinary(std::ofstream& out) const;

    void writeASCII(std::ofstream& out) const;
    void writeXML(std::ofstream* out) const;

    PixelROCName name() const { return rocid_; }

  private:
    unsigned char bits_[2080];
    PixelROCName rocid_;
  };

}  // namespace pos
#endif