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 // ggiurgiu@fnal.gov, 01/05/12 00029 // Initialize the split cluster errors to un-physical values. 00030 // The CPE will check these errors and if they are not un-physical, 00031 // it will recognize the clusters as split and assign these (increased) 00032 // errors to the corresponding rechit. 00033 err_x(-99999.9), 00034 err_y(-99999.9) 00035 { 00036 // First pixel in this cluster. 00037 thePixelADC.push_back( adc ); 00038 thePixelOffset.push_back( pix.row() - theMinPixelRow ); 00039 thePixelOffset.push_back( pix.col() - theMinPixelCol ); 00040 } 00041 00042 void SiPixelCluster::add( const SiPixelCluster::PixelPos& pix, int adc) { 00043 00044 // The center of pixel with row # N is at N+0.5 in the meas. frame! 00045 //theSumX += (pix.row()+0.5) * float(adc); 00046 //theSumY += (pix.col()+0.5) * float(adc); 00047 //theCharge += float(adc); 00048 // thePixels.push_back( Pixel( pix.row(), pix.col(), adc ) ); 00049 00050 int minRow = theMinPixelRow; 00051 int minCol = theMinPixelCol; 00052 bool recalculate = false; 00053 00054 if (pix.row() < theMinPixelRow) { 00055 theMinPixelRow = pix.row(); 00056 recalculate = true; 00057 } 00058 if (pix.col() < theMinPixelCol) { 00059 theMinPixelCol = pix.col(); 00060 recalculate = true; 00061 } 00062 if (recalculate) { 00063 int isize = thePixelADC.size(); 00064 for (int i=0; i<isize; ++i) { 00065 int xoffset = (thePixelOffset[i*2] ) + minRow - theMinPixelRow; 00066 int yoffset = (thePixelOffset[i*2+1] ) + minCol - theMinPixelCol; 00067 thePixelOffset[i*2] = xoffset; 00068 thePixelOffset[i*2+1] = yoffset; 00069 } 00070 } 00071 00072 thePixelADC.push_back( adc ); 00073 thePixelOffset.push_back( (pix.row() - theMinPixelRow) ); 00074 thePixelOffset.push_back( (pix.col() - theMinPixelCol) ); 00075 } 00076