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 rpixValues::CTPPS_CHECK_LIMITS, rpixValues::maxROCsInX, rpixValues::maxROCsInY, rpixValues::ROCSizeInX, rpixValues::ROCSizeInY, theChipsInX, theChipsInY, theColsInDet, and theRowsInDet.

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

◆ CTPPSPixelIndices() [2/2]

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

Definition at line 93 of file CTPPSPixelIndices.h.

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

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

◆ ~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 320 of file CTPPSPixelIndices.h.

References officialStyle::chan.

320  {
321  int rowROC = (chan >> 6) & 0x7F; // reserve 7 bits for row ROC index 0-79
322  int colROC = chan & 0x3F;
323  return std::pair<int, int>(rowROC, colROC);
324  }
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(), rpixValues::CTPPS_CHECK_LIMITS, rpixValues::DColsPerROC, rpixValues::ROCSizeInX, and rpixValues::ROCSizeInY.

Referenced by CTPPSPixelROC::toGlobalfromDcol().

126  {
128  if (dcol < 0 || dcol >= rpixValues::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 
143  if (colROC < 0 || colROC >= rpixValues::ROCSizeInY || rowROC < 0 || rowROC >= rpixValues::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
constexpr bool CTPPS_CHECK_LIMITS
constexpr int DColsPerROC
constexpr int ROCSizeInX
constexpr int ROCSizeInY

◆ DColumn()

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

Definition at line 297 of file CTPPSPixelIndices.h.

References rpixValues::CTPPS_CHECK_LIMITS.

Referenced by CTPPSPixelDataFormatter::formatRawData().

297  {
298  int dColumnId = (colROC) / 2; // double column 0-25
300  if (dColumnId < 0 || dColumnId >= 26) {
301  edm::LogError("RPix") << "CTPPSPixelIndices: wrong dcol index " << dColumnId << " " << colROC;
302  return -1;
303  }
304  }
305  return dColumnId;
306  }
Log< level::Error, false > LogError
constexpr bool CTPPS_CHECK_LIMITS

◆ DColumnInModule()

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

Definition at line 310 of file CTPPSPixelIndices.h.

310  {
311  int dcolInMod = dcol + chipIndex * 26;
312  return dcolInMod;
313  }

◆ getDefaultColDetSize()

int CTPPSPixelIndices::getDefaultColDetSize ( ) const
inline

Definition at line 327 of file CTPPSPixelIndices.h.

References rpixValues::defaultDetSizeInY.

Referenced by RPixClusterToHit::make_hit().

constexpr int defaultDetSizeInY

◆ getDefaultRowDetSize()

int CTPPSPixelIndices::getDefaultRowDetSize ( ) const
inline

Definition at line 326 of file CTPPSPixelIndices.h.

References rpixValues::defaultDetSizeInX.

Referenced by RPixClusterToHit::make_hit().

constexpr int defaultDetSizeInX

◆ getROCId()

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

Definition at line 236 of file CTPPSPixelIndices.h.

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

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

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

◆ isOnEdge()

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

Definition at line 262 of file CTPPSPixelIndices.h.

References cuy::col, rpixValues::defaultDetSizeInX, and rpixValues::defaultDetSizeInY.

262  {
263  if (col == 0 || row == 0 || col == (rpixValues::defaultDetSizeInY - 1) ||
264  row == (rpixValues::defaultDetSizeInX - 1))
265  return true;
266  return false;
267  }
constexpr int defaultDetSizeInX
constexpr int defaultDetSizeInY
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 317 of file CTPPSPixelIndices.h.

317  {
318  return (rowROC << 6) | colROC; // reserve 6 bit for col ROC index 0-52
319  }

◆ print()

void CTPPSPixelIndices::print ( void  ) const
inline

Definition at line 112 of file CTPPSPixelIndices.h.

References rpixValues::DColsPerROC, rpixValues::ROCSizeInX, rpixValues::ROCSizeInY, 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 " << rpixValues::ROCSizeInX << " and columns " << rpixValues::ROCSizeInY;
116  edm::LogInfo("RPix") << " Double columns per ROC " << rpixValues::DColsPerROC;
117  }
Log< level::Info, false > LogInfo
constexpr int DColsPerROC
constexpr int ROCSizeInX
constexpr int ROCSizeInY

◆ rocIndex()

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

Definition at line 273 of file CTPPSPixelIndices.h.

References rpixValues::CTPPS_CHECK_LIMITS, rpixValues::maxROCsInX, and rpixValues::maxROCsInY.

Referenced by getROCId(), and transformToROC().

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

◆ 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, rpixValues::CTPPS_CHECK_LIMITS, rpixValues::ROCSizeInX, rpixValues::ROCSizeInY, theChipsInX, and theChipsInY.

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

160  {
162  if (colROC < 0 || colROC >= rpixValues::ROCSizeInY || rowROC < 0 || rowROC >= rpixValues::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) * rpixValues::ROCSizeInY - colROC - 1;
173  } else if (rocId >= 3 && rocId < 6) {
174  row = rowROC;
175 
176  col = (5 - rocId) * rpixValues::ROCSizeInY + colROC;
177  } else {
178  edm::LogError("RPix") << "CTPPSPixelIndices: wrong ROC ID " << rocId;
179  return -1;
180  }
182  if (col < 0 || col >= (rpixValues::ROCSizeInY * theChipsInY) || row < 0 ||
183  row >= (rpixValues::ROCSizeInX * theChipsInX)) {
184  edm::LogError("RPix") << "CTPPSPixelIndices: wrong index " << col << " " << row;
185  return -1;
186  }
187  }
188 
189  return 0;
190  }
Log< level::Error, false > LogError
constexpr bool CTPPS_CHECK_LIMITS
col
Definition: cuy.py:1009
constexpr int ROCSizeInX
constexpr int ROCSizeInY

◆ transformToROC()

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

Definition at line 196 of file CTPPSPixelIndices.h.

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

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

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

Member Data Documentation

◆ theChipsInX

int CTPPSPixelIndices::theChipsInX
private

◆ theChipsInY

int CTPPSPixelIndices::theChipsInY
private

◆ theColsInDet

int CTPPSPixelIndices::theColsInDet
private

Definition at line 331 of file CTPPSPixelIndices.h.

Referenced by CTPPSPixelIndices(), and print().

◆ theRowsInDet

int CTPPSPixelIndices::theRowsInDet
private

Definition at line 332 of file CTPPSPixelIndices.h.

Referenced by CTPPSPixelIndices(), and print().