CMS 3D CMS Logo

SiPixelArrayBuffer Class Reference

Class to store ADC counts during clustering. More...

#include <RecoLocalTracker/SiPixelClusterizer/interface/SiPixelArrayBuffer.h>

List of all members.

Public Member Functions

int columns () const
int index (const SiPixelCluster::PixelPos &pix) const
int index (int row, int col) const
 Definition of indexing within the buffer.
bool inside (int row, int col) const
int operator() (const SiPixelCluster::PixelPos &) const
int operator() (int row, int col) const
int rows () const
void set_adc (const SiPixelCluster::PixelPos &, int adc)
void set_adc (int row, int col, int adc)
void setSize (int rows, int cols)
 SiPixelArrayBuffer ()
 SiPixelArrayBuffer (int rows, int cols)
int size () const

Private Attributes

int ncols
int nrows
std::vector< intpixel_vec


Detailed Description

Class to store ADC counts during clustering.

This class defines the buffer where the pixel ADC are stored. The size is the number of rows and cols into a ROC and it is set in the PixelThresholdClusterizer

TO DO: the chip size should be obtained in some better way.

History: Modify the indexing to col*nrows + row. 9/01 d.k. Add setSize method to adjust array size. 3/02 d.k.

Definition at line 27 of file SiPixelArrayBuffer.h.


Constructor & Destructor Documentation

SiPixelArrayBuffer::SiPixelArrayBuffer ( int  rows,
int  cols 
) [inline]

Definition at line 56 of file SiPixelArrayBuffer.h.

References i, and pixel_vec.

00057   :  nrows(rows), ncols(cols) 
00058 {
00059   pixel_vec.resize(rows*cols);
00060 
00061   // TO DO: check this now:
00062   // Some STL implementations have problems with default values 
00063   // so a initialization loop is used instead
00064   std::vector<int>::iterator i=pixel_vec.begin(), iend=pixel_vec.end();
00065   for ( ; i!=iend; ++i) {
00066     *i = 0;
00067   }
00068 }

SiPixelArrayBuffer::SiPixelArrayBuffer (  )  [inline]

Definition at line 31 of file SiPixelArrayBuffer.h.

00031 {}


Member Function Documentation

int SiPixelArrayBuffer::columns (  )  const [inline]

Definition at line 37 of file SiPixelArrayBuffer.h.

References ncols.

00037 { return ncols;}

int SiPixelArrayBuffer::index ( const SiPixelCluster::PixelPos pix  )  const [inline]

Definition at line 46 of file SiPixelArrayBuffer.h.

References SiPixelCluster::PixelPos::col(), index(), and SiPixelCluster::PixelPos::row().

00046 { return index(pix.row(), pix.col()); }

int SiPixelArrayBuffer::index ( int  row,
int  col 
) const [inline]

Definition of indexing within the buffer.

Definition at line 45 of file SiPixelArrayBuffer.h.

References nrows.

Referenced by index(), operator()(), and set_adc().

00045 {return col*nrows+row;}

bool SiPixelArrayBuffer::inside ( int  row,
int  col 
) const [inline]

Definition at line 89 of file SiPixelArrayBuffer.h.

References ncols.

Referenced by operator()().

00090 {
00091   return ( row >= 0 && row < nrows && col >= 0 && col < ncols);
00092 }

int SiPixelArrayBuffer::operator() ( const SiPixelCluster::PixelPos pix  )  const [inline]

Definition at line 102 of file SiPixelArrayBuffer.h.

References SiPixelCluster::PixelPos::col(), index(), inside(), pixel_vec, and SiPixelCluster::PixelPos::row().

00103 {
00104   if (inside( pix.row(), pix.col())) return pixel_vec[index(pix)];
00105   else return 0;
00106 }

int SiPixelArrayBuffer::operator() ( int  row,
int  col 
) const [inline]

Definition at line 95 of file SiPixelArrayBuffer.h.

References index(), inside(), and pixel_vec.

00096 {
00097   if (inside(row,col))  return pixel_vec[index(row,col)];
00098   else  return 0;
00099 }

int SiPixelArrayBuffer::rows ( void   )  const [inline]

Definition at line 36 of file SiPixelArrayBuffer.h.

References nrows.

00036 { return nrows;}

void SiPixelArrayBuffer::set_adc ( const SiPixelCluster::PixelPos pix,
int  adc 
) [inline]

Definition at line 116 of file SiPixelArrayBuffer.h.

References index(), and pixel_vec.

00117 {
00118   pixel_vec[index(pix)] = adc;
00119 }

void SiPixelArrayBuffer::set_adc ( int  row,
int  col,
int  adc 
) [inline]

Definition at line 110 of file SiPixelArrayBuffer.h.

References index(), and pixel_vec.

Referenced by PixelThresholdClusterizer::clear_buffer(), PixelThresholdClusterizer::copy_to_buffer(), and PixelThresholdClusterizer::make_cluster().

00111 {
00112   pixel_vec[index(row,col)] = adc;
00113 }

void SiPixelArrayBuffer::setSize ( int  rows,
int  cols 
) [inline]

Definition at line 71 of file SiPixelArrayBuffer.h.

References i, ncols, nrows, and pixel_vec.

Referenced by PixelThresholdClusterizer::setup().

00072 {
00073   nrows = rows;
00074   ncols = cols;
00075   pixel_vec.resize(rows*cols);
00076   //std::cout << " Resize the clusterize pixel buffer " << (rows*cols) 
00077   //    << std::endl;
00078 
00079   // TO DO: check this now:
00080   // Some STL implementations have problems with default values 
00081   // so a initialization loop is used instead
00082   std::vector<int>::iterator i=pixel_vec.begin(), iend=pixel_vec.end();
00083   for ( ; i!=iend; ++i) {
00084     *i = 0;
00085   }
00086 }

int SiPixelArrayBuffer::size ( void   )  const [inline]

Definition at line 42 of file SiPixelArrayBuffer.h.

References pixel_vec.

00042 { return pixel_vec.size();}


Member Data Documentation

int SiPixelArrayBuffer::ncols [private]

Definition at line 50 of file SiPixelArrayBuffer.h.

Referenced by columns(), inside(), and setSize().

int SiPixelArrayBuffer::nrows [private]

Definition at line 49 of file SiPixelArrayBuffer.h.

Referenced by index(), rows(), and setSize().

std::vector<int> SiPixelArrayBuffer::pixel_vec [private]

Definition at line 51 of file SiPixelArrayBuffer.h.

Referenced by operator()(), set_adc(), setSize(), SiPixelArrayBuffer(), and size().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:31:50 2009 for CMSSW by  doxygen 1.5.4