CMS 3D CMS Logo

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, PixelDigiIterPixelDigiRange
 

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

◆ PixelDigiIter

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

Definition at line 70 of file SiPixelCluster.h.

◆ PixelDigiRange

Definition at line 71 of file SiPixelCluster.h.

Constructor & Destructor Documentation

◆ SiPixelCluster() [1/5]

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::~SiPixelCluster ( )
default

◆ SiPixelCluster() [2/5]

SiPixelCluster::SiPixelCluster ( SiPixelCluster const &  )
default

◆ SiPixelCluster() [3/5]

SiPixelCluster::SiPixelCluster ( SiPixelCluster &&  )
default

◆ SiPixelCluster() [4/5]

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 89 of file SiPixelCluster.h.

References mps_fire::i, MAXSPAN, SiStripPI::min, packCol(), packRow(), thePixelOffset, TrackerOfflineValidation_Dqm_cff::xmin, EcalSCDynamicDPhiParametersESProducer_cfi::xoffset, L1TOccupancyClient_cfi::ymin, and EcalSCDynamicDPhiParametersESProducer_cfi::yoffset.

96  : thePixelOffset(2 * isize), thePixelADC(adcs, adcs + isize), theOriginalClusterId(id) {
97  uint16_t maxCol = 0;
98  uint16_t maxRow = 0;
99  for (unsigned int i = 0; i < isize; ++i) {
100  uint16_t xoffset = xpos[i] - xmin;
101  uint16_t yoffset = ypos[i] - ymin;
102  thePixelOffset[i * 2] = std::min(uint16_t(MAXSPAN), xoffset);
103  thePixelOffset[i * 2 + 1] = std::min(uint16_t(MAXSPAN), yoffset);
104  if (xoffset > maxRow)
105  maxRow = xoffset;
106  if (yoffset > maxCol)
107  maxCol = yoffset;
108  }
109  packRow(xmin, maxRow);
110  packCol(ymin, maxCol);
111  }
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() [5/5]

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

Definition at line 17 of file SiPixelCluster.cc.

References gpuClustering::adc, 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

◆ add()

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

Definition at line 25 of file SiPixelCluster.cc.

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

Referenced by PixelThresholdClusterizer::make_cluster(), counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::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 maxPixelRow() const
int minPixelRow() const
void packRow(uint16_t xmin, uint16_t xspan)
void packCol(uint16_t ymin, uint16_t yspan)
std::vector< uint16_t > thePixelADC
int minPixelCol() const
bool overflowRow() const
int maxPixelCol() const
std::vector< uint8_t > thePixelOffset
static constexpr unsigned int MAXSPAN
bool overflowCol() const
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ charge()

int SiPixelCluster::charge ( ) const
inline

◆ colSpan()

int SiPixelCluster::colSpan ( ) const
inline

Definition at line 179 of file SiPixelCluster.h.

References thePixelColSpan.

Referenced by maxPixelCol(), and sizeY().

179 { return thePixelColSpan; }
uint8_t thePixelColSpan

◆ getSplitClusterErrorX()

float SiPixelCluster::getSplitClusterErrorX ( ) const
inline

Definition at line 202 of file SiPixelCluster.h.

References err_x.

Referenced by PixelCPEClusterRepair::localError().

202 { return err_x; }

◆ getSplitClusterErrorY()

float SiPixelCluster::getSplitClusterErrorY ( ) const
inline

Definition at line 203 of file SiPixelCluster.h.

References err_y.

Referenced by PixelCPEClusterRepair::localError().

203 { return err_y; }

◆ maxPixelCol()

int SiPixelCluster::maxPixelCol ( ) const
inline

◆ maxPixelRow()

int SiPixelCluster::maxPixelRow ( ) const
inline

◆ minPixelCol()

int SiPixelCluster::minPixelCol ( ) const
inline

◆ minPixelRow()

int SiPixelCluster::minPixelRow ( ) const
inline

◆ operator=() [1/2]

SiPixelCluster& SiPixelCluster::operator= ( SiPixelCluster const &  )
default

◆ operator=() [2/2]

SiPixelCluster& SiPixelCluster::operator= ( SiPixelCluster &&  )
default

◆ originalId()

auto SiPixelCluster::originalId ( ) const
inline

Definition at line 206 of file SiPixelCluster.h.

References theOriginalClusterId.

206 { return theOriginalClusterId; }
uint16_t theOriginalClusterId

◆ overflow()

bool SiPixelCluster::overflow ( ) const
inline

Definition at line 187 of file SiPixelCluster.h.

References overflowCol(), and overflowRow().

187 { return overflowCol() || overflowRow(); }
bool overflowRow() const
bool overflowCol() const

◆ overflow_()

static int SiPixelCluster::overflow_ ( uint16_t  span)
inlinestaticprivate

Definition at line 176 of file SiPixelCluster.h.

References MAXSPAN.

Referenced by overflowCol(), and overflowRow().

176 { return span == uint16_t(MAXSPAN); }
static constexpr unsigned int MAXSPAN

◆ overflowCol()

bool SiPixelCluster::overflowCol ( ) const
inline

Definition at line 183 of file SiPixelCluster.h.

References overflow_(), and thePixelColSpan.

Referenced by add(), and overflow().

183 { return overflow_(thePixelColSpan); }
static int overflow_(uint16_t span)
uint8_t thePixelColSpan

◆ overflowRow()

bool SiPixelCluster::overflowRow ( ) const
inline

Definition at line 185 of file SiPixelCluster.h.

References overflow_(), and thePixelRowSpan.

Referenced by add(), and overflow().

185 { return overflow_(thePixelRowSpan); }
static int overflow_(uint16_t span)
uint8_t thePixelRowSpan

◆ packCol()

void SiPixelCluster::packCol ( uint16_t  ymin,
uint16_t  yspan 
)
inline

Definition at line 189 of file SiPixelCluster.h.

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

Referenced by add(), and SiPixelCluster().

189  {
191  thePixelColSpan = std::min(yspan, uint16_t(MAXSPAN));
192  }
uint16_t theMinPixelCol
static constexpr unsigned int MAXSPAN
uint8_t thePixelColSpan

◆ packRow()

void SiPixelCluster::packRow ( uint16_t  xmin,
uint16_t  xspan 
)
inline

◆ pixel()

Pixel SiPixelCluster::pixel ( int  i) const
inline

◆ pixelADC()

const std::vector<uint16_t>& SiPixelCluster::pixelADC ( ) const
inline

Definition at line 157 of file SiPixelCluster.h.

References thePixelADC.

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

157 { return thePixelADC; }
std::vector< uint16_t > thePixelADC

◆ pixelOffset()

const std::vector<uint8_t>& SiPixelCluster::pixelOffset ( ) const
inline

Definition at line 156 of file SiPixelCluster.h.

References thePixelOffset.

156 { return thePixelOffset; }
std::vector< uint8_t > thePixelOffset

◆ pixels()

const std::vector<Pixel> SiPixelCluster::pixels ( ) const
inline

Definition at line 160 of file SiPixelCluster.h.

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

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

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

◆ rowSpan()

int SiPixelCluster::rowSpan ( ) const
inline

Definition at line 181 of file SiPixelCluster.h.

References thePixelRowSpan.

Referenced by maxPixelRow(), and sizeX().

181 { return thePixelRowSpan; }
uint8_t thePixelRowSpan

◆ setOriginalId()

void SiPixelCluster::setOriginalId ( uint16_t  id)
inline

◆ setSplitClusterErrorX()

void SiPixelCluster::setSplitClusterErrorX ( float  errx)
inline

Definition at line 200 of file SiPixelCluster.h.

References err_x.

200 { err_x = errx; }

◆ setSplitClusterErrorY()

void SiPixelCluster::setSplitClusterErrorY ( float  erry)
inline

Definition at line 201 of file SiPixelCluster.h.

References err_y.

201 { err_y = erry; }

◆ size()

int SiPixelCluster::size ( void  ) const
inline

◆ sizeX()

int SiPixelCluster::sizeX ( ) const
inline

◆ sizeY()

int SiPixelCluster::sizeY ( ) const
inline

◆ x()

float SiPixelCluster::x ( ) const
inline

◆ y()

float SiPixelCluster::y ( ) const
inline

Definition at line 126 of file SiPixelCluster.h.

References charge(), mps_fire::i, minPixelCol(), thePixelADC, and thePixelOffset.

Referenced by svgfig.Ellipse::__repr__(), PixelCPEClusterRepair::callTempReco1D(), PixelCPEClusterRepair::callTempReco2D(), PixelCPEBase::computeAnglesFromDetPosition(), PixelCPEGeneric::localPosition(), SiPixelCoordinates::pixel_(), geometryXMLparser.Alignable::pos(), ntupleDataFormat._HitObject::r(), and ntupleDataFormat._HitObject::r3D().

126  {
127  float qm = 0.0;
128  int isize = thePixelADC.size();
129  for (int i = 0; i < isize; ++i)
130  qm += float(thePixelADC[i]) * (thePixelOffset[i * 2 + 1] + minPixelCol() + 0.5f);
131  return qm / charge();
132  }
int charge() const
std::vector< uint16_t > thePixelADC
int minPixelCol() const
std::vector< uint8_t > thePixelOffset

Member Data Documentation

◆ err_x

float SiPixelCluster::err_x = -99999.9f
private

Definition at line 220 of file SiPixelCluster.h.

Referenced by getSplitClusterErrorX(), and setSplitClusterErrorX().

◆ err_y

float SiPixelCluster::err_y = -99999.9f
private

Definition at line 221 of file SiPixelCluster.h.

Referenced by getSplitClusterErrorY(), and setSplitClusterErrorY().

◆ invalidClusterId

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

Definition at line 76 of file SiPixelCluster.h.

◆ MAXPOS

constexpr unsigned int SiPixelCluster::MAXPOS = 2047
static

Definition at line 74 of file SiPixelCluster.h.

◆ MAXSPAN

constexpr unsigned int SiPixelCluster::MAXSPAN = 255
static

Definition at line 73 of file SiPixelCluster.h.

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

◆ theMinPixelCol

uint16_t SiPixelCluster::theMinPixelCol = MAXPOS
private

Definition at line 214 of file SiPixelCluster.h.

Referenced by minPixelCol(), and packCol().

◆ theMinPixelRow

uint16_t SiPixelCluster::theMinPixelRow = MAXPOS
private

Definition at line 213 of file SiPixelCluster.h.

Referenced by minPixelRow(), and packRow().

◆ theOriginalClusterId

uint16_t SiPixelCluster::theOriginalClusterId = invalidClusterId
private

Definition at line 218 of file SiPixelCluster.h.

Referenced by originalId(), and setOriginalId().

◆ thePixelADC

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

Definition at line 211 of file SiPixelCluster.h.

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

◆ thePixelColSpan

uint8_t SiPixelCluster::thePixelColSpan = 0
private

Definition at line 216 of file SiPixelCluster.h.

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

◆ thePixelOffset

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

Definition at line 210 of file SiPixelCluster.h.

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

◆ thePixelRowSpan

uint8_t SiPixelCluster::thePixelRowSpan = 0
private

Definition at line 215 of file SiPixelCluster.h.

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