Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:41

0001 
0002 #include "DataFormats/SiPixelDigi/interface/SiPixelCalibDigi.h"
0003 
0004 #include <algorithm>
0005 
0006 // the actual data container is a simply a collection of SiPixelCalibDigi objects
0007 
0008 // init method, sets array sizes to npoints, fixes number of points
0009 void SiPixelCalibDigi::init(uint16_t row, uint16_t col, uint16_t npoints) {
0010   setrowcol(row, col);
0011   reset();
0012   // expand if size of arrays has changed.... not implemented yet...
0013 }
0014 // reset method, sets all array values to zero, does not change size
0015 void SiPixelCalibDigi::reset() {
0016   for (uint32_t iter = 0; iter < m_data.size(); ++iter) {
0017     m_data[iter].nentries = 0;
0018     m_data[iter].adccountsum = 0;
0019     m_data[iter].adccountsumsq = 0;
0020   }
0021 }
0022 // fill method, adds information to the arrays
0023 void SiPixelCalibDigi::fill(uint32_t ipoint, uint32_t adcval) {
0024   if (ipoint >= m_data.size())
0025     return;
0026   m_data[ipoint].nentries++;
0027   m_data[ipoint].adccountsum += adcval;
0028   m_data[ipoint].adccountsumsq += adcval * adcval;
0029   return;
0030 }
0031 // set method to rol row and column number
0032 void SiPixelCalibDigi::setrowcol(uint16_t row, uint16_t col) {
0033   m_row_and_column.first = row;
0034   m_row_and_column.second = col;
0035 }
0036 // possibility to retrieve vector of entry objects
0037 std::vector<uint8_t> SiPixelCalibDigi::getnentries() const {
0038   std::vector<uint8_t> result(0);
0039   for (uint32_t ii = 0; ii < m_data.size(); ++ii)
0040     result.push_back(m_data[ii].nentries);
0041   return result;
0042 }
0043 // possibility to retrieve a vector of sums
0044 std::vector<uint32_t> SiPixelCalibDigi::getsum() const {
0045   std::vector<uint32_t> result(0);
0046   for (uint32_t ii = 0; ii < m_data.size(); ++ii)
0047     result.push_back(m_data[ii].adccountsum);
0048   return result;
0049 }
0050 // possibility to retrieve a vector of sumsquares
0051 std::vector<uint32_t> SiPixelCalibDigi::getsumsquares() const {
0052   std::vector<uint32_t> result(0);
0053   for (uint32_t ii = 0; ii < m_data.size(); ++ii)
0054     result.push_back(m_data[ii].adccountsumsq);
0055   return result;
0056 }