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
 
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 setSplitClusterErrorX (float errx)
 
void setSplitClusterErrorY (float erry)
 
 SiPixelCluster ()
 
 SiPixelCluster (unsigned int isize, uint16_t const *adcs, uint16_t const *xpos, uint16_t const *ypos, uint16_t const xmin, uint16_t const ymin)
 
 SiPixelCluster (const PixelPos &pix, int adc)
 
int size () const
 
int sizeX () const
 
int sizeY () const
 
float x () const
 
float y () const
 

Static Public Attributes

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

Member Typedef Documentation

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

Definition at line 65 of file SiPixelCluster.h.

Definition at line 66 of file SiPixelCluster.h.

Constructor & Destructor Documentation

SiPixelCluster::SiPixelCluster ( )
inline

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

Definition at line 75 of file SiPixelCluster.h.

Referenced by SiPixelCluster().

75 {}
SiPixelCluster::SiPixelCluster ( unsigned int  isize,
uint16_t const *  adcs,
uint16_t const *  xpos,
uint16_t const *  ypos,
uint16_t const  xmin,
uint16_t const  ymin 
)
inline

Definition at line 77 of file SiPixelCluster.h.

References SiPixelCluster::Pixel::adc, add(), mps_fire::i, min(), packCol(), packRow(), SiPixelCluster(), thePixelOffset, TrackerOfflineValidation_Dqm_cff::xmin, and L1TOccupancyClient_cfi::ymin.

83  : thePixelOffset(2 * isize), thePixelADC(adcs, adcs + isize) {
84  uint16_t maxCol = 0;
85  uint16_t maxRow = 0;
86  for (unsigned int i = 0; i != isize; ++i) {
87  uint16_t xoffset = xpos[i] - xmin;
88  uint16_t yoffset = ypos[i] - ymin;
89  thePixelOffset[i * 2] = std::min(uint16_t(MAXSPAN), xoffset);
90  thePixelOffset[i * 2 + 1] = std::min(uint16_t(MAXSPAN), yoffset);
91  if (xoffset > maxRow)
92  maxRow = xoffset;
93  if (yoffset > maxCol)
94  maxCol = yoffset;
95  }
96  packRow(xmin, maxRow);
97  packCol(ymin, maxCol);
98  }
void packRow(uint16_t xmin, uint16_t xspan)
void packCol(uint16_t ymin, uint16_t yspan)
std::vector< uint16_t > thePixelADC
T min(T a, T b)
Definition: MathUtil.h:58
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
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
std::vector< uint8_t > thePixelOffset
uint16_t theMinPixelCol

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, min(), minPixelCol(), minPixelRow(), overflowCol(), overflowRow(), packCol(), packRow(), SiPixelCluster::PixelPos::row(), thePixelADC, and thePixelOffset.

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

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
T min(T a, T b)
Definition: MathUtil.h:58
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
bool overflowRow() const
std::vector< uint8_t > thePixelOffset
int maxPixelCol() const
static constexpr unsigned int MAXSPAN
int SiPixelCluster::charge ( ) const
inline
int SiPixelCluster::colSpan ( ) const
inline

Definition at line 166 of file SiPixelCluster.h.

References thePixelColSpan.

Referenced by maxPixelCol(), and sizeY().

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

Definition at line 189 of file SiPixelCluster.h.

References err_x.

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

Definition at line 190 of file SiPixelCluster.h.

References err_y.

190 { return err_y; }
int SiPixelCluster::maxPixelCol ( ) const
inline
int SiPixelCluster::maxPixelRow ( ) const
inline
int SiPixelCluster::minPixelCol ( ) const
inline
int SiPixelCluster::minPixelRow ( ) const
inline
bool SiPixelCluster::overflow ( ) const
inline

Definition at line 174 of file SiPixelCluster.h.

References overflowCol(), and overflowRow().

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

Definition at line 163 of file SiPixelCluster.h.

Referenced by overflowCol(), and overflowRow().

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

Definition at line 170 of file SiPixelCluster.h.

References overflow_(), and thePixelColSpan.

Referenced by add(), and overflow().

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

Definition at line 172 of file SiPixelCluster.h.

References overflow_(), and thePixelRowSpan.

Referenced by add(), and overflow().

172 { 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 176 of file SiPixelCluster.h.

References min(), theMinPixelCol, thePixelColSpan, and L1TOccupancyClient_cfi::ymin.

Referenced by add(), and SiPixelCluster().

176  {
178  thePixelColSpan = std::min(yspan, uint16_t(MAXSPAN));
179  }
T min(T a, T b)
Definition: MathUtil.h:58
uint16_t theMinPixelCol
static constexpr unsigned int MAXSPAN
uint8_t thePixelColSpan
void SiPixelCluster::packRow ( uint16_t  xmin,
uint16_t  xspan 
)
inline

Definition at line 180 of file SiPixelCluster.h.

References min(), theMinPixelRow, thePixelRowSpan, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by add(), and SiPixelCluster().

180  {
182  thePixelRowSpan = std::min(xspan, uint16_t(MAXSPAN));
183  }
uint16_t theMinPixelRow
T min(T a, T b)
Definition: MathUtil.h:58
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 144 of file SiPixelCluster.h.

References thePixelADC.

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

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

Definition at line 143 of file SiPixelCluster.h.

References thePixelOffset.

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

Definition at line 147 of file SiPixelCluster.h.

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

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

147  {
148  std::vector<Pixel> oldPixVector;
149  int isize = thePixelADC.size();
150  oldPixVector.reserve(isize);
151  for (int i = 0; i < isize; ++i) {
152  oldPixVector.push_back(pixel(i));
153  }
154  return oldPixVector;
155  }
std::vector< uint16_t > thePixelADC
Pixel pixel(int i) const
int SiPixelCluster::rowSpan ( ) const
inline

Definition at line 168 of file SiPixelCluster.h.

References thePixelRowSpan.

Referenced by maxPixelRow(), and sizeX().

168 { return thePixelRowSpan; }
uint8_t thePixelRowSpan
void SiPixelCluster::setSplitClusterErrorX ( float  errx)
inline

Definition at line 187 of file SiPixelCluster.h.

References err_x.

Referenced by JetCoreClusterSplitter::produce().

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

Definition at line 188 of file SiPixelCluster.h.

References err_y.

Referenced by JetCoreClusterSplitter::produce().

188 { 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 201 of file SiPixelCluster.h.

Referenced by getSplitClusterErrorX(), and setSplitClusterErrorX().

float SiPixelCluster::err_y = -99999.9f
private

Definition at line 202 of file SiPixelCluster.h.

Referenced by getSplitClusterErrorY(), and setSplitClusterErrorY().

constexpr unsigned int SiPixelCluster::MAXPOS = 2047
static

Definition at line 69 of file SiPixelCluster.h.

constexpr unsigned int SiPixelCluster::MAXSPAN = 255
static

Definition at line 68 of file SiPixelCluster.h.

Referenced by add().

uint16_t SiPixelCluster::theMinPixelCol = MAXPOS
private

Definition at line 197 of file SiPixelCluster.h.

Referenced by minPixelCol(), and packCol().

uint16_t SiPixelCluster::theMinPixelRow = MAXPOS
private

Definition at line 196 of file SiPixelCluster.h.

Referenced by minPixelRow(), and packRow().

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

Definition at line 194 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 199 of file SiPixelCluster.h.

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

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

Definition at line 193 of file SiPixelCluster.h.

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

uint8_t SiPixelCluster::thePixelRowSpan = 0
private

Definition at line 198 of file SiPixelCluster.h.

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