#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 |
Definition at line 40 of file PixelIndices.h.
PixelIndices::PixelIndices | ( | const int | colsInDet, |
const int | rowsInDet | ||
) | [inline] |
Definition at line 46 of file PixelIndices.h.
References gather_cfg::cout, theChipsInX, theChipsInY, theColsInDet, and theRowsInDet.
: theColsInDet(colsInDet), theRowsInDet (rowsInDet) { theChipsInX = theRowsInDet / ROCSizeInX; // number of ROCs in X theChipsInY = theColsInDet / ROCSizeInY; // number of ROCs in Y if(TP_CHECK_LIMITS) { if(theChipsInX<1 || theChipsInX>maxROCsInX) std::cout << " PixelIndices: Error in ROCsInX " << theChipsInX <<" "<<theRowsInDet<<" "<<ROCSizeInX<<std::endl; if(theChipsInY<1 || theChipsInY>maxROCsInY) std::cout << " PixelIndices: Error in ROCsInY " << theChipsInY <<" "<<theColsInDet<<" "<<ROCSizeInY<<std::endl; } }
PixelIndices::~PixelIndices | ( | ) | [inline] |
Definition at line 62 of file PixelIndices.h.
{}
static std::pair<int,int> PixelIndices::channelToPixelROC | ( | const int | chan | ) | [inline, static] |
Definition at line 253 of file PixelIndices.h.
Referenced by SiPixelDigitizerAlgorithm::initCal().
{ int rowROC = (chan >> 6) & 0x7F; // reserve 7 bits for row ROC index 0-79 int colROC = chan & 0x3F; return std::pair<int,int>(rowROC,colROC); }
static int PixelIndices::convertDcolToCol | ( | const int | dcol, |
const int | pix, | ||
int & | colROC, | ||
int & | rowROC | ||
) | [inline, static] |
Definition at line 88 of file PixelIndices.h.
References abs, and gather_cfg::cout.
{ if(TP_CHECK_LIMITS) { if(dcol<0||dcol>=DColsPerROC||pix<2||pix>161) { std::cout<<"PixelIndices: wrong dcol or pix "<<dcol<<" "<<pix<<std::endl; rowROC = -1; // dummy row Address colROC = -1; // dummy col Address return -1; // Signal error } } // First find if we are in the first or 2nd col of a dcol. int colEvenOdd = pix%2; // module(2), 0-1st sol, 1-2nd col. // Transform colROC = dcol * 2 + colEvenOdd; // col address, starts from 0 rowROC = abs( int(pix/2) - 80); // row addres, starts from 0 if(TP_CHECK_LIMITS) { if(colROC<0||colROC>=ROCSizeInY||rowROC<0||rowROC>=ROCSizeInX ) { std::cout<<"PixelIndices: wrong col or row "<<colROC<<" "<<rowROC<<" " <<dcol<<" "<<pix<<std::endl; rowROC = -1; // dummy row Address colROC = -1; // dummy col Address return -1; } } return 0; }
static int PixelIndices::DColumn | ( | const int | colROC | ) | [inline, static] |
Definition at line 229 of file PixelIndices.h.
References gather_cfg::cout.
{ int dColumnId = (colROC)/2; // double column 0-25 if(TP_CHECK_LIMITS) { if(dColumnId<0 || dColumnId>=26) { std::cout<<"PixelIndices: wrong dcol index "<<dColumnId<<" "<<colROC<<std::endl; return -1; } } return dColumnId; }
static int PixelIndices::DColumnInModule | ( | const int | dcol, |
const int | chipIndex | ||
) | [inline, static] |
Definition at line 243 of file PixelIndices.h.
{ int dcolInMod = dcol + chipIndex * 26; return dcolInMod; }
int PixelIndices::numberOfROCsInX | ( | void | ) | [inline] |
int PixelIndices::numberOfROCsInY | ( | void | ) | [inline] |
static int PixelIndices::pixelToChannelROC | ( | const int | rowROC, |
const int | colROC | ||
) | [inline, static] |
Definition at line 250 of file PixelIndices.h.
Referenced by SiPixelDigitizerAlgorithm::initCal().
{ return (rowROC<<6) | colROC; // reserve 6 bit for col ROC index 0-52 }
void PixelIndices::print | ( | void | ) | const [inline] |
Definition at line 70 of file PixelIndices.h.
References gather_cfg::cout, theChipsInX, theChipsInY, theColsInDet, and theRowsInDet.
{ std::cout << " Pixel det with " << theChipsInX << " chips in x and " << theChipsInY << " in y " << std::endl; std::cout << " Pixel rows " << theRowsInDet << " and columns " << theColsInDet << std::endl; std::cout << " Rows in one chip " << ROCSizeInX << " and columns " << ROCSizeInY << std::endl; std::cout << " Double columns per ROC " << DColsPerROC << std::endl; }
static int PixelIndices::rocIndex | ( | const int | chipX, |
const int | chipY | ||
) | [inline, static] |
Definition at line 206 of file PixelIndices.h.
References gather_cfg::cout.
Referenced by transformToROC().
{ int rocId = -1; if(TP_CHECK_LIMITS) { if(chipX<0 || chipX>=2 ||chipY<0 || chipY>=8) { std::cout<<"PixelChipIndices: wrong index "<<chipX<<" "<<chipY<<std::endl; return -1; } } if(chipX==0) rocId = chipY + 8; // should be 8-15 else if(chipX==1) rocId = 7 - chipY; // should be 0-7 if(TP_CHECK_LIMITS) { if(rocId < 0 || rocId >= (maxROCsInX*maxROCsInY) ) { std::cout << "PixelIndices: Error in ROC index " << rocId << std::endl; return -1; } } return rocId; }
int PixelIndices::transformToModule | ( | const int | colROC, |
const int | rowROC, | ||
const int | rocId, | ||
int & | col, | ||
int & | row | ||
) | const [inline] |
Definition at line 124 of file PixelIndices.h.
References gather_cfg::cout, theChipsInX, and theChipsInY.
{ if(TP_CHECK_LIMITS) { if(colROC<0 || colROC>=ROCSizeInY || rowROC<0 ||rowROC>=ROCSizeInX) { std::cout<<"PixelIndices: wrong index "<<colROC<<" "<<rowROC<<std::endl; return -1; } } // The transformation depends on the ROC-ID if(rocId>=0 && rocId<8) { row = 159-rowROC; //col = rocId*52 + colROC; col = (8-rocId)*ROCSizeInY - colROC - 1; } else if(rocId>=8 && rocId<16) { row = rowROC; //col = (16-rocId)*52 - colROC - 1; col = (rocId-8)*ROCSizeInY + colROC; } else { std::cout<<"PixelIndices: wrong ROC ID "<<rocId<<std::endl; return -1; } if(TP_CHECK_LIMITS) { if(col<0 || col>=(ROCSizeInY*theChipsInY) || row<0 || row>=(ROCSizeInX*theChipsInX)) { std::cout<<"PixelIndices: wrong index "<<col<<" "<<row<<std::endl; return -1; } } return 0; }
int PixelIndices::transformToROC | ( | const int | col, |
const int | row, | ||
int & | rocId, | ||
int & | colROC, | ||
int & | rowROC | ||
) | const [inline] |
Definition at line 163 of file PixelIndices.h.
References gather_cfg::cout, rocIndex(), theChipsInX, and theChipsInY.
{ if(TP_CHECK_LIMITS) { if(col<0 || col>=(ROCSizeInY*theChipsInY) || row<0 || row>=(ROCSizeInX*theChipsInX)) { std::cout<<"PixelIndices: wrong index 3 "<<std::endl; return -1; } } // Get the 2d ROC coordinate int chipX = row / ROCSizeInX; // row index of the chip 0-1 int chipY = col / ROCSizeInY; // col index of the chip 0-7 // Get the ROC id from the 2D index rocId = rocIndex(chipX,chipY); if(TP_CHECK_LIMITS && (rocId<0 || rocId>=16) ) { std::cout<<"PixelIndices: wrong roc index "<<rocId<<std::endl; return -1; } // get the local ROC coordinates rowROC = (row%ROCSizeInX); // row in chip colROC = (col%ROCSizeInY); // col in chip if(rocId<8) { // For lower 8 ROCs the coordinates are reversed colROC = 51 - colROC; rowROC = 79 - rowROC; } if(TP_CHECK_LIMITS) { if(colROC<0||colROC>=ROCSizeInY||rowROC<0||rowROC>=ROCSizeInX) { std::cout<<"PixelIndices: wrong index "<<colROC<<" "<<rowROC<<std::endl; return -1; } } return 0; }
int PixelIndices::theChipsInX [private] |
Definition at line 265 of file PixelIndices.h.
Referenced by numberOfROCsInX(), PixelIndices(), print(), transformToModule(), and transformToROC().
int PixelIndices::theChipsInY [private] |
Definition at line 266 of file PixelIndices.h.
Referenced by numberOfROCsInY(), PixelIndices(), print(), transformToModule(), and transformToROC().
int PixelIndices::theColsInDet [private] |
Definition at line 263 of file PixelIndices.h.
Referenced by PixelIndices(), and print().
int PixelIndices::theRowsInDet [private] |
Definition at line 264 of file PixelIndices.h.
Referenced by PixelIndices(), and print().