00001 00002 #include "DataFormats/SiPixelDigi/interface/SiPixelCalibDigi.h" 00003 00004 #include <algorithm> 00005 00006 // the actual data container is a simply a collection of SiPixelCalibDigi objects 00007 00008 // init method, sets array sizes to npoints, fixes number of points 00009 void SiPixelCalibDigi::init( uint16_t row, uint16_t col, uint16_t npoints) { 00010 setrowcol(row,col); 00011 reset(); 00012 // expand if size of arrays has changed.... not implemented yet... 00013 } 00014 // reset method, sets all array values to zero, does not change size 00015 void SiPixelCalibDigi::reset(){ 00016 for(uint32_t iter =0; iter<m_data.size();++iter){ 00017 m_data[iter].nentries=0; 00018 m_data[iter].adccountsum=0; 00019 m_data[iter].adccountsumsq=0; 00020 } 00021 } 00022 // fill method, adds information to the arrays 00023 void SiPixelCalibDigi::fill(uint32_t ipoint, uint32_t adcval) { 00024 if(ipoint>=m_data.size()) 00025 return; 00026 m_data[ipoint].nentries++; 00027 m_data[ipoint].adccountsum+=adcval; 00028 m_data[ipoint].adccountsumsq+=adcval*adcval; 00029 return; 00030 } 00031 // set method to rol row and column number 00032 void SiPixelCalibDigi::setrowcol(uint16_t row, uint16_t col){ 00033 m_row_and_column.first=row; 00034 m_row_and_column.second=col; 00035 } 00036 // possibility to retrieve vector of entry objects 00037 std::vector<uint8_t> SiPixelCalibDigi::getnentries() const{ 00038 std::vector<uint8_t> result(0); 00039 for(uint32_t ii=0; ii<m_data.size();++ii) 00040 result.push_back(m_data[ii].nentries); 00041 return result; 00042 } 00043 // possibility to retrieve a vector of sums 00044 std::vector<uint32_t> SiPixelCalibDigi::getsum() const{ 00045 std::vector<uint32_t> result(0); 00046 for(uint32_t ii=0; ii<m_data.size();++ii) 00047 result.push_back(m_data[ii].adccountsum); 00048 return result; 00049 } 00050 // possibility to retrieve a vector of sumsquares 00051 std::vector<uint32_t> SiPixelCalibDigi::getsumsquares() const{ 00052 std::vector<uint32_t> result(0); 00053 for(uint32_t ii=0; ii<m_data.size();++ii) 00054 result.push_back(m_data[ii].adccountsumsq); 00055 return result; 00056 } 00057 00058 00059