CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
SiPixelArrayBuffer Class Reference

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

#include <SiPixelArrayBuffer.h>

Public Member Functions

int columns () const
 
int index (int row, int col) const
 Definition of indexing within the buffer. More...
 
int index (const SiPixelCluster::PixelPos &pix) const
 
bool inside (int row, int col) const
 
int operator() (int row, int col) const
 
int operator() (const SiPixelCluster::PixelPos &) 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.

57  : nrows(rows), ncols(cols)
58 {
59  pixel_vec.resize(rows*cols);
60 
61  // TO DO: check this now:
62  // Some STL implementations have problems with default values
63  // so a initialization loop is used instead
64  std::vector<int>::iterator i=pixel_vec.begin(), iend=pixel_vec.end();
65  for ( ; i!=iend; ++i) {
66  *i = 0;
67  }
68 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > pixel_vec
SiPixelArrayBuffer::SiPixelArrayBuffer ( )
inline

Definition at line 31 of file SiPixelArrayBuffer.h.

31 {}

Member Function Documentation

int SiPixelArrayBuffer::columns ( ) const
inline

Definition at line 37 of file SiPixelArrayBuffer.h.

References ncols.

37 { 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 BeautifulSoup.PageElement::_invert(), operator()(), and set_adc().

45 {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 BeautifulSoup.PageElement::_invert(), and index().

46 { return index(pix.row(), pix.col()); }
int index(int row, int col) const
Definition of indexing within the buffer.
bool SiPixelArrayBuffer::inside ( int  row,
int  col 
) const
inline

Definition at line 89 of file SiPixelArrayBuffer.h.

References ncols.

Referenced by operator()().

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

Definition at line 95 of file SiPixelArrayBuffer.h.

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

96 {
97  if (inside(row,col)) return pixel_vec[index(row,col)];
98  else return 0;
99 }
std::vector< int > pixel_vec
int index(int row, int col) const
Definition of indexing within the buffer.
bool inside(int row, int col) const
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().

103 {
104  if (inside( pix.row(), pix.col())) return pixel_vec[index(pix)];
105  else return 0;
106 }
std::vector< int > pixel_vec
int index(int row, int col) const
Definition of indexing within the buffer.
bool inside(int row, int col) const
int SiPixelArrayBuffer::rows ( ) const
inline

Definition at line 36 of file SiPixelArrayBuffer.h.

References nrows.

Referenced by setSize().

36 { return nrows;}
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.

111 {
112  pixel_vec[index(row,col)] = adc;
113 }
int adc(sample_type sample)
get the ADC sample (12 bits)
std::vector< int > pixel_vec
int index(int row, int col) const
Definition of indexing within the buffer.
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.

117 {
118  pixel_vec[index(pix)] = adc;
119 }
int adc(sample_type sample)
get the ADC sample (12 bits)
std::vector< int > pixel_vec
int index(int row, int col) const
Definition of indexing within the buffer.
void SiPixelArrayBuffer::setSize ( int  rows,
int  cols 
)
inline

Definition at line 71 of file SiPixelArrayBuffer.h.

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

72 {
73  nrows = rows;
74  ncols = cols;
75  pixel_vec.resize(rows*cols);
76  //std::cout << " Resize the clusterize pixel buffer " << (rows*cols)
77  // << std::endl;
78 
79  // TO DO: check this now:
80  // Some STL implementations have problems with default values
81  // so a initialization loop is used instead
82  std::vector<int>::iterator i=pixel_vec.begin(), iend=pixel_vec.end();
83  for ( ; i!=iend; ++i) {
84  *i = 0;
85  }
86 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > pixel_vec
int SiPixelArrayBuffer::size ( void  ) const
inline

Definition at line 42 of file SiPixelArrayBuffer.h.

References pixel_vec.

42 { return pixel_vec.size();}
std::vector< int > pixel_vec

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