test
CMS 3D CMS Logo

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