CMS 3D CMS Logo

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

#include <CTPPSPixelIndices.h>

Public Member Functions

 CTPPSPixelIndices ()
 
 CTPPSPixelIndices (const int colsInDet, const int rowsInDet)
 
int getDefaultColDetSize () const
 
int getDefaultRowDetSize () const
 
int getROCId (const int col, const int row) const
 
bool isOnEdge (const int col, const int row) const
 
int numberOfROCsInX (void)
 
int numberOfROCsInY (void)
 
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
 
 ~CTPPSPixelIndices ()
 

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 74 of file CTPPSPixelIndices.h.

Constructor & Destructor Documentation

◆ CTPPSPixelIndices() [1/2]

CTPPSPixelIndices::CTPPSPixelIndices ( )
inline

Definition at line 79 of file CTPPSPixelIndices.h.

References theChipsInX, theChipsInY, theColsInDet, and theRowsInDet.

79  : theColsInDet(defaultDetSizeInY), theRowsInDet(defaultDetSizeInX) {
80  theChipsInX = theRowsInDet / ROCSizeInX; // number of ROCs in X
81  theChipsInY = theColsInDet / ROCSizeInY; // number of ROCs in Y
82 
83  if (CTPPS_CHECK_LIMITS) {
84  if (theChipsInX < 1 || theChipsInX > maxROCsInX)
85  edm::LogError("RPix") << " CTPPSPixelIndices: Error in ROCsInX " << theChipsInX << " " << theRowsInDet << " "
86  << ROCSizeInX;
87  if (theChipsInY < 1 || theChipsInY > maxROCsInY)
88  edm::LogError("RPix") << " CTPPSPixelIndices: Error in ROCsInY " << theChipsInY << " " << theColsInDet << " "
89  << ROCSizeInY;
90  }
91  }
Log< level::Error, false > LogError

◆ CTPPSPixelIndices() [2/2]

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

Definition at line 93 of file CTPPSPixelIndices.h.

References theChipsInX, theChipsInY, theColsInDet, and theRowsInDet.

93  : theColsInDet(colsInDet), theRowsInDet(rowsInDet) {
94  theChipsInX = theRowsInDet / ROCSizeInX; // number of ROCs in X
95  theChipsInY = theColsInDet / ROCSizeInY; // number of ROCs in Y
96 
97  if (CTPPS_CHECK_LIMITS) {
98  if (theChipsInX < 1 || theChipsInX > maxROCsInX)
99  edm::LogError("RPix") << " CTPPSPixelIndices: Error in ROCsInX " << theChipsInX << " " << theRowsInDet << " "
100  << ROCSizeInX;
101  if (theChipsInY < 1 || theChipsInY > maxROCsInY)
102  edm::LogError("RPix") << " CTPPSPixelIndices: Error in ROCsInY " << theChipsInY << " " << theColsInDet << " "
103  << ROCSizeInY;
104  }
105  }
Log< level::Error, false > LogError

◆ ~CTPPSPixelIndices()

CTPPSPixelIndices::~CTPPSPixelIndices ( )
inline

Definition at line 107 of file CTPPSPixelIndices.h.

107 {}

Member Function Documentation

◆ channelToPixelROC()

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

Definition at line 316 of file CTPPSPixelIndices.h.

References officialStyle::chan.

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

◆ convertDcolToCol()

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

Definition at line 126 of file CTPPSPixelIndices.h.

References funct::abs().

Referenced by CTPPSPixelROC::toGlobalfromDcol().

126  {
127  if (CTPPS_CHECK_LIMITS) {
128  if (dcol < 0 || dcol >= DColsPerROC || pix < 2 || pix > 161) {
129  edm::LogError("RPix") << "CTPPSPixelIndices: wrong dcol or pix " << dcol << " " << pix;
130  rowROC = -1; // dummy row Address
131  colROC = -1; // dummy col Address
132  return -1; // Signal error
133  }
134  }
135 
136  // First find if we are in the first or 2nd col of a dcol.
137  int colEvenOdd = pix % 2; // module(2), 0-1st sol, 1-2nd col.
138  // Transform
139  colROC = dcol * 2 + colEvenOdd; // col address, starts from 0
140  rowROC = abs(int(pix / 2) - 80); // row addres, starts from 0
141 
142  if (CTPPS_CHECK_LIMITS) {
143  if (colROC < 0 || colROC >= ROCSizeInY || rowROC < 0 || rowROC >= ROCSizeInX) {
144  edm::LogError("RPix") << "CTPPSPixelIndices: wrong col or row " << colROC << " " << rowROC << " " << dcol << " "
145  << pix;
146  rowROC = -1; // dummy row Address
147  colROC = -1; // dummy col Address
148  return -1;
149  }
150  }
151  return 0;
152  }
Log< level::Error, false > LogError
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ DColumn()

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

Definition at line 293 of file CTPPSPixelIndices.h.

Referenced by CTPPSPixelDataFormatter::formatRawData().

293  {
294  int dColumnId = (colROC) / 2; // double column 0-25
295  if (CTPPS_CHECK_LIMITS) {
296  if (dColumnId < 0 || dColumnId >= 26) {
297  edm::LogError("RPix") << "CTPPSPixelIndices: wrong dcol index " << dColumnId << " " << colROC;
298  return -1;
299  }
300  }
301  return dColumnId;
302  }
Log< level::Error, false > LogError

◆ DColumnInModule()

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

Definition at line 306 of file CTPPSPixelIndices.h.

306  {
307  int dcolInMod = dcol + chipIndex * 26;
308  return dcolInMod;
309  }

◆ getDefaultColDetSize()

int CTPPSPixelIndices::getDefaultColDetSize ( ) const
inline

Definition at line 323 of file CTPPSPixelIndices.h.

Referenced by RPixClusterToHit::make_hit().

323 { return defaultDetSizeInY; }

◆ getDefaultRowDetSize()

int CTPPSPixelIndices::getDefaultRowDetSize ( ) const
inline

Definition at line 322 of file CTPPSPixelIndices.h.

Referenced by RPixClusterToHit::make_hit().

322 { return defaultDetSizeInX; }

◆ getROCId()

int CTPPSPixelIndices::getROCId ( const int  col,
const int  row 
) const
inline

Definition at line 234 of file CTPPSPixelIndices.h.

References cuy::col, rocIndex(), theChipsInX, and theChipsInY.

Referenced by RPixPlaneCombinatoryTracking::findTracks(), and RPixClusterToHit::make_hit().

234  {
235  int rocId = -1;
236 
237  if (CTPPS_CHECK_LIMITS) {
238  if (col < 0 || col >= (ROCSizeInY * theChipsInY) || row < 0 || row >= (ROCSizeInX * theChipsInX)) {
239  edm::LogError("RPix") << "CTPPSPixelIndices: wrong index ";
240  return -1;
241  }
242  }
243 
244  // Get the 2d ROC coordinate
245  int chipX = row / ROCSizeInX; // row index of the chip 0-1
246  int chipY = col / ROCSizeInY; // col index of the chip 0-2
247 
248  // Get the ROC id from the 2D index
249  rocId = rocIndex(chipX, chipY);
250  if (CTPPS_CHECK_LIMITS && (rocId < 0 || rocId >= 6)) {
251  edm::LogError("RPix") << "CTPPSPixelIndices: wrong roc index " << rocId;
252  return -1;
253  }
254 
255  return rocId;
256  }
Log< level::Error, false > LogError
static int rocIndex(const int chipX, const int chipY)
col
Definition: cuy.py:1009

◆ isOnEdge()

bool CTPPSPixelIndices::isOnEdge ( const int  col,
const int  row 
) const
inline

Definition at line 259 of file CTPPSPixelIndices.h.

References cuy::col.

259  {
260  if (col == 0 || row == 0 || col == (defaultDetSizeInY - 1) || row == (defaultDetSizeInX - 1))
261  return true;
262  return false;
263  }
col
Definition: cuy.py:1009

◆ numberOfROCsInX()

int CTPPSPixelIndices::numberOfROCsInX ( void  )
inline

Definition at line 109 of file CTPPSPixelIndices.h.

References theChipsInX.

109 { return theChipsInX; }

◆ numberOfROCsInY()

int CTPPSPixelIndices::numberOfROCsInY ( void  )
inline

Definition at line 110 of file CTPPSPixelIndices.h.

References theChipsInY.

110 { return theChipsInY; }

◆ pixelToChannelROC()

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

Definition at line 313 of file CTPPSPixelIndices.h.

313  {
314  return (rowROC << 6) | colROC; // reserve 6 bit for col ROC index 0-52
315  }

◆ print()

void CTPPSPixelIndices::print ( void  ) const
inline

Definition at line 112 of file CTPPSPixelIndices.h.

References theChipsInX, theChipsInY, theColsInDet, and theRowsInDet.

112  {
113  edm::LogInfo("RPix") << " Pixel det with " << theChipsInX << " chips in x and " << theChipsInY << " in y ";
114  edm::LogInfo("RPix") << " Pixel rows " << theRowsInDet << " and columns " << theColsInDet;
115  edm::LogInfo("RPix") << " Rows in one chip " << ROCSizeInX << " and columns " << ROCSizeInY;
116  edm::LogInfo("RPix") << " Double columns per ROC " << DColsPerROC;
117  }
Log< level::Info, false > LogInfo

◆ rocIndex()

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

Definition at line 269 of file CTPPSPixelIndices.h.

Referenced by getROCId(), and transformToROC().

269  {
270  int rocId = -1;
271  if (CTPPS_CHECK_LIMITS) {
272  if (chipX < 0 || chipX >= 2 || chipY < 0 || chipY >= 3) {
273  edm::LogError("RPix") << "PixelChipIndices: wrong index " << chipX << " " << chipY;
274  return -1;
275  }
276  }
277  if (chipX == 0)
278  rocId = 5 - chipY; // should be 3-5
279  else if (chipX == 1)
280  rocId = chipY; // should be 0-2
281 
282  if (CTPPS_CHECK_LIMITS) {
283  if (rocId < 0 || rocId >= (maxROCsInX * maxROCsInY)) {
284  edm::LogError("RPix") << "CTPPSPixelIndices: Error in ROC index " << rocId;
285  return -1;
286  }
287  }
288  return rocId;
289  }
Log< level::Error, false > LogError

◆ transformToModule()

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

Definition at line 160 of file CTPPSPixelIndices.h.

References cuy::col, theChipsInX, and theChipsInY.

Referenced by RPixDetClusterizer::buildClusters(), WriteCTPPSPixGainCalibrations::getGainsPedsFromHistos(), CTPPSPixelROC::toGlobal(), and CTPPSPixelROC::toGlobalfromDcol().

160  {
161  if (CTPPS_CHECK_LIMITS) {
162  if (colROC < 0 || colROC >= ROCSizeInY || rowROC < 0 || rowROC >= ROCSizeInX) {
163  edm::LogError("RPix") << "CTPPSPixelIndices: wrong index " << colROC << " " << rowROC;
164  return -1;
165  }
166  }
167 
168  // The transformation depends on the ROC-ID
169  if (rocId >= 0 && rocId < 3) {
170  row = 159 - rowROC;
171 
172  col = (rocId + 1) * ROCSizeInY - colROC - 1;
173  } else if (rocId >= 3 && rocId < 6) {
174  row = rowROC;
175 
176  col = (5 - rocId) * ROCSizeInY + colROC;
177  } else {
178  edm::LogError("RPix") << "CTPPSPixelIndices: wrong ROC ID " << rocId;
179  return -1;
180  }
181  if (CTPPS_CHECK_LIMITS) {
182  if (col < 0 || col >= (ROCSizeInY * theChipsInY) || row < 0 || row >= (ROCSizeInX * theChipsInX)) {
183  edm::LogError("RPix") << "CTPPSPixelIndices: wrong index " << col << " " << row;
184  return -1;
185  }
186  }
187 
188  return 0;
189  }
Log< level::Error, false > LogError
col
Definition: cuy.py:1009

◆ transformToROC()

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

Definition at line 195 of file CTPPSPixelIndices.h.

References cuy::col, rocIndex(), theChipsInX, and theChipsInY.

Referenced by CTPPSPixelDQMSource::analyze(), CTPPSPixelDataFormatter::formatRawData(), and CTPPSPixelROC::toLocal().

195  {
196  if (CTPPS_CHECK_LIMITS) {
197  if (col < 0 || col >= (ROCSizeInY * theChipsInY) || row < 0 || row >= (ROCSizeInX * theChipsInX)) {
198  edm::LogError("RPix") << "CTPPSPixelIndices: wrong index 3 ";
199  return -1;
200  }
201  }
202 
203  // Get the 2d ROC coordinate
204  int chipX = row / ROCSizeInX; // row index of the chip 0-1
205  int chipY = col / ROCSizeInY; // col index of the chip 0-2
206 
207  // Get the ROC id from the 2D index
208  rocId = rocIndex(chipX, chipY);
209  if (CTPPS_CHECK_LIMITS && (rocId < 0 || rocId >= 6)) {
210  edm::LogError("RPix") << "CTPPSPixelIndices: wrong roc index " << rocId;
211  return -1;
212  }
213  // get the local ROC coordinates
214  rowROC = (row % ROCSizeInX); // row in chip
215  colROC = (col % ROCSizeInY); // col in chip
216 
217  if (rocId < 3) {
218  colROC = 51 - colROC;
219  rowROC = 79 - rowROC;
220  }
221 
222  if (CTPPS_CHECK_LIMITS) {
223  if (colROC < 0 || colROC >= ROCSizeInY || rowROC < 0 || rowROC >= ROCSizeInX) {
224  edm::LogError("RPix") << "CTPPSPixelIndices: wrong index " << colROC << " " << rowROC;
225  return -1;
226  }
227  }
228 
229  return 0;
230  }
Log< level::Error, false > LogError
static int rocIndex(const int chipX, const int chipY)
col
Definition: cuy.py:1009

Member Data Documentation

◆ theChipsInX

int CTPPSPixelIndices::theChipsInX
private

◆ theChipsInY

int CTPPSPixelIndices::theChipsInY
private

◆ theColsInDet

int CTPPSPixelIndices::theColsInDet
private

Definition at line 327 of file CTPPSPixelIndices.h.

Referenced by CTPPSPixelIndices(), and print().

◆ theRowsInDet

int CTPPSPixelIndices::theRowsInDet
private

Definition at line 328 of file CTPPSPixelIndices.h.

Referenced by CTPPSPixelIndices(), and print().