CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiPixelArrayBuffer Class Reference

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

#include <SiPixelArrayBuffer.h>

List of all members.

Public Member Functions

int columns () const
int index (int row, int col) const
 Definition of indexing within the buffer.
int index (const SiPixelCluster::PixelPos &pix) const
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 (int row, int col, int adc)
void set_adc (const SiPixelCluster::PixelPos &, int adc)
void setSize (int rows, int cols)
 SiPixelArrayBuffer (int rows, int cols)
 SiPixelArrayBuffer ()
int size () const

Private Attributes

int ncols
int nrows
std::vector< int > pixel_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.

  :  nrows(rows), ncols(cols) 
{
  pixel_vec.resize(rows*cols);

  // TO DO: check this now:
  // Some STL implementations have problems with default values 
  // so a initialization loop is used instead
  std::vector<int>::iterator i=pixel_vec.begin(), iend=pixel_vec.end();
  for ( ; i!=iend; ++i) {
    *i = 0;
  }
}
SiPixelArrayBuffer::SiPixelArrayBuffer ( ) [inline]

Definition at line 31 of file SiPixelArrayBuffer.h.

{}

Member Function Documentation

int SiPixelArrayBuffer::columns ( ) const [inline]

Definition at line 37 of file SiPixelArrayBuffer.h.

References ncols.

{ return ncols;}
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 operator()(), and set_adc().

{return col*nrows+row;}
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().

Referenced by index().

{ return index(pix.row(), pix.col()); }
bool SiPixelArrayBuffer::inside ( int  row,
int  col 
) const [inline]

Definition at line 89 of file SiPixelArrayBuffer.h.

References ncols.

Referenced by operator()().

{
  return ( row >= 0 && row < nrows && col >= 0 && col < ncols);
}
int SiPixelArrayBuffer::operator() ( int  row,
int  col 
) const [inline]

Definition at line 95 of file SiPixelArrayBuffer.h.

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

{
  if (inside(row,col))  return pixel_vec[index(row,col)];
  else  return 0;
}
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().

{
  if (inside( pix.row(), pix.col())) return pixel_vec[index(pix)];
  else return 0;
}
int SiPixelArrayBuffer::rows ( ) const [inline]

Definition at line 36 of file SiPixelArrayBuffer.h.

References nrows.

Referenced by setSize().

{ return nrows;}
void SiPixelArrayBuffer::set_adc ( const SiPixelCluster::PixelPos pix,
int  adc 
) [inline]

Definition at line 116 of file SiPixelArrayBuffer.h.

References ecalMGPA::adc(), index(), and pixel_vec.

{
  pixel_vec[index(pix)] = adc;
}
void SiPixelArrayBuffer::set_adc ( int  row,
int  col,
int  adc 
) [inline]

Definition at line 110 of file SiPixelArrayBuffer.h.

References ecalMGPA::adc(), index(), and pixel_vec.

{
  pixel_vec[index(row,col)] = adc;
}
void SiPixelArrayBuffer::setSize ( int  rows,
int  cols 
) [inline]

Definition at line 71 of file SiPixelArrayBuffer.h.

References i, ncols, nrows, pixel_vec, and rows().

{
  nrows = rows;
  ncols = cols;
  pixel_vec.resize(rows*cols);
  //std::cout << " Resize the clusterize pixel buffer " << (rows*cols) 
  //    << std::endl;

  // TO DO: check this now:
  // Some STL implementations have problems with default values 
  // so a initialization loop is used instead
  std::vector<int>::iterator i=pixel_vec.begin(), iend=pixel_vec.end();
  for ( ; i!=iend; ++i) {
    *i = 0;
  }
}
int SiPixelArrayBuffer::size ( void  ) const [inline]

Definition at line 42 of file SiPixelArrayBuffer.h.

References pixel_vec.

{ return pixel_vec.size();}

Member Data Documentation

Definition at line 50 of file SiPixelArrayBuffer.h.

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

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().