CMS 3D CMS Logo

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

void add_adc (int row, int col, int adc)
 
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 25 of file SiPixelArrayBuffer.h.

Constructor & Destructor Documentation

◆ SiPixelArrayBuffer() [1/2]

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

Definition at line 52 of file SiPixelArrayBuffer.h.

52 : pixel_vec(rows * cols, 0), nrows(rows), ncols(cols) {}
std::vector< int > pixel_vec

◆ SiPixelArrayBuffer() [2/2]

SiPixelArrayBuffer::SiPixelArrayBuffer ( )
inline

Definition at line 28 of file SiPixelArrayBuffer.h.

28 {}

Member Function Documentation

◆ add_adc()

void SiPixelArrayBuffer::add_adc ( int  row,
int  col,
int  adc 
)
inline

Definition at line 71 of file SiPixelArrayBuffer.h.

References gpuClustering::adc, cuy::col, index(), and pixel_vec.

Referenced by PixelThresholdClusterizer::copy_to_buffer().

71 { pixel_vec[index(row, col)] += adc; }
std::vector< int > pixel_vec
int index(int row, int col) const
Definition of indexing within the buffer.
col
Definition: cuy.py:1009
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ columns()

int SiPixelArrayBuffer::columns ( ) const
inline

Definition at line 34 of file SiPixelArrayBuffer.h.

References ncols.

Referenced by PixelThresholdClusterizer::make_cluster(), and PixelThresholdClusterizer::setup().

34 { return ncols; }

◆ index() [1/2]

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

Definition of indexing within the buffer.

Definition at line 43 of file SiPixelArrayBuffer.h.

References cuy::col, and nrows.

Referenced by add_adc(), PixelThresholdClusterizer::copy_to_buffer(), operator()(), and set_adc().

43 { return col * nrows + row; }
col
Definition: cuy.py:1009

◆ index() [2/2]

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

Definition at line 44 of file SiPixelArrayBuffer.h.

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

Referenced by index().

44 { return index(pix.row(), pix.col()); }
int index(int row, int col) const
Definition of indexing within the buffer.
constexpr int row() const
constexpr int col() const

◆ inside()

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

Definition at line 60 of file SiPixelArrayBuffer.h.

References cuy::col, and ncols.

60 { return (row >= 0 && row < nrows && col >= 0 && col < ncols); }
col
Definition: cuy.py:1009

◆ operator()() [1/2]

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

Definition at line 62 of file SiPixelArrayBuffer.h.

References cuy::col, index(), and pixel_vec.

62 { return pixel_vec[index(row, col)]; }
std::vector< int > pixel_vec
int index(int row, int col) const
Definition of indexing within the buffer.
col
Definition: cuy.py:1009

◆ operator()() [2/2]

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

Definition at line 64 of file SiPixelArrayBuffer.h.

References index(), and pixel_vec.

64 { return pixel_vec[index(pix)]; }
std::vector< int > pixel_vec
int index(int row, int col) const
Definition of indexing within the buffer.

◆ rows()

int SiPixelArrayBuffer::rows ( ) const
inline

◆ set_adc() [1/2]

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

Definition at line 67 of file SiPixelArrayBuffer.h.

References gpuClustering::adc, cuy::col, index(), and pixel_vec.

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

67 { pixel_vec[index(row, col)] = adc; }
std::vector< int > pixel_vec
int index(int row, int col) const
Definition of indexing within the buffer.
col
Definition: cuy.py:1009
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ set_adc() [2/2]

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

Definition at line 69 of file SiPixelArrayBuffer.h.

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

69 { pixel_vec[index(pix)] = adc; }
std::vector< int > pixel_vec
int index(int row, int col) const
Definition of indexing within the buffer.
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ setSize()

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

Definition at line 54 of file SiPixelArrayBuffer.h.

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

Referenced by PixelThresholdClusterizer::PixelThresholdClusterizer(), and PixelThresholdClusterizer::setup().

54  {
55  pixel_vec.resize(rows * cols, 0);
56  nrows = rows;
57  ncols = cols;
58 }
std::vector< int > pixel_vec

◆ size()

int SiPixelArrayBuffer::size ( void  ) const
inline

Definition at line 40 of file SiPixelArrayBuffer.h.

References pixel_vec.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

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

Member Data Documentation

◆ ncols

int SiPixelArrayBuffer::ncols
private

Definition at line 49 of file SiPixelArrayBuffer.h.

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

◆ nrows

int SiPixelArrayBuffer::nrows
private

Definition at line 48 of file SiPixelArrayBuffer.h.

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

◆ pixel_vec

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

Definition at line 47 of file SiPixelArrayBuffer.h.

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