CMS 3D CMS Logo

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
npoints
static const int npoints
Definition: NuclearInteractionFTFSimulator.h:38
SiPixelCalibDigi::~SiPixelCalibDigi
virtual ~SiPixelCalibDigi()
Definition: SiPixelCalibDigi.h:16
SiPixelPI::one
Definition: SiPixelPayloadInspectorHelper.h:39
SiPixelCalibDigi::init
void init(uint16_t row, uint16_t col, uint16_t npoints)
Definition: SiPixelCalibDigi.cc:9
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
operator<
bool operator<(const SiPixelCalibDigi &one, const SiPixelCalibDigi &other)
Definition: SiPixelCalibDigi.h:54
SiPixelCalibDigi::datacontainer
Definition: SiPixelCalibDigi.h:41
SiPixelCalibDigi::getnentries
uint32_t getnentries(uint32_t ipoint) const
Definition: SiPixelCalibDigi.h:31
operator<<
std::ostream & operator<<(std::ostream &output, const SiPixelCalibDigi &digi)
Definition: SiPixelCalibDigi.h:58
SiPixelCalibDigi::SiPixelCalibDigi
SiPixelCalibDigi()
Definition: SiPixelCalibDigi.h:15
SiPixelCalibDigi::datacontainer::nentries
uint8_t nentries
Definition: SiPixelCalibDigi.h:43
SiPixelCalibDigi::getnentries
std::vector< uint8_t > getnentries() const
Definition: SiPixelCalibDigi.cc:37
SiPixelCalibDigi::SiPixelCalibDigi
SiPixelCalibDigi(int packed_value, uint16_t row, uint16_t col)
Definition: SiPixelCalibDigi.h:11
SiPixelCalibDigi::getsum
std::vector< uint32_t > getsum() const
Definition: SiPixelCalibDigi.cc:44
SiPixelCalibDigi::getnpoints
uint32_t getnpoints() const
Definition: SiPixelCalibDigi.h:24
plotBeamSpotDB.ipoint
ipoint
Definition: plotBeamSpotDB.py:340
trackingPlots.other
other
Definition: trackingPlots.py:1464
SiPixelCalibDigi::m_row_and_column
std::pair< uint16_t, uint16_t > m_row_and_column
Definition: SiPixelCalibDigi.h:51
SiPixelCalibDigi::getsum
uint32_t getsum(uint32_t ipoint) const
Definition: SiPixelCalibDigi.h:25
SiPixelCalibDigi::datacontainer::datacontainer
datacontainer()
Definition: SiPixelCalibDigi.h:42
SiPixelCalibDigi::reset
void reset()
Definition: SiPixelCalibDigi.cc:15
SiPixelCalibDigi::m_data
std::vector< datacontainer > m_data
Definition: SiPixelCalibDigi.h:50
SiPixelCalibDigi::row
uint16_t row() const
Definition: SiPixelCalibDigi.h:37
SiPixelCalibDigi::setrowcol
void setrowcol(uint16_t row, uint16_t col)
Definition: SiPixelCalibDigi.cc:32
SiPixelCalibDigi::datacontainer::adccountsum
uint32_t adccountsum
Definition: SiPixelCalibDigi.h:44
SiPixelCalibDigi::row_and_col
std::pair< uint16_t, uint16_t > row_and_col() const
Definition: SiPixelCalibDigi.h:39
SiPixelCalibDigi
Definition: SiPixelCalibDigi.h:9
SiPixelCalibDigi::datacontainer::adccountsumsq
uint32_t adccountsumsq
Definition: SiPixelCalibDigi.h:45
SiPixelCalibDigi::getsumsquares
uint32_t getsumsquares(uint32_t ipoint) const
Definition: SiPixelCalibDigi.h:28
SiPixelCalibDigi::fill
void fill(uint32_t ipoint, uint32_t adcval)
Definition: SiPixelCalibDigi.cc:23
SiPixelCalibDigi::SiPixelCalibDigi
SiPixelCalibDigi(int packed_value)
Definition: SiPixelCalibDigi.h:14
SiPixelCalibDigi::col
uint16_t col() const
Definition: SiPixelCalibDigi.h:38
SiPixelCalibDigi::getsumsquares
std::vector< uint32_t > getsumsquares() const
Definition: SiPixelCalibDigi.cc:51