CMS 3D CMS Logo

SiPixelCluster.cc
Go to the documentation of this file.
2 
3 //---------------------------------------------------------------------------
15 //---------------------------------------------------------------------------
16 
17 
19  theMinPixelRow(pix.row()),
20  theMinPixelCol(pix.col())
21 {
22  // First pixel in this cluster.
23  thePixelADC.push_back( adc );
24  thePixelOffset.push_back(0 );
25  thePixelOffset.push_back(0 );
26 }
27 
29 
30  int ominRow = minPixelRow();
31  int ominCol = minPixelCol();
32  bool recalculate = false;
33 
34  int minRow = ominRow;
35  int minCol = ominCol;
36 
37  if (pix.row() < minRow) {
38  minRow = pix.row();
39  recalculate = true;
40  }
41  if (pix.col() < minCol) {
42  minCol = pix.col();
43  recalculate = true;
44  }
45 
46  if (recalculate) {
47  int maxCol = 0;
48  int maxRow = 0;
49  int isize = thePixelADC.size();
50  for (int i=0; i<isize; ++i) {
51  int xoffset = thePixelOffset[i*2] + ominRow - minRow;
52  int yoffset = thePixelOffset[i*2+1] + ominCol -minCol;
53  thePixelOffset[i*2] = std::min(int(MAXSPAN),xoffset);
54  thePixelOffset[i*2+1] = std::min(int(MAXSPAN),yoffset);
55  if (xoffset > maxRow) maxRow = xoffset;
56  if (yoffset > maxCol) maxCol = yoffset;
57  }
58  packRow(minRow,maxRow);
59  packCol(minCol,maxCol);
60  }
61 
62  if ( (!overflowRow()) && pix.row() > maxPixelRow())
63  packRow(minRow,pix.row()-minRow);
64 
65  if ( (!overflowCol()) && pix.col() > maxPixelCol())
66  packCol(minCol,pix.col()-minCol);
67 
68  thePixelADC.push_back( adc );
69  thePixelOffset.push_back( std::min(int(MAXSPAN),pix.row() - minRow) );
70  thePixelOffset.push_back( std::min(int(MAXSPAN),pix.col() - minCol) );
71 }
int adc(sample_type sample)
get the ADC sample (12 bits)
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
void add(const PixelPos &pix, int adc)
T min(T a, T b)
Definition: MathUtil.h:58
bool overflowRow() const
std::vector< uint8_t > thePixelOffset
constexpr int col() const
int maxPixelCol() const
col
Definition: cuy.py:1008
static constexpr unsigned int MAXSPAN
constexpr int row() const