CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
PixelIndices Class Reference

#include <PixelIndices.h>

Public Member Functions

int numberOfROCsInX (void)
 
int numberOfROCsInY (void)
 
 PixelIndices (const int colsInDet, const int rowsInDet)
 
void print (void) const
 
int transformToModule (const int colROC, const int rowROC, const int rocId, int &col, int &row) const
 
int transformToROC (const int col, const int row, int &rocId, int &colROC, int &rowROC) const
 
 ~PixelIndices ()
 

Static Public Member Functions

static std::pair< int, int > channelToPixelROC (const int chan)
 
static int convertDcolToCol (const int dcol, const int pix, int &colROC, int &rowROC)
 
static int DColumn (const int colROC)
 
static int DColumnInModule (const int dcol, const int chipIndex)
 
static int pixelToChannelROC (const int rowROC, const int colROC)
 
static int rocIndex (const int chipX, const int chipY)
 

Private Attributes

int theChipsInX
 
int theChipsInY
 
int theColsInDet
 
int theRowsInDet
 

Detailed Description

Definition at line 40 of file PixelIndices.h.

Constructor & Destructor Documentation

◆ PixelIndices()

PixelIndices::PixelIndices ( const int  colsInDet,
const int  rowsInDet 
)
inline

Definition at line 44 of file PixelIndices.h.

References gather_cfg::cout, rpixValues::maxROCsInX, rpixValues::maxROCsInY, rpixValues::ROCSizeInX, rpixValues::ROCSizeInY, theChipsInX, theChipsInY, theColsInDet, and theRowsInDet.

44  : theColsInDet(colsInDet), theRowsInDet(rowsInDet) {
45  theChipsInX = theRowsInDet / ROCSizeInX; // number of ROCs in X
46  theChipsInY = theColsInDet / ROCSizeInY; // number of ROCs in Y
47 
48  if (TP_CHECK_LIMITS) {
49  if (theChipsInX < 1 || theChipsInX > maxROCsInX)
50  std::cout << " PixelIndices: Error in ROCsInX " << theChipsInX << " " << theRowsInDet << " " << ROCSizeInX
51  << std::endl;
52  if (theChipsInY < 1 || theChipsInY > maxROCsInY)
53  std::cout << " PixelIndices: Error in ROCsInY " << theChipsInY << " " << theColsInDet << " " << ROCSizeInY
54  << std::endl;
55  }
56  }
constexpr int maxROCsInY
constexpr int maxROCsInX
constexpr int ROCSizeInX
constexpr int ROCSizeInY

◆ ~PixelIndices()

PixelIndices::~PixelIndices ( )
inline

Definition at line 58 of file PixelIndices.h.

58 {}

Member Function Documentation

◆ channelToPixelROC()

static std::pair<int, int> PixelIndices::channelToPixelROC ( const int  chan)
inlinestatic

Definition at line 236 of file PixelIndices.h.

References officialStyle::chan.

Referenced by SiPixelDigitizerAlgorithm::initCal().

236  {
237  int rowROC = (chan >> 6) & 0x7F; // reserve 7 bits for row ROC index 0-79
238  int colROC = chan & 0x3F;
239  return std::pair<int, int>(rowROC, colROC);
240  }
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...

◆ convertDcolToCol()

static int PixelIndices::convertDcolToCol ( const int  dcol,
const int  pix,
int &  colROC,
int &  rowROC 
)
inlinestatic

Definition at line 80 of file PixelIndices.h.

References funct::abs(), gather_cfg::cout, rpixValues::DColsPerROC, rpixValues::ROCSizeInX, and rpixValues::ROCSizeInY.

80  {
81  if (TP_CHECK_LIMITS) {
82  if (dcol < 0 || dcol >= DColsPerROC || pix < 2 || pix > 161) {
83  std::cout << "PixelIndices: wrong dcol or pix " << dcol << " " << pix << std::endl;
84  rowROC = -1; // dummy row Address
85  colROC = -1; // dummy col Address
86  return -1; // Signal error
87  }
88  }
89 
90  // First find if we are in the first or 2nd col of a dcol.
91  int colEvenOdd = pix % 2; // module(2), 0-1st sol, 1-2nd col.
92  // Transform
93  colROC = dcol * 2 + colEvenOdd; // col address, starts from 0
94  rowROC = abs(int(pix / 2) - 80); // row addres, starts from 0
95 
96  if (TP_CHECK_LIMITS) {
97  if (colROC < 0 || colROC >= ROCSizeInY || rowROC < 0 || rowROC >= ROCSizeInX) {
98  std::cout << "PixelIndices: wrong col or row " << colROC << " " << rowROC << " " << dcol << " " << pix
99  << std::endl;
100  rowROC = -1; // dummy row Address
101  colROC = -1; // dummy col Address
102  return -1;
103  }
104  }
105  return 0;
106  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr int DColsPerROC
constexpr int ROCSizeInX
constexpr int ROCSizeInY

◆ DColumn()

static int PixelIndices::DColumn ( const int  colROC)
inlinestatic

Definition at line 213 of file PixelIndices.h.

References gather_cfg::cout.

213  {
214  int dColumnId = (colROC) / 2; // double column 0-25
215  if (TP_CHECK_LIMITS) {
216  if (dColumnId < 0 || dColumnId >= 26) {
217  std::cout << "PixelIndices: wrong dcol index " << dColumnId << " " << colROC << std::endl;
218  return -1;
219  }
220  }
221  return dColumnId;
222  }

◆ DColumnInModule()

static int PixelIndices::DColumnInModule ( const int  dcol,
const int  chipIndex 
)
inlinestatic

Definition at line 226 of file PixelIndices.h.

226  {
227  int dcolInMod = dcol + chipIndex * 26;
228  return dcolInMod;
229  }

◆ numberOfROCsInX()

int PixelIndices::numberOfROCsInX ( void  )
inline

Definition at line 61 of file PixelIndices.h.

References theChipsInX.

61 { return theChipsInX; }

◆ numberOfROCsInY()

int PixelIndices::numberOfROCsInY ( void  )
inline

Definition at line 62 of file PixelIndices.h.

References theChipsInY.

62 { return theChipsInY; }

◆ pixelToChannelROC()

static int PixelIndices::pixelToChannelROC ( const int  rowROC,
const int  colROC 
)
inlinestatic

◆ print()

void PixelIndices::print ( void  ) const
inline

Definition at line 66 of file PixelIndices.h.

References gather_cfg::cout, rpixValues::DColsPerROC, rpixValues::ROCSizeInX, rpixValues::ROCSizeInY, theChipsInX, theChipsInY, theColsInDet, and theRowsInDet.

66  {
67  std::cout << " Pixel det with " << theChipsInX << " chips in x and " << theChipsInY << " in y " << std::endl;
68  std::cout << " Pixel rows " << theRowsInDet << " and columns " << theColsInDet << std::endl;
69  std::cout << " Rows in one chip " << ROCSizeInX << " and columns " << ROCSizeInY << std::endl;
70  std::cout << " Double columns per ROC " << DColsPerROC << std::endl;
71  }
constexpr int DColsPerROC
constexpr int ROCSizeInX
constexpr int ROCSizeInY

◆ rocIndex()

static int PixelIndices::rocIndex ( const int  chipX,
const int  chipY 
)
inlinestatic

Definition at line 189 of file PixelIndices.h.

References gather_cfg::cout, rpixValues::maxROCsInX, and rpixValues::maxROCsInY.

Referenced by transformToROC().

189  {
190  int rocId = -1;
191  if (TP_CHECK_LIMITS) {
192  if (chipX < 0 || chipX >= 2 || chipY < 0 || chipY >= 8) {
193  std::cout << "PixelChipIndices: wrong index " << chipX << " " << chipY << std::endl;
194  return -1;
195  }
196  }
197  if (chipX == 0)
198  rocId = chipY + 8; // should be 8-15
199  else if (chipX == 1)
200  rocId = 7 - chipY; // should be 0-7
201 
202  if (TP_CHECK_LIMITS) {
203  if (rocId < 0 || rocId >= (maxROCsInX * maxROCsInY)) {
204  std::cout << "PixelIndices: Error in ROC index " << rocId << std::endl;
205  return -1;
206  }
207  }
208  return rocId;
209  }
constexpr int maxROCsInY
constexpr int maxROCsInX

◆ transformToModule()

int PixelIndices::transformToModule ( const int  colROC,
const int  rowROC,
const int  rocId,
int &  col,
int &  row 
) const
inline

Definition at line 114 of file PixelIndices.h.

References cuy::col, gather_cfg::cout, rpixValues::ROCSizeInX, rpixValues::ROCSizeInY, theChipsInX, and theChipsInY.

114  {
115  if (TP_CHECK_LIMITS) {
116  if (colROC < 0 || colROC >= ROCSizeInY || rowROC < 0 || rowROC >= ROCSizeInX) {
117  std::cout << "PixelIndices: wrong index " << colROC << " " << rowROC << std::endl;
118  return -1;
119  }
120  }
121 
122  // The transformation depends on the ROC-ID
123  if (rocId >= 0 && rocId < 8) {
124  row = 159 - rowROC;
125  //col = rocId*52 + colROC;
126  col = (8 - rocId) * ROCSizeInY - colROC - 1;
127  } else if (rocId >= 8 && rocId < 16) {
128  row = rowROC;
129  //col = (16-rocId)*52 - colROC - 1;
130  col = (rocId - 8) * ROCSizeInY + colROC;
131  } else {
132  std::cout << "PixelIndices: wrong ROC ID " << rocId << std::endl;
133  return -1;
134  }
135  if (TP_CHECK_LIMITS) {
136  if (col < 0 || col >= (ROCSizeInY * theChipsInY) || row < 0 || row >= (ROCSizeInX * theChipsInX)) {
137  std::cout << "PixelIndices: wrong index " << col << " " << row << std::endl;
138  return -1;
139  }
140  }
141 
142  return 0;
143  }
col
Definition: cuy.py:1009
constexpr int ROCSizeInX
constexpr int ROCSizeInY

◆ transformToROC()

int PixelIndices::transformToROC ( const int  col,
const int  row,
int &  rocId,
int &  colROC,
int &  rowROC 
) const
inline

Definition at line 149 of file PixelIndices.h.

References cuy::col, gather_cfg::cout, rocIndex(), rpixValues::ROCSizeInX, rpixValues::ROCSizeInY, theChipsInX, and theChipsInY.

Referenced by cms::SiPixelCondObjBuilder::analyze(), cms::SiPixelCondObjOfflineBuilder::analyze(), and cms::SiPixelCondObjForHLTBuilder::analyze().

149  {
150  if (TP_CHECK_LIMITS) {
151  if (col < 0 || col >= (ROCSizeInY * theChipsInY) || row < 0 || row >= (ROCSizeInX * theChipsInX)) {
152  std::cout << "PixelIndices: wrong index 3 " << std::endl;
153  return -1;
154  }
155  }
156 
157  // Get the 2d ROC coordinate
158  int chipX = row / ROCSizeInX; // row index of the chip 0-1
159  int chipY = col / ROCSizeInY; // col index of the chip 0-7
160 
161  // Get the ROC id from the 2D index
162  rocId = rocIndex(chipX, chipY);
163  if (TP_CHECK_LIMITS && (rocId < 0 || rocId >= 16)) {
164  std::cout << "PixelIndices: wrong roc index " << rocId << std::endl;
165  return -1;
166  }
167  // get the local ROC coordinates
168  rowROC = (row % ROCSizeInX); // row in chip
169  colROC = (col % ROCSizeInY); // col in chip
170 
171  if (rocId < 8) { // For lower 8 ROCs the coordinates are reversed
172  colROC = 51 - colROC;
173  rowROC = 79 - rowROC;
174  }
175 
176  if (TP_CHECK_LIMITS) {
177  if (colROC < 0 || colROC >= ROCSizeInY || rowROC < 0 || rowROC >= ROCSizeInX) {
178  std::cout << "PixelIndices: wrong index " << colROC << " " << rowROC << std::endl;
179  return -1;
180  }
181  }
182 
183  return 0;
184  }
static int rocIndex(const int chipX, const int chipY)
Definition: PixelIndices.h:189
col
Definition: cuy.py:1009
constexpr int ROCSizeInX
constexpr int ROCSizeInY

Member Data Documentation

◆ theChipsInX

int PixelIndices::theChipsInX
private

◆ theChipsInY

int PixelIndices::theChipsInY
private

◆ theColsInDet

int PixelIndices::theColsInDet
private

Definition at line 244 of file PixelIndices.h.

Referenced by PixelIndices(), and print().

◆ theRowsInDet

int PixelIndices::theRowsInDet
private

Definition at line 245 of file PixelIndices.h.

Referenced by PixelIndices(), and print().