CMS 3D CMS Logo

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>

List of all members.

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
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 (unsigned int isize, uint16_t const *adcs, uint16_t const *xpos, uint16_t const *ypos, uint16_t const xmin, uint16_t const ymin)
 SiPixelCluster ()
 SiPixelCluster (const PixelPos &pix, int adc)
int size () const
int sizeX () const
int sizeY () const
void verifyVersion () const
 mostly to be compatible for <610
float x () const
float y () const

Static Public Attributes

static constexpr unsigned int MAXPOS = 1023
static constexpr unsigned int MAXSPAN = 63
static constexpr unsigned int POSBITS = 10
static constexpr 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.

: thePixelRow(MAXPOS), thePixelCol(MAXPOS), err_x(-99999.9), err_y(-99999.9) {}  // needed by many....
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.

                                                              :   
    thePixelOffset(2*isize), thePixelADC(adcs,adcs+isize), err_x(-99999.9), err_y(-99999.9) {
    uint16_t maxCol = 0;
    uint16_t maxRow = 0;
    for (unsigned int i=0; i!=isize; ++i) {
      uint16_t xoffset = xpos[i]-xmin;
      uint16_t yoffset = ypos[i]-ymin;
      thePixelOffset[i*2] = std::min(uint16_t(MAXSPAN),xoffset);
      thePixelOffset[i*2+1] = std::min(uint16_t(MAXSPAN),yoffset);
      if (xoffset > maxRow) maxRow = xoffset; 
      if (yoffset > maxCol) maxCol = yoffset; 
    }
    packRow(xmin,maxRow);
    packCol(ymin,maxCol);
  }
SiPixelCluster::SiPixelCluster ( const PixelPos pix,
int  adc 
)

Definition at line 18 of file SiPixelCluster.cc.

References thePixelADC, and thePixelOffset.

                                                                          :
  thePixelRow(pix.row()),
  thePixelCol(pix.col()),
    // ggiurgiu@fnal.gov, 01/05/12
  // Initialize the split cluster errors to un-physical values.
  // The CPE will check these errors and if they are not un-physical, 
  // it will recognize the clusters as split and assign these (increased) 
  // errors to the corresponding rechit. 
  err_x(-99999.9),
  err_y(-99999.9)
{
  // First pixel in this cluster.
  thePixelADC.push_back( adc );
  thePixelOffset.push_back(0 );
  thePixelOffset.push_back(0 );
}

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(), and TrackClusterSplitter::splitCluster().

                                                                    {
  
  int ominRow = minPixelRow();
  int ominCol = minPixelCol();
  bool recalculate = false;
  
  int minRow = ominRow;
  int minCol = ominCol;
  
  if (pix.row() < minRow) {
    minRow = pix.row();
    recalculate = true;
  }
  if (pix.col() < minCol) {
    minCol = pix.col();
    recalculate = true;
  }
  
  if (recalculate) {
    int maxCol = 0;
    int maxRow = 0;
    int isize = thePixelADC.size();
    for (int i=0; i<isize; ++i) {
      int xoffset = thePixelOffset[i*2]  + ominRow - minRow;
      int yoffset = thePixelOffset[i*2+1]  + ominCol -minCol;
      thePixelOffset[i*2] = std::min(63,xoffset);
      thePixelOffset[i*2+1] = std::min(63,yoffset);
      if (xoffset > maxRow) maxRow = xoffset; 
      if (yoffset > maxCol) maxCol = yoffset; 
    }
    packRow(minRow,maxRow);
    packCol(minCol,maxCol);
  }
  
  if ( (!overflowRow()) && pix.row() > maxPixelRow()) 
    packRow(minRow,pix.row()-minRow);
  
  if ( (!overflowCol()) && pix.col() > maxPixelCol())
    packCol(minCol,pix.col()-minCol);
  
  thePixelADC.push_back( adc );
  thePixelOffset.push_back( std::min(63,pix.row() - minRow) );
  thePixelOffset.push_back( std::min(63,pix.col() - minCol) );
}
float SiPixelCluster::charge ( ) const [inline]

Definition at line 145 of file SiPixelCluster.h.

References i, and thePixelADC.

Referenced by SiPixelMuonHLT::analyze(), PixelThresholdClusterizer::clusterizeDetUnit(), SiPixelTrackResidualModule::fill(), PixelCPEGeneric::localPosition(), PixelThresholdClusterizer::make_cluster(), TrackClusterSplitter::splitCluster(), x(), and y().

                              {
    float qm = 0.0;
    int isize = thePixelADC.size();
    for (int i=0; i<isize; ++i) 
      qm += float(thePixelADC[i]);
    return qm;
  } // Return total cluster charge.
int SiPixelCluster::colSpan ( ) const [inline]

Definition at line 191 of file SiPixelCluster.h.

References span_(), and thePixelCol.

Referenced by maxPixelCol(), and sizeY().

{return span_(thePixelCol); }
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, and thePixelOffset.

Referenced by verifyVersion().

                     {
    int maxRow = 0;
    int maxCol = 0;
    int isize  = thePixelADC.size();
    for (int i=0; i!=isize; ++i) {
      int xsize  = thePixelOffset[i*2];
      if (xsize > maxRow) maxRow = xsize;
      int ysize = thePixelOffset[i*2+1] ;
      if (ysize > maxCol) maxCol = ysize;
    }
    // assume minimum is correct
    int minCol= minPixelCol();
    packCol(minCol,maxCol);
    int minRow= minPixelRow();
    packRow(minRow,maxRow);
  }
float SiPixelCluster::getSplitClusterErrorX ( ) const [inline]

Definition at line 239 of file SiPixelCluster.h.

References err_x.

Referenced by PixelCPETemplateReco::localError().

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

Definition at line 240 of file SiPixelCluster.h.

References err_y.

Referenced by PixelCPETemplateReco::localError().

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

{ return  overflowCol() || overflowRow(); }
static int SiPixelCluster::overflow_ ( uint16_t  packed) [inline, static, private]

Definition at line 184 of file SiPixelCluster.h.

References MAXSPAN, and span_().

Referenced by overflowCol(), and overflowRow().

{ return span_(packed)==uint16_t(MAXSPAN);}
bool SiPixelCluster::overflowCol ( ) const [inline]

Definition at line 196 of file SiPixelCluster.h.

References overflow_(), and thePixelCol.

Referenced by add(), and overflow().

{ return overflow_(thePixelCol); }
bool SiPixelCluster::overflowRow ( ) const [inline]

Definition at line 198 of file SiPixelCluster.h.

References overflow_(), and thePixelRow.

Referenced by add(), and overflow().

{ return overflow_(thePixelRow); }
static uint16_t SiPixelCluster::pack_ ( uint16_t  zmin,
unsigned short  zspan 
) [inline, static, private]

Definition at line 185 of file SiPixelCluster.h.

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

Referenced by packCol(), and packRow().

                                                              {
    zspan = std::min(zspan, uint16_t(MAXSPAN));
    return (zspan<<POSBITS) | zmin;
  }
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().

                                              {
    thePixelCol = pack_(ymin,yspan);
  }
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().

                                              {
    thePixelRow = pack_(xmin,xspan);
  }
Pixel SiPixelCluster::pixel ( int  i) const [inline]
const std::vector<uint16_t>& SiPixelCluster::pixelADC ( ) const [inline]

Definition at line 160 of file SiPixelCluster.h.

References thePixelADC.

Referenced by PixelCPEBase::setTheDet().

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

Definition at line 159 of file SiPixelCluster.h.

References thePixelOffset.

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

Definition at line 163 of file SiPixelCluster.h.

References i, pixel(), and thePixelADC.

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

                                        {
    std::vector<Pixel> oldPixVector;
    int isize = thePixelADC.size();
    oldPixVector.reserve(isize); 
    for(int i=0; i<isize; ++i) {
      oldPixVector.push_back(pixel(i));
    }
    return oldPixVector;
  }
int SiPixelCluster::rowSpan ( ) const [inline]

Definition at line 193 of file SiPixelCluster.h.

References span_(), and thePixelRow.

Referenced by maxPixelRow(), and sizeX().

{ return span_(thePixelRow); }
void SiPixelCluster::setSplitClusterErrorX ( float  errx) [inline]

Definition at line 237 of file SiPixelCluster.h.

References err_x.

Referenced by TrackClusterSplitter::splitCluster().

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

Definition at line 238 of file SiPixelCluster.h.

References err_y.

Referenced by TrackClusterSplitter::splitCluster().

{ 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) [inline, static, private]

Definition at line 183 of file SiPixelCluster.h.

References POSBITS.

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

{ return packed >> 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().

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

constexpr unsigned int SiPixelCluster::MAXPOS = 1023 [static]

Definition at line 81 of file SiPixelCluster.h.

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

constexpr unsigned int SiPixelCluster::MAXSPAN = 63 [static]

Definition at line 80 of file SiPixelCluster.h.

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

constexpr unsigned int SiPixelCluster::POSBITS = 10 [static]

Definition at line 78 of file SiPixelCluster.h.

Referenced by pack_(), and span_().

constexpr unsigned int SiPixelCluster::SPANBITS = 6 [static]

Definition at line 79 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().