![]() |
![]() |
00001 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" 00002 00003 //--------------------------------------------------------------------------- 00015 //--------------------------------------------------------------------------- 00016 00017 00018 SiPixelCluster::SiPixelCluster( const SiPixelCluster::PixelPos& pix, int adc) : 00019 detId_(0), // &&& To be fixed ?? 00020 // The center of pixel with row # N is at N+0.5 in the meas. frame! 00021 // theSumX( (pix.row()+0.5) * float(adc)), 00022 // theSumY( (pix.col()+0.5) * float(adc)), 00023 // theCharge( float(adc)), 00024 theMinPixelRow( pix.row()), 00025 // theMaxPixelRow( pix.row()), 00026 theMinPixelCol( pix.col()) 00027 // theMaxPixelCol( pix.col()) 00028 { 00029 // First pixel in this cluster. 00030 thePixelADC.push_back( adc ); 00031 thePixelOffset.push_back( pix.row() - theMinPixelRow ); 00032 thePixelOffset.push_back( pix.col() - theMinPixelCol ); 00033 } 00034 00035 void SiPixelCluster::add( const SiPixelCluster::PixelPos& pix, int adc) { 00036 00037 // The center of pixel with row # N is at N+0.5 in the meas. frame! 00038 //theSumX += (pix.row()+0.5) * float(adc); 00039 //theSumY += (pix.col()+0.5) * float(adc); 00040 //theCharge += float(adc); 00041 // thePixels.push_back( Pixel( pix.row(), pix.col(), adc ) ); 00042 00043 int minRow = theMinPixelRow; 00044 int minCol = theMinPixelCol; 00045 bool recalculate = false; 00046 00047 if (pix.row() < theMinPixelRow) { 00048 theMinPixelRow = pix.row(); 00049 recalculate = true; 00050 } 00051 if (pix.col() < theMinPixelCol) { 00052 theMinPixelCol = pix.col(); 00053 recalculate = true; 00054 } 00055 if (recalculate) { 00056 int isize = thePixelADC.size(); 00057 for (int i=0; i<isize; ++i) { 00058 int xoffset = (thePixelOffset[i*2] ) + minRow - theMinPixelRow; 00059 int yoffset = (thePixelOffset[i*2+1] ) + minCol - theMinPixelCol; 00060 thePixelOffset[i*2] = xoffset; 00061 thePixelOffset[i*2+1] = yoffset; 00062 } 00063 } 00064 00065 thePixelADC.push_back( adc ); 00066 thePixelOffset.push_back( (pix.row() - theMinPixelRow) ); 00067 thePixelOffset.push_back( (pix.col() - theMinPixelCol) ); 00068 } 00069