CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelCluster.cc
Go to the documentation of this file.
2 
3 //---------------------------------------------------------------------------
15 //---------------------------------------------------------------------------
16 
17 
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 }
34 
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
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
int maxPixelCol() const
int col
Definition: cuy.py:1008