CMS 3D CMS Logo

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

Pixel cluster – collection of neighboring pixels above threshold. More...

#include <SiPixelCluster.h>

Classes

class  Pixel
 
class  PixelPos
 
class  Shift
 

Public Types

typedef std::vector< PixelDigi >
::const_iterator 
PixelDigiIter
 
typedef std::pair
< PixelDigiIter, PixelDigiIter
PixelDigiRange
 

Public Member Functions

void add (const PixelPos &pix, int adc)
 
int charge () const
 
int colSpan () const
 
float getSplitClusterErrorX () const
 
float getSplitClusterErrorY () const
 
int maxPixelCol () const
 
int maxPixelRow () const
 
int minPixelCol () const
 
int minPixelRow () const
 
SiPixelClusteroperator= (SiPixelCluster const &)=default
 
SiPixelClusteroperator= (SiPixelCluster &&)=default
 
auto originalId () const
 
bool overflow () const
 
bool overflowCol () const
 
bool overflowRow () const
 
void packCol (uint16_t ymin, uint16_t yspan)
 
void packRow (uint16_t xmin, uint16_t xspan)
 
Pixel pixel (int i) const
 
const std::vector< uint16_t > & pixelADC () const
 
const std::vector< uint8_t > & pixelOffset () const
 
const std::vector< Pixelpixels () const
 
int rowSpan () const
 
void setOriginalId (uint16_t id)
 
void setSplitClusterErrorX (float errx)
 
void setSplitClusterErrorY (float erry)
 
 SiPixelCluster ()=default
 
 SiPixelCluster (SiPixelCluster const &)=default
 
 SiPixelCluster (SiPixelCluster &&)=default
 
 SiPixelCluster (unsigned int isize, uint16_t const *adcs, uint16_t const *xpos, uint16_t const *ypos, uint16_t xmin, uint16_t ymin, uint16_t id=invalidClusterId)
 
 SiPixelCluster (const PixelPos &pix, int adc)
 
int size () const
 
int sizeX () const
 
int sizeY () const
 
float x () const
 
float y () const
 
 ~SiPixelCluster ()=default
 

Static Public Attributes

static constexpr uint16_t invalidClusterId = std::numeric_limits<uint16_t>::max()
 
static constexpr unsigned int MAXPOS = 2047
 
static constexpr unsigned int MAXSPAN = 255
 

Static Private Member Functions

static int overflow_ (uint16_t span)
 

Private Attributes

float err_x = -99999.9f
 
float err_y = -99999.9f
 
uint16_t theMinPixelCol = MAXPOS
 
uint16_t theMinPixelRow = MAXPOS
 
uint16_t theOriginalClusterId = invalidClusterId
 
std::vector< uint16_t > thePixelADC
 
uint8_t thePixelColSpan = 0
 
std::vector< uint8_t > thePixelOffset
 
uint8_t thePixelRowSpan = 0
 

Detailed Description

Pixel cluster – collection of neighboring pixels above threshold.

Pixel cluster – collection of pixels with ADC counts.

Class to contain and store all the topological information of pixel clusters: charge, global size, size and the barycenter in x and y local directions. It builds a vector of SiPixel (which is an inner class) and a container of channels.

March 2007: Edge methods moved to RectangularPixelTopology class (V.Chiochia) Feb 2008: Modify the Pixel class from float to shorts May 2008: Offset based packing (D.Fehling / A. Rizzi) Sep 2012: added Max back, removed detId (V.I.) sizeX and sizeY now clipped at 127 July 2017 make it compatible with PhaseII, remove errs....

Class to contain and store all the topological information of pixel clusters: charge, global size, size and the barycenter in x and y local directions. It builds a vector of SiPixel (which is an inner class) and a container of channels.

March 2007: Edge pixel methods moved to RectangularPixelTopology (V.Chiochia) May 2008: Offset based packing (D.Fehling / A. Rizzi)

Author
Petar Maksimovic, JHU

Definition at line 28 of file SiPixelCluster.h.

Member Typedef Documentation

typedef std::vector<PixelDigi>::const_iterator SiPixelCluster::PixelDigiIter

Definition at line 69 of file SiPixelCluster.h.

Definition at line 70 of file SiPixelCluster.h.

Constructor & Destructor Documentation

SiPixelCluster::SiPixelCluster ( )
default

Construct from a range of digis that form a cluster and from a DetID. The range is assumed to be non-empty.

SiPixelCluster::~SiPixelCluster ( )
default
SiPixelCluster::SiPixelCluster ( SiPixelCluster const &  )
default
SiPixelCluster::SiPixelCluster ( SiPixelCluster &&  )
default
SiPixelCluster::SiPixelCluster ( unsigned int  isize,
uint16_t const *  adcs,
uint16_t const *  xpos,
uint16_t const *  ypos,
uint16_t  xmin,
uint16_t  ymin,
uint16_t  id = invalidClusterId 
)
inline

Definition at line 88 of file SiPixelCluster.h.

References mps_fire::i, MAXSPAN, SiStripPI::min, packCol(), packRow(), thePixelOffset, hlt_dqm_clientPB-live_cfg::xmin, and SiStrip_OfflineMonitoring_cff::ymin.

95  : thePixelOffset(2 * isize), thePixelADC(adcs, adcs + isize), theOriginalClusterId(id) {
96  uint16_t maxCol = 0;
97  uint16_t maxRow = 0;
98  for (unsigned int i = 0; i < isize; ++i) {
99  uint16_t xoffset = xpos[i] - xmin;
100  uint16_t yoffset = ypos[i] - ymin;
101  thePixelOffset[i * 2] = std::min(uint16_t(MAXSPAN), xoffset);
102  thePixelOffset[i * 2 + 1] = std::min(uint16_t(MAXSPAN), yoffset);
103  if (xoffset > maxRow)
104  maxRow = xoffset;
105  if (yoffset > maxCol)
106  maxCol = yoffset;
107  }
108  packRow(xmin, maxRow);
109  packCol(ymin, maxCol);
110  }
uint16_t theOriginalClusterId
void packRow(uint16_t xmin, uint16_t xspan)
void packCol(uint16_t ymin, uint16_t yspan)
std::vector< uint16_t > thePixelADC
std::vector< uint8_t > thePixelOffset
static constexpr unsigned int MAXSPAN
SiPixelCluster::SiPixelCluster ( const PixelPos pix,
int  adc 
)

Definition at line 17 of file SiPixelCluster.cc.

References thePixelADC, and thePixelOffset.

18  : theMinPixelRow(pix.row()), theMinPixelCol(pix.col()) {
19  // First pixel in this cluster.
20  thePixelADC.push_back(adc);
21  thePixelOffset.push_back(0);
22  thePixelOffset.push_back(0);
23 }
std::vector< uint16_t > thePixelADC
uint16_t theMinPixelRow
std::vector< uint8_t > thePixelOffset
uint16_t theMinPixelCol
uint16_t *__restrict__ uint16_t const *__restrict__ adc

Member Function Documentation

void SiPixelCluster::add ( const PixelPos pix,
int  adc 
)

Definition at line 25 of file SiPixelCluster.cc.

References SiPixelCluster::PixelPos::col(), mps_fire::i, maxPixelCol(), maxPixelRow(), MAXSPAN, SiStripPI::min, minPixelCol(), minPixelRow(), overflowCol(), overflowRow(), packCol(), packRow(), SiPixelCluster::PixelPos::row(), thePixelADC, and thePixelOffset.

Referenced by PixelThresholdClusterizer::make_cluster(), PixelThresholdClusterizerForBricked::make_cluster_bricked(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

25  {
26  int ominRow = minPixelRow();
27  int ominCol = minPixelCol();
28  bool recalculate = false;
29 
30  int minRow = ominRow;
31  int minCol = ominCol;
32 
33  if (pix.row() < minRow) {
34  minRow = pix.row();
35  recalculate = true;
36  }
37  if (pix.col() < minCol) {
38  minCol = pix.col();
39  recalculate = true;
40  }
41 
42  if (recalculate) {
43  int maxCol = 0;
44  int maxRow = 0;
45  int isize = thePixelADC.size();
46  for (int i = 0; i < isize; ++i) {
47  int xoffset = thePixelOffset[i * 2] + ominRow - minRow;
48  int yoffset = thePixelOffset[i * 2 + 1] + ominCol - minCol;
49  thePixelOffset[i * 2] = std::min(int(MAXSPAN), xoffset);
50  thePixelOffset[i * 2 + 1] = std::min(int(MAXSPAN), yoffset);
51  if (xoffset > maxRow)
52  maxRow = xoffset;
53  if (yoffset > maxCol)
54  maxCol = yoffset;
55  }
56  packRow(minRow, maxRow);
57  packCol(minCol, maxCol);
58  }
59 
60  if ((!overflowRow()) && pix.row() > maxPixelRow())
61  packRow(minRow, pix.row() - minRow);
62 
63  if ((!overflowCol()) && pix.col() > maxPixelCol())
64  packCol(minCol, pix.col() - minCol);
65 
66  thePixelADC.push_back(adc);
67  thePixelOffset.push_back(std::min(int(MAXSPAN), pix.row() - minRow));
68  thePixelOffset.push_back(std::min(int(MAXSPAN), pix.col() - minCol));
69 }
int minPixelCol() const
bool overflowCol() const
int maxPixelRow() const
void packRow(uint16_t xmin, uint16_t xspan)
void packCol(uint16_t ymin, uint16_t yspan)
std::vector< uint16_t > thePixelADC
int minPixelRow() const
bool overflowRow() const
std::vector< uint8_t > thePixelOffset
int maxPixelCol() const
static constexpr unsigned int MAXSPAN
uint16_t *__restrict__ uint16_t const *__restrict__ adc
int SiPixelCluster::charge ( ) const
inline
int SiPixelCluster::colSpan ( ) const
inline

Definition at line 178 of file SiPixelCluster.h.

References thePixelColSpan.

Referenced by maxPixelCol(), and sizeY().

178 { return thePixelColSpan; }
uint8_t thePixelColSpan
float SiPixelCluster::getSplitClusterErrorX ( ) const
inline

Definition at line 201 of file SiPixelCluster.h.

References err_x.

Referenced by PixelCPEClusterRepair::localError().

201 { return err_x; }
float SiPixelCluster::getSplitClusterErrorY ( ) const
inline

Definition at line 202 of file SiPixelCluster.h.

References err_y.

Referenced by PixelCPEClusterRepair::localError().

202 { return err_y; }
int SiPixelCluster::maxPixelCol ( ) const
inline
int SiPixelCluster::maxPixelRow ( ) const
inline
int SiPixelCluster::minPixelCol ( ) const
inline
int SiPixelCluster::minPixelRow ( ) const
inline
SiPixelCluster& SiPixelCluster::operator= ( SiPixelCluster const &  )
default
SiPixelCluster& SiPixelCluster::operator= ( SiPixelCluster &&  )
default
auto SiPixelCluster::originalId ( ) const
inline

Definition at line 205 of file SiPixelCluster.h.

References theOriginalClusterId.

205 { return theOriginalClusterId; }
uint16_t theOriginalClusterId
bool SiPixelCluster::overflow ( ) const
inline

Definition at line 186 of file SiPixelCluster.h.

References overflowCol(), and overflowRow().

186 { return overflowCol() || overflowRow(); }
bool overflowCol() const
bool overflowRow() const
static int SiPixelCluster::overflow_ ( uint16_t  span)
inlinestaticprivate

Definition at line 175 of file SiPixelCluster.h.

References MAXSPAN.

Referenced by overflowCol(), and overflowRow().

175 { return span == uint16_t(MAXSPAN); }
static constexpr unsigned int MAXSPAN
bool SiPixelCluster::overflowCol ( ) const
inline

Definition at line 182 of file SiPixelCluster.h.

References overflow_(), and thePixelColSpan.

Referenced by add(), and overflow().

182 { return overflow_(thePixelColSpan); }
static int overflow_(uint16_t span)
uint8_t thePixelColSpan
bool SiPixelCluster::overflowRow ( ) const
inline

Definition at line 184 of file SiPixelCluster.h.

References overflow_(), and thePixelRowSpan.

Referenced by add(), and overflow().

184 { return overflow_(thePixelRowSpan); }
static int overflow_(uint16_t span)
uint8_t thePixelRowSpan
void SiPixelCluster::packCol ( uint16_t  ymin,
uint16_t  yspan 
)
inline

Definition at line 188 of file SiPixelCluster.h.

References MAXSPAN, SiStripPI::min, theMinPixelCol, thePixelColSpan, and SiStrip_OfflineMonitoring_cff::ymin.

Referenced by add(), and SiPixelCluster().

188  {
190  thePixelColSpan = std::min(yspan, uint16_t(MAXSPAN));
191  }
uint16_t theMinPixelCol
static constexpr unsigned int MAXSPAN
uint8_t thePixelColSpan
void SiPixelCluster::packRow ( uint16_t  xmin,
uint16_t  xspan 
)
inline

Definition at line 192 of file SiPixelCluster.h.

References MAXSPAN, SiStripPI::min, theMinPixelRow, thePixelRowSpan, and hlt_dqm_clientPB-live_cfg::xmin.

Referenced by add(), and SiPixelCluster().

192  {
194  thePixelRowSpan = std::min(xspan, uint16_t(MAXSPAN));
195  }
uint16_t theMinPixelRow
static constexpr unsigned int MAXSPAN
uint8_t thePixelRowSpan
Pixel SiPixelCluster::pixel ( int  i) const
inline
const std::vector<uint16_t>& SiPixelCluster::pixelADC ( ) const
inline

Definition at line 156 of file SiPixelCluster.h.

References thePixelADC.

Referenced by ClusterShape::determineShape(), and ShallowGainCalibration::produce().

156 { return thePixelADC; }
std::vector< uint16_t > thePixelADC
const std::vector<uint8_t>& SiPixelCluster::pixelOffset ( ) const
inline

Definition at line 155 of file SiPixelCluster.h.

References thePixelOffset.

155 { return thePixelOffset; }
std::vector< uint8_t > thePixelOffset
const std::vector<Pixel> SiPixelCluster::pixels ( ) const
inline

Definition at line 159 of file SiPixelCluster.h.

References mps_fire::i, pixel(), and thePixelADC.

Referenced by analyzer::SiPixelLorentzAngle::fillPix(), SiPixelLorentzAnglePCLWorker::fillPix(), JetCoreClusterSplitter::fittingSplit(), PixelThresholdClusterizer::make_cluster(), and PixelThresholdClusterizerForBricked::make_cluster_bricked().

159  {
160  std::vector<Pixel> oldPixVector;
161  int isize = thePixelADC.size();
162  oldPixVector.reserve(isize);
163  for (int i = 0; i < isize; ++i) {
164  oldPixVector.push_back(pixel(i));
165  }
166  return oldPixVector;
167  }
std::vector< uint16_t > thePixelADC
Pixel pixel(int i) const
int SiPixelCluster::rowSpan ( ) const
inline

Definition at line 180 of file SiPixelCluster.h.

References thePixelRowSpan.

Referenced by maxPixelRow(), and sizeX().

180 { return thePixelRowSpan; }
uint8_t thePixelRowSpan
void SiPixelCluster::setOriginalId ( uint16_t  id)
inline

Definition at line 206 of file SiPixelCluster.h.

References gpuClustering::id, and theOriginalClusterId.

uint16_t *__restrict__ id
uint16_t theOriginalClusterId
void SiPixelCluster::setSplitClusterErrorX ( float  errx)
inline

Definition at line 199 of file SiPixelCluster.h.

References err_x.

Referenced by JetCoreClusterSplitter::produce().

199 { err_x = errx; }
void SiPixelCluster::setSplitClusterErrorY ( float  erry)
inline

Definition at line 200 of file SiPixelCluster.h.

References err_y.

Referenced by JetCoreClusterSplitter::produce().

200 { err_y = erry; }
int SiPixelCluster::size ( void  ) const
inline
int SiPixelCluster::sizeX ( ) const
inline
int SiPixelCluster::sizeY ( ) const
inline
float SiPixelCluster::x ( ) const
inline
float SiPixelCluster::y ( ) const
inline

Member Data Documentation

float SiPixelCluster::err_x = -99999.9f
private

Definition at line 219 of file SiPixelCluster.h.

Referenced by getSplitClusterErrorX(), and setSplitClusterErrorX().

float SiPixelCluster::err_y = -99999.9f
private

Definition at line 220 of file SiPixelCluster.h.

Referenced by getSplitClusterErrorY(), and setSplitClusterErrorY().

constexpr uint16_t SiPixelCluster::invalidClusterId = std::numeric_limits<uint16_t>::max()
static

Definition at line 75 of file SiPixelCluster.h.

constexpr unsigned int SiPixelCluster::MAXPOS = 2047
static

Definition at line 73 of file SiPixelCluster.h.

constexpr unsigned int SiPixelCluster::MAXSPAN = 255
static

Definition at line 72 of file SiPixelCluster.h.

Referenced by add(), overflow_(), packCol(), packRow(), and SiPixelCluster().

uint16_t SiPixelCluster::theMinPixelCol = MAXPOS
private

Definition at line 213 of file SiPixelCluster.h.

Referenced by minPixelCol(), and packCol().

uint16_t SiPixelCluster::theMinPixelRow = MAXPOS
private

Definition at line 212 of file SiPixelCluster.h.

Referenced by minPixelRow(), and packRow().

uint16_t SiPixelCluster::theOriginalClusterId = invalidClusterId
private

Definition at line 217 of file SiPixelCluster.h.

Referenced by originalId(), and setOriginalId().

std::vector<uint16_t> SiPixelCluster::thePixelADC
private

Definition at line 210 of file SiPixelCluster.h.

Referenced by add(), charge(), pixel(), pixelADC(), pixels(), SiPixelCluster(), size(), x(), and y().

uint8_t SiPixelCluster::thePixelColSpan = 0
private

Definition at line 215 of file SiPixelCluster.h.

Referenced by colSpan(), overflowCol(), and packCol().

std::vector<uint8_t> SiPixelCluster::thePixelOffset
private

Definition at line 209 of file SiPixelCluster.h.

Referenced by add(), pixel(), pixelOffset(), SiPixelCluster(), x(), and y().

uint8_t SiPixelCluster::thePixelRowSpan = 0
private

Definition at line 214 of file SiPixelCluster.h.

Referenced by overflowRow(), packRow(), and rowSpan().