Go to the documentation of this file.00001 #ifndef DATAFORMATS_SIPIXELCALIBDIGI_SIPIXELCALIBDIGI_H
00002 #define DATAFORMATS_SIPIXELCALIBDIGI_SIPIXELCALIBDIGI_H
00003
00004 #include <utility>
00005 #include <vector>
00006 #include <iostream>
00007 #include "boost/cstdint.hpp"
00008
00009 class SiPixelCalibDigi {
00010 public:
00011
00012 SiPixelCalibDigi(int packed_value,uint16_t row, uint16_t col):m_data(packed_value),m_row_and_column(row,col) {reset();}
00013 SiPixelCalibDigi(int packed_value):m_data(packed_value),m_row_and_column(0,0){reset();}
00014 SiPixelCalibDigi():m_data(0),m_row_and_column(0,0){;}
00015 virtual ~SiPixelCalibDigi(){;}
00016
00017 void init( uint16_t row, uint16_t col, uint16_t npoints);
00018 void reset();
00019 void fill(uint32_t ipoint, uint32_t adcval);
00020 void setrowcol(uint16_t row, uint16_t col);
00021
00022
00023 uint32_t getnpoints() const {return m_data.size();}
00024 uint32_t getsum(uint32_t ipoint) const { return m_data[ipoint].adccountsum;}
00025 uint32_t getsumsquares(uint32_t ipoint)const { return m_data[ipoint].adccountsumsq;}
00026 uint32_t getnentries(uint32_t ipoint) const { return m_data[ipoint].nentries;}
00027 std::vector<uint32_t> getsum() const;
00028 std::vector<uint32_t> getsumsquares() const;
00029 std::vector<uint8_t> getnentries() const ;
00030 uint16_t row() const {return m_row_and_column.first;}
00031 uint16_t col() const {return m_row_and_column.second;}
00032 std::pair<uint16_t,uint16_t> row_and_col() const {return m_row_and_column;}
00033
00034 struct datacontainer{
00035 datacontainer():nentries(0),adccountsum(0),adccountsumsq(0) { }
00036 uint8_t nentries;
00037 uint32_t adccountsum;
00038 uint32_t adccountsumsq;
00039 };
00040
00041 private:
00042
00043
00044 std::vector<datacontainer> m_data;
00045 std::pair<uint16_t,uint16_t> m_row_and_column;
00046 };
00047
00048 inline bool operator <( const SiPixelCalibDigi & one, const SiPixelCalibDigi & other){
00049 return one.getnpoints() < other.getnpoints();
00050 }
00051
00052 inline std::ostream & operator<<(std::ostream & output, const SiPixelCalibDigi & digi) {
00053
00054
00055
00056
00057
00058 return output << "this pixel (row " << digi.row() << ", col " << digi.col() << " has " << digi.getnpoints() << " calibration points.";
00059 }
00060
00061
00062 #endif