CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SiPixelCalibDigi.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_SIPIXELCALIBDIGI_SIPIXELCALIBDIGI_H
2 #define DATAFORMATS_SIPIXELCALIBDIGI_SIPIXELCALIBDIGI_H
3 
4 #include <utility>
5 #include <vector>
6 #include <iostream>
7 #include <cstdint>
8 
10 public:
11  SiPixelCalibDigi(int packed_value, uint16_t row, uint16_t col) : m_data(packed_value), m_row_and_column(row, col) {
12  reset();
13  }
14  SiPixelCalibDigi(int packed_value) : m_data(packed_value), m_row_and_column(0, 0) { reset(); }
16  virtual ~SiPixelCalibDigi() { ; }
17 
18  void init(uint16_t row, uint16_t col, uint16_t npoints);
19  void reset();
20  void fill(uint32_t ipoint, uint32_t adcval);
21  void setrowcol(uint16_t row, uint16_t col);
22 
23  // analysis methods:
24  uint32_t getnpoints() const { return m_data.size(); } // returns the number of calibration points
25  uint32_t getsum(uint32_t ipoint) const {
26  return m_data[ipoint].adccountsum;
27  } // returns the sum of adc counts for the collected events at point ipoint
28  uint32_t getsumsquares(uint32_t ipoint) const {
29  return m_data[ipoint].adccountsumsq;
30  } // returns the sum of the squares of adc counts for the collected events at point ipoint
31  uint32_t getnentries(uint32_t ipoint) const {
32  return m_data[ipoint].nentries;
33  } // returns the number of entries made for calibration point ipoint
34  std::vector<uint32_t> getsum() const; // returns the sum of adc counts for the collected events for all points
35  std::vector<uint32_t> getsumsquares() const; // returns the sum of the squares of adc counts
36  std::vector<uint8_t> getnentries() const; // returns the number of entries made
37  uint16_t row() const { return m_row_and_column.first; }
38  uint16_t col() const { return m_row_and_column.second; }
39  std::pair<uint16_t, uint16_t> row_and_col() const { return m_row_and_column; }
40 
41  struct datacontainer {
43  uint8_t nentries; // the number of entries per VCAL point
44  uint32_t adccountsum; // the sum of the ADC counts
45  uint32_t adccountsumsq; // the sum of the square value of the ADC counts
46  };
47 
48 private:
49  // this is were the data is stored
50  std::vector<datacontainer> m_data;
51  std::pair<uint16_t, uint16_t> m_row_and_column; //the row and column number of this particular pixel
52 };
53 
54 inline bool operator<(const SiPixelCalibDigi& one, const SiPixelCalibDigi& other) {
55  return one.getnpoints() < other.getnpoints();
56 }
57 
58 inline std::ostream& operator<<(std::ostream& output, const SiPixelCalibDigi& digi) {
59  /* std::ostream result; */
60  /* result << "this SiPixelCalibDigi object contains: " << m_nentries.size() << " and represents pixel (row,col) (" << m_row_and_column.first << ","<< m_row_and_colum.second <<") \n"; */
61  /* for(int iter=0; iter<m_nentries.size(); ++iter) */
62  /* result << "calib point " << iter << ", nentries " << m_nentries[iter] << ", sum " << m_adccountsum[iter] << ", sum of squares " << m_adccountsumsq[iter] <<".\n"; */
63  /* return output << result; */
64  return output << "this pixel (row " << digi.row() << ", col " << digi.col() << " has " << digi.getnpoints()
65  << " calibration points.";
66 }
67 
68 #endif
void init(uint16_t row, uint16_t col, uint16_t npoints)
std::vector< uint8_t > getnentries() const
uint32_t getsum(uint32_t ipoint) const
uint32_t getnentries(uint32_t ipoint) const
virtual ~SiPixelCalibDigi()
SiPixelCalibDigi(int packed_value, uint16_t row, uint16_t col)
uint32_t getnpoints() const
std::vector< uint32_t > getsum() const
uint16_t row() const
SiPixelCalibDigi(int packed_value)
void setrowcol(uint16_t row, uint16_t col)
std::pair< uint16_t, uint16_t > m_row_and_column
std::ostream & operator<<(std::ostream &output, const SiPixelCalibDigi &digi)
std::pair< uint16_t, uint16_t > row_and_col() const
static const int npoints
std::vector< datacontainer > m_data
std::vector< uint32_t > getsumsquares() const
uint32_t getsumsquares(uint32_t ipoint) const
uint16_t col() const
void fill(uint32_t ipoint, uint32_t adcval)
bool operator<(const SiPixelCalibDigi &one, const SiPixelCalibDigi &other)