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

◆ 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.

71 { pixel_vec[index(row, col)] += adc; }

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

Referenced by PixelThresholdClusterizer::copy_to_buffer().

◆ columns()

int SiPixelArrayBuffer::columns ( ) const
inline

Definition at line 34 of file SiPixelArrayBuffer.h.

34 { return ncols; }

References ncols.

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

◆ index() [1/2]

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

Definition at line 44 of file SiPixelArrayBuffer.h.

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

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

Referenced by index(), and BeautifulSoup.PageElement::insert().

◆ index() [2/2]

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

Definition of indexing within the buffer.

Definition at line 43 of file SiPixelArrayBuffer.h.

43 { return col * nrows + row; }

References cuy::col, and nrows.

Referenced by add_adc(), BeautifulSoup.PageElement::insert(), operator()(), and set_adc().

◆ inside()

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

Definition at line 60 of file SiPixelArrayBuffer.h.

60 { return (row >= 0 && row < nrows && col >= 0 && col < ncols); }

References cuy::col, and ncols.

◆ operator()() [1/2]

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

Definition at line 64 of file SiPixelArrayBuffer.h.

64 { return pixel_vec[index(pix)]; }

References index(), and pixel_vec.

◆ operator()() [2/2]

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

Definition at line 62 of file SiPixelArrayBuffer.h.

62 { return pixel_vec[index(row, col)]; }

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

◆ rows()

int SiPixelArrayBuffer::rows ( ) const
inline

Definition at line 33 of file SiPixelArrayBuffer.h.

33 { return nrows; }

References nrows.

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

◆ set_adc() [1/2]

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

Definition at line 69 of file SiPixelArrayBuffer.h.

69 { pixel_vec[index(pix)] = adc; }

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

◆ set_adc() [2/2]

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

◆ setSize()

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

Definition at line 54 of file SiPixelArrayBuffer.h.

54  {
55  pixel_vec.resize(rows * cols, 0);
56  nrows = rows;
57  ncols = cols;
58 }

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

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

◆ size()

int SiPixelArrayBuffer::size ( void  ) const
inline

Definition at line 40 of file SiPixelArrayBuffer.h.

40 { return pixel_vec.size(); }

References pixel_vec.

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

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

SiPixelArrayBuffer::rows
int rows() const
Definition: SiPixelArrayBuffer.h:33
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
cuy.col
col
Definition: cuy.py:1010
SiPixelArrayBuffer::nrows
int nrows
Definition: SiPixelArrayBuffer.h:48
SiPixelArrayBuffer::ncols
int ncols
Definition: SiPixelArrayBuffer.h:49
SiPixelArrayBuffer::pixel_vec
std::vector< int > pixel_vec
Definition: SiPixelArrayBuffer.h:47
SiPixelArrayBuffer::index
int index(int row, int col) const
Definition of indexing within the buffer.
Definition: SiPixelArrayBuffer.h:43
SiPixelCluster::PixelPos::row
constexpr int row() const
Definition: SiPixelCluster.h:57
SiPixelCluster::PixelPos::col
constexpr int col() const
Definition: SiPixelCluster.h:58