CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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)
 
float charge () const
 
int colSpan () const
 
void computeMax ()
 moslty to be compatible for <610 More...
 
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
 
void verifyVersion () const
 mostly to be compatible for <610 More...
 
float x () const
 
float y () const
 

Static Public Attributes

static const unsigned int MAXPOS =1023
 
static const unsigned int MAXSPAN =63
 
static const unsigned int POSBITS =10
 
static const unsigned int SPANBITS =6
 

Static Private Member Functions

static int overflow_ (uint16_t packed)
 
static uint16_t pack_ (uint16_t zmin, unsigned short zspan)
 
static int span_ (uint16_t packed)
 

Private Attributes

float err_x
 
float err_y
 
std::vector< uint16_t > thePixelADC
 
uint16_t thePixelCol
 
std::vector< uint8_t > thePixelOffset
 
uint16_t thePixelRow
 

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

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

Member Typedef Documentation

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

Definition at line 73 of file SiPixelCluster.h.

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

93 : thePixelRow(MAXPOS), thePixelCol(MAXPOS), err_x(-99999.9), err_y(-99999.9) {} // needed by many....
uint16_t thePixelCol
static const unsigned int MAXPOS
uint16_t thePixelRow
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 95 of file SiPixelCluster.h.

References i, MAXSPAN, min(), packCol(), packRow(), thePixelOffset, SiStripMonitorClusterAlca_cfi::xmin, and SiStripMonitorClusterAlca_cfi::ymin.

97  :
98  thePixelOffset(2*isize), thePixelADC(adcs,adcs+isize), err_x(-99999.9), err_y(-99999.9) {
99  uint16_t maxCol = 0;
100  uint16_t maxRow = 0;
101  for (unsigned int i=0; i!=isize; ++i) {
102  uint16_t xoffset = xpos[i]-xmin;
103  uint16_t yoffset = ypos[i]-ymin;
104  thePixelOffset[i*2] = std::min(uint16_t(MAXSPAN),xoffset);
105  thePixelOffset[i*2+1] = std::min(uint16_t(MAXSPAN),yoffset);
106  if (xoffset > maxRow) maxRow = xoffset;
107  if (yoffset > maxCol) maxCol = yoffset;
108  }
109  packRow(xmin,maxRow);
110  packCol(ymin,maxCol);
111  }
int i
Definition: DBlmapReader.cc:9
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 const unsigned int MAXSPAN
SiPixelCluster::SiPixelCluster ( const PixelPos pix,
int  adc 
)

Definition at line 18 of file SiPixelCluster.cc.

References thePixelADC, and thePixelOffset.

18  :
19  thePixelRow(pix.row()),
20  thePixelCol(pix.col()),
21  // ggiurgiu@fnal.gov, 01/05/12
22  // Initialize the split cluster errors to un-physical values.
23  // The CPE will check these errors and if they are not un-physical,
24  // it will recognize the clusters as split and assign these (increased)
25  // errors to the corresponding rechit.
26  err_x(-99999.9),
27  err_y(-99999.9)
28 {
29  // First pixel in this cluster.
30  thePixelADC.push_back( adc );
31  thePixelOffset.push_back(0 );
32  thePixelOffset.push_back(0 );
33 }
int adc(sample_type sample)
get the ADC sample (12 bits)
uint16_t thePixelCol
std::vector< uint16_t > thePixelADC
std::vector< uint8_t > thePixelOffset
uint16_t thePixelRow

Member Function Documentation

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

Definition at line 35 of file SiPixelCluster.cc.

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

Referenced by PixelThresholdClusterizer::make_cluster(), counter.Counter::register(), and TrackClusterSplitter::splitCluster().

35  {
36 
37  int ominRow = minPixelRow();
38  int ominCol = minPixelCol();
39  bool recalculate = false;
40 
41  int minRow = ominRow;
42  int minCol = ominCol;
43 
44  if (pix.row() < minRow) {
45  minRow = pix.row();
46  recalculate = true;
47  }
48  if (pix.col() < minCol) {
49  minCol = pix.col();
50  recalculate = true;
51  }
52 
53  if (recalculate) {
54  int maxCol = 0;
55  int maxRow = 0;
56  int isize = thePixelADC.size();
57  for (int i=0; i<isize; ++i) {
58  int xoffset = thePixelOffset[i*2] + ominRow - minRow;
59  int yoffset = thePixelOffset[i*2+1] + ominCol -minCol;
60  thePixelOffset[i*2] = std::min(63,xoffset);
61  thePixelOffset[i*2+1] = std::min(63,yoffset);
62  if (xoffset > maxRow) maxRow = xoffset;
63  if (yoffset > maxCol) maxCol = yoffset;
64  }
65  packRow(minRow,maxRow);
66  packCol(minCol,maxCol);
67  }
68 
69  if ( (!overflowRow()) && pix.row() > maxPixelRow())
70  packRow(minRow,pix.row()-minRow);
71 
72  if ( (!overflowCol()) && pix.col() > maxPixelCol())
73  packCol(minCol,pix.col()-minCol);
74 
75  thePixelADC.push_back( adc );
76  thePixelOffset.push_back( std::min(63,pix.row() - minRow) );
77  thePixelOffset.push_back( std::min(63,pix.col() - minCol) );
78 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
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
bool overflowRow() const
std::vector< uint8_t > thePixelOffset
int maxPixelCol() const
float SiPixelCluster::charge ( ) const
inline

Definition at line 145 of file SiPixelCluster.h.

References i, and thePixelADC.

Referenced by PixelThresholdClusterizer::clusterizeDetUnit(), SiPixelTrackResidualModule::fill(), ApeEstimator::fillHitVariables(), PixelCPEGeneric::localPosition(), PixelThresholdClusterizer::make_cluster(), JetCoreClusterSplitter::produce(), FastPrimaryVertexWithWeightsProducer::produce(), JetCoreClusterSplitter::split(), TrackClusterSplitter::splitCluster(), x(), and y().

145  {
146  float qm = 0.0;
147  int isize = thePixelADC.size();
148  for (int i=0; i<isize; ++i)
149  qm += float(thePixelADC[i]);
150  return qm;
151  } // Return total cluster charge.
int i
Definition: DBlmapReader.cc:9
std::vector< uint16_t > thePixelADC
int SiPixelCluster::colSpan ( ) const
inline

Definition at line 191 of file SiPixelCluster.h.

References span_(), and thePixelCol.

Referenced by maxPixelCol(), and sizeY().

191 {return span_(thePixelCol); }
uint16_t thePixelCol
static int span_(uint16_t packed)
void SiPixelCluster::computeMax ( )
inline

moslty to be compatible for <610

Definition at line 218 of file SiPixelCluster.h.

References i, minPixelCol(), minPixelRow(), packCol(), packRow(), thePixelADC, thePixelOffset, xsize, and ysize.

Referenced by verifyVersion().

218  {
219  int maxRow = 0;
220  int maxCol = 0;
221  int isize = thePixelADC.size();
222  for (int i=0; i!=isize; ++i) {
223  int xsize = thePixelOffset[i*2];
224  if (xsize > maxRow) maxRow = xsize;
225  int ysize = thePixelOffset[i*2+1] ;
226  if (ysize > maxCol) maxCol = ysize;
227  }
228  // assume minimum is correct
229  int minCol= minPixelCol();
230  packCol(minCol,maxCol);
231  int minRow= minPixelRow();
232  packRow(minRow,maxRow);
233  }
int i
Definition: DBlmapReader.cc:9
int minPixelCol() const
const Int_t ysize
void packRow(uint16_t xmin, uint16_t xspan)
void packCol(uint16_t ymin, uint16_t yspan)
std::vector< uint16_t > thePixelADC
int minPixelRow() const
std::vector< uint8_t > thePixelOffset
const Int_t xsize
float SiPixelCluster::getSplitClusterErrorX ( ) const
inline

Definition at line 239 of file SiPixelCluster.h.

References err_x.

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

Definition at line 240 of file SiPixelCluster.h.

References err_y.

240 { 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 200 of file SiPixelCluster.h.

References overflowCol(), and overflowRow().

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

Definition at line 184 of file SiPixelCluster.h.

References MAXSPAN, and span_().

Referenced by overflowCol(), and overflowRow().

184 { return span_(packed)==uint16_t(MAXSPAN);}
static int span_(uint16_t packed)
static const unsigned int MAXSPAN
bool SiPixelCluster::overflowCol ( ) const
inline

Definition at line 196 of file SiPixelCluster.h.

References overflow_(), and thePixelCol.

Referenced by add(), and overflow().

196 { return overflow_(thePixelCol); }
uint16_t thePixelCol
static int overflow_(uint16_t packed)
bool SiPixelCluster::overflowRow ( ) const
inline

Definition at line 198 of file SiPixelCluster.h.

References overflow_(), and thePixelRow.

Referenced by add(), and overflow().

198 { return overflow_(thePixelRow); }
static int overflow_(uint16_t packed)
uint16_t thePixelRow
static uint16_t SiPixelCluster::pack_ ( uint16_t  zmin,
unsigned short  zspan 
)
inlinestaticprivate

Definition at line 185 of file SiPixelCluster.h.

References MAXSPAN, min(), POSBITS, and SiStripMonitorClusterAlca_cfi::zmin.

Referenced by packCol(), and packRow().

185  {
186  zspan = std::min(zspan, uint16_t(MAXSPAN));
187  return (zspan<<POSBITS) | zmin;
188  }
static const unsigned int POSBITS
T min(T a, T b)
Definition: MathUtil.h:58
static const unsigned int MAXSPAN
void SiPixelCluster::packCol ( uint16_t  ymin,
uint16_t  yspan 
)
inline

Definition at line 202 of file SiPixelCluster.h.

References pack_(), and thePixelCol.

Referenced by add(), computeMax(), and SiPixelCluster().

202  {
203  thePixelCol = pack_(ymin,yspan);
204  }
static uint16_t pack_(uint16_t zmin, unsigned short zspan)
uint16_t thePixelCol
void SiPixelCluster::packRow ( uint16_t  xmin,
uint16_t  xspan 
)
inline

Definition at line 205 of file SiPixelCluster.h.

References pack_(), and thePixelRow.

Referenced by add(), computeMax(), and SiPixelCluster().

205  {
206  thePixelRow = pack_(xmin,xspan);
207  }
static uint16_t pack_(uint16_t zmin, unsigned short zspan)
uint16_t thePixelRow
Pixel SiPixelCluster::pixel ( int  i) const
inline

Definition at line 174 of file SiPixelCluster.h.

References minPixelCol(), minPixelRow(), align::Pixel, thePixelADC, and thePixelOffset.

Referenced by PixelCPEGeneric::collect_edge_charges(), ClusterShape::determineShape(), and pixels().

174  {
175  return Pixel(minPixelRow() + thePixelOffset[i*2],
176  minPixelCol() + thePixelOffset[i*2+1],
177  thePixelADC[i]
178  );
179  }
int i
Definition: DBlmapReader.cc:9
int minPixelCol() const
std::vector< uint16_t > thePixelADC
int minPixelRow() const
std::vector< uint8_t > thePixelOffset
const std::vector<uint16_t>& SiPixelCluster::pixelADC ( ) const
inline

Definition at line 160 of file SiPixelCluster.h.

References thePixelADC.

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

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

Definition at line 159 of file SiPixelCluster.h.

References thePixelOffset.

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

Definition at line 163 of file SiPixelCluster.h.

References i, pixel(), and thePixelADC.

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

163  {
164  std::vector<Pixel> oldPixVector;
165  int isize = thePixelADC.size();
166  oldPixVector.reserve(isize);
167  for(int i=0; i<isize; ++i) {
168  oldPixVector.push_back(pixel(i));
169  }
170  return oldPixVector;
171  }
int i
Definition: DBlmapReader.cc:9
std::vector< uint16_t > thePixelADC
Pixel pixel(int i) const
int SiPixelCluster::rowSpan ( ) const
inline

Definition at line 193 of file SiPixelCluster.h.

References span_(), and thePixelRow.

Referenced by maxPixelRow(), and sizeX().

193 { return span_(thePixelRow); }
static int span_(uint16_t packed)
uint16_t thePixelRow
void SiPixelCluster::setSplitClusterErrorX ( float  errx)
inline

Definition at line 237 of file SiPixelCluster.h.

References err_x.

Referenced by JetCoreClusterSplitter::produce(), and TrackClusterSplitter::splitCluster().

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

Definition at line 238 of file SiPixelCluster.h.

References err_y.

Referenced by JetCoreClusterSplitter::produce(), and TrackClusterSplitter::splitCluster().

238 { err_y = erry; }
int SiPixelCluster::size ( void  ) const
inline
int SiPixelCluster::sizeX ( ) const
inline
int SiPixelCluster::sizeY ( ) const
inline
static int SiPixelCluster::span_ ( uint16_t  packed)
inlinestaticprivate

Definition at line 183 of file SiPixelCluster.h.

References POSBITS.

Referenced by colSpan(), overflow_(), and rowSpan().

183 { return packed >> POSBITS;}
static const unsigned int POSBITS
void SiPixelCluster::verifyVersion ( ) const
inline

mostly to be compatible for <610

Definition at line 212 of file SiPixelCluster.h.

References computeMax(), MAXPOS, thePixelCol, thePixelRow, and unlikely.

Referenced by maxPixelCol(), maxPixelRow(), sizeX(), and sizeY().

212  {
214  const_cast<SiPixelCluster*>(this)->computeMax();
215  }
void computeMax()
moslty to be compatible for &lt;610
uint16_t thePixelCol
#define unlikely(x)
static const unsigned int MAXPOS
Pixel cluster – collection of neighboring pixels above threshold.
uint16_t thePixelRow
float SiPixelCluster::x ( ) const
inline
float SiPixelCluster::y ( ) const
inline

Member Data Documentation

float SiPixelCluster::err_x
private

Definition at line 261 of file SiPixelCluster.h.

Referenced by getSplitClusterErrorX(), and setSplitClusterErrorX().

float SiPixelCluster::err_y
private

Definition at line 262 of file SiPixelCluster.h.

Referenced by getSplitClusterErrorY(), and setSplitClusterErrorY().

const unsigned int SiPixelCluster::MAXPOS =1023
static

Definition at line 86 of file SiPixelCluster.h.

Referenced by minPixelCol(), minPixelRow(), and verifyVersion().

const unsigned int SiPixelCluster::MAXSPAN =63
static

Definition at line 85 of file SiPixelCluster.h.

Referenced by overflow_(), pack_(), and SiPixelCluster().

const unsigned int SiPixelCluster::POSBITS =10
static

Definition at line 83 of file SiPixelCluster.h.

Referenced by pack_(), and span_().

const unsigned int SiPixelCluster::SPANBITS =6
static

Definition at line 84 of file SiPixelCluster.h.

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

Definition at line 246 of file SiPixelCluster.h.

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

uint16_t SiPixelCluster::thePixelCol
private

Definition at line 250 of file SiPixelCluster.h.

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

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

Definition at line 245 of file SiPixelCluster.h.

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

uint16_t SiPixelCluster::thePixelRow
private

Definition at line 249 of file SiPixelCluster.h.

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