Go to the documentation of this file.00001 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
00002
00003
00015
00016
00017
00018 SiPixelCluster::SiPixelCluster( const SiPixelCluster::PixelPos& pix, int adc) :
00019 thePixelRow(pix.row()),
00020 thePixelCol(pix.col()),
00021
00022
00023
00024
00025
00026 err_x(-99999.9),
00027 err_y(-99999.9)
00028 {
00029
00030 thePixelADC.push_back( adc );
00031 thePixelOffset.push_back(0 );
00032 thePixelOffset.push_back(0 );
00033 }
00034
00035 void SiPixelCluster::add( const SiPixelCluster::PixelPos& pix, int adc) {
00036
00037 int ominRow = minPixelRow();
00038 int ominCol = minPixelCol();
00039 bool recalculate = false;
00040
00041 int minRow = ominRow;
00042 int minCol = ominCol;
00043
00044 if (pix.row() < minRow) {
00045 minRow = pix.row();
00046 recalculate = true;
00047 }
00048 if (pix.col() < minCol) {
00049 minCol = pix.col();
00050 recalculate = true;
00051 }
00052
00053 if (recalculate) {
00054 int maxCol = 0;
00055 int maxRow = 0;
00056 int isize = thePixelADC.size();
00057 for (int i=0; i<isize; ++i) {
00058 int xoffset = thePixelOffset[i*2] + ominRow - minRow;
00059 int yoffset = thePixelOffset[i*2+1] + ominCol -minCol;
00060 thePixelOffset[i*2] = std::min(63,xoffset);
00061 thePixelOffset[i*2+1] = std::min(63,yoffset);
00062 if (xoffset > maxRow) maxRow = xoffset;
00063 if (yoffset > maxCol) maxCol = yoffset;
00064 }
00065 packRow(minRow,maxRow);
00066 packCol(minCol,maxCol);
00067 }
00068
00069 if ( (!overflowRow()) && pix.row() > maxPixelRow())
00070 packRow(minRow,pix.row()-minRow);
00071
00072 if ( (!overflowCol()) && pix.col() > maxPixelCol())
00073 packCol(minCol,pix.col()-minCol);
00074
00075 thePixelADC.push_back( adc );
00076 thePixelOffset.push_back( std::min(63,pix.row() - minRow) );
00077 thePixelOffset.push_back( std::min(63,pix.col() - minCol) );
00078 }