CMS 3D CMS Logo

PixelIndices Class Reference

#include <CondFormats/SiPixelObjects/interface/PixelIndices.h>

List of all members.

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, intchannelToPixelROC (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 ( const int  colsInDet,
const int  rowsInDet 
) [inline]

Definition at line 46 of file PixelIndices.h.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), maxROCsInX, maxROCsInY, ROCSizeInX, ROCSizeInY, theChipsInX, theChipsInY, theColsInDet, theRowsInDet, and TP_CHECK_LIMITS.

00046                                                             : 
00047                 theColsInDet(colsInDet), theRowsInDet (rowsInDet) {
00048  
00049     theChipsInX = theRowsInDet / ROCSizeInX; // number of ROCs in X
00050     theChipsInY = theColsInDet / ROCSizeInY;    // number of ROCs in Y
00051 
00052     if(TP_CHECK_LIMITS) {
00053       if(theChipsInX<1 || theChipsInX>maxROCsInX) 
00054         std::cout << " PixelIndices: Error in ROCsInX " 
00055              << theChipsInX <<" "<<theRowsInDet<<" "<<ROCSizeInX<<std::endl;
00056       if(theChipsInY<1 || theChipsInY>maxROCsInY) 
00057         std::cout << " PixelIndices: Error in ROCsInY " 
00058              << theChipsInY <<" "<<theColsInDet<<" "<<ROCSizeInY<<std::endl;
00059     }
00060   } 

PixelIndices::~PixelIndices (  )  [inline]

Definition at line 62 of file PixelIndices.h.

00062 {}


Member Function Documentation

static std::pair<int,int> PixelIndices::channelToPixelROC ( const int  chan  )  [inline, static]

Definition at line 253 of file PixelIndices.h.

Referenced by SiPixelDigitizerAlgorithm::SiPixelDigitizerAlgorithm().

00253                                                                    {
00254     int rowROC = (chan >> 6) & 0x7F; // reserve 7 bits for row ROC index 0-79 
00255     int colROC = chan & 0x3F;
00256     return std::pair<int,int>(rowROC,colROC);
00257   }

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 funct::abs(), GenMuonPlsPt100GeV_cfg::cout, DColsPerROC, lat::endl(), ROCSizeInX, ROCSizeInY, and TP_CHECK_LIMITS.

00089                                                                  {
00090 
00091       if(TP_CHECK_LIMITS) { 
00092         if(dcol<0||dcol>=DColsPerROC||pix<2||pix>161) {
00093           std::cout<<"PixelIndices: wrong dcol or pix "<<dcol<<" "<<pix<<std::endl;
00094           rowROC = -1;     // dummy row Address
00095           colROC = -1;     // dummy col Address
00096           return -1; // Signal error
00097         }
00098       }
00099 
00100       // First find if we are in the first or 2nd col of a dcol.
00101       int colEvenOdd = pix%2;  // module(2), 0-1st sol, 1-2nd col.
00102       // Transform
00103       colROC = dcol * 2 + colEvenOdd; // col address, starts from 0
00104       rowROC = abs( int(pix/2) - 80); // row addres, starts from 0
00105 
00106       if(TP_CHECK_LIMITS) {
00107         if(colROC<0||colROC>=ROCSizeInY||rowROC<0||rowROC>=ROCSizeInX ) {
00108           std::cout<<"PixelIndices: wrong col or row "<<colROC<<" "<<rowROC<<" "
00109               <<dcol<<" "<<pix<<std::endl;
00110           rowROC = -1;    // dummy row Address
00111           colROC = -1;    // dummy col Address
00112           return -1;
00113         }
00114       }
00115       return 0;
00116     }

static int PixelIndices::DColumn ( const int  colROC  )  [inline, static]

Definition at line 229 of file PixelIndices.h.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and TP_CHECK_LIMITS.

Referenced by SiPixelDigitizerAlgorithm::pixel_inefficiency().

00229                                               {
00230 
00231     int dColumnId = (colROC)/2; // double column 0-25
00232     if(TP_CHECK_LIMITS) {
00233       if(dColumnId<0 || dColumnId>=26) {
00234         std::cout<<"PixelIndices: wrong dcol index  "<<dColumnId<<" "<<colROC<<std::endl;
00235         return -1;
00236       }
00237     }
00238     return dColumnId;
00239   }

static int PixelIndices::DColumnInModule ( const int  dcol,
const int  chipIndex 
) [inline, static]

Definition at line 243 of file PixelIndices.h.

Referenced by SiPixelDigitizerAlgorithm::pixel_inefficiency().

00243                                                                          {
00244     int dcolInMod = dcol + chipIndex * 26;
00245     return dcolInMod;
00246   }

int PixelIndices::numberOfROCsInX ( void   )  [inline]

Definition at line 65 of file PixelIndices.h.

References theChipsInX.

00065 {return theChipsInX;}

int PixelIndices::numberOfROCsInY ( void   )  [inline]

Definition at line 66 of file PixelIndices.h.

References theChipsInY.

00066 {return theChipsInY;}

static int PixelIndices::pixelToChannelROC ( const int  rowROC,
const int  colROC 
) [inline, static]

Definition at line 250 of file PixelIndices.h.

Referenced by SiPixelDigitizerAlgorithm::SiPixelDigitizerAlgorithm().

00250                                                                           {
00251     return (rowROC<<6) | colROC;  // reserve 6 bit for col ROC index 0-52
00252   }

void PixelIndices::print ( void   )  const [inline]

Definition at line 70 of file PixelIndices.h.

References GenMuonPlsPt100GeV_cfg::cout, DColsPerROC, lat::endl(), ROCSizeInX, ROCSizeInY, theChipsInX, theChipsInY, theColsInDet, and theRowsInDet.

00070                         {
00071 
00072     std::cout << " Pixel det with " << theChipsInX << " chips in x and "
00073          << theChipsInY << " in y " << std::endl; 
00074     std::cout << " Pixel rows " << theRowsInDet << " and columns " 
00075          << theColsInDet << std::endl;  
00076     std::cout << " Rows in one chip " << ROCSizeInX << " and columns " 
00077          << ROCSizeInY << std::endl;  
00078     std::cout << " Double columns per ROC " << DColsPerROC << std::endl;
00079   }

static int PixelIndices::rocIndex ( const int  chipX,
const int  chipY 
) [inline, static]

Definition at line 206 of file PixelIndices.h.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), maxROCsInX, maxROCsInY, and TP_CHECK_LIMITS.

Referenced by transformToROC().

00206                                                                {
00207 
00208     int rocId = -1;
00209     if(TP_CHECK_LIMITS) {
00210       if(chipX<0 || chipX>=2 ||chipY<0 || chipY>=8) {
00211         std::cout<<"PixelChipIndices: wrong index "<<chipX<<" "<<chipY<<std::endl;
00212         return -1;
00213       }
00214     }
00215     if(chipX==0) rocId = chipY + 8;  // should be 8-15
00216     else if(chipX==1) rocId = 7 - chipY; // should be 0-7
00217 
00218     if(TP_CHECK_LIMITS) {
00219       if(rocId < 0 || rocId >= (maxROCsInX*maxROCsInY) ) {
00220         std::cout << "PixelIndices: Error in ROC index " << rocId << std::endl;
00221         return -1;
00222       }
00223     }
00224     return rocId;
00225   }

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 GenMuonPlsPt100GeV_cfg::cout, lat::endl(), ROCSizeInX, ROCSizeInY, theChipsInX, theChipsInY, and TP_CHECK_LIMITS.

00126                                                     {
00127 
00128        if(TP_CHECK_LIMITS) {
00129         if(colROC<0 || colROC>=ROCSizeInY || rowROC<0 ||rowROC>=ROCSizeInX) {
00130           std::cout<<"PixelIndices: wrong index "<<colROC<<" "<<rowROC<<std::endl;
00131           return -1;
00132         }
00133       }
00134 
00135       // The transformation depends on the ROC-ID
00136       if(rocId>=0 && rocId<8) {
00137         row = 159-rowROC;
00138         //col = rocId*52 + colROC;
00139         col = (8-rocId)*ROCSizeInY - colROC - 1;
00140       } else if(rocId>=8 && rocId<16) {
00141         row = rowROC;
00142         //col = (16-rocId)*52 - colROC - 1;
00143         col = (rocId-8)*ROCSizeInY + colROC;
00144       } else {
00145         std::cout<<"PixelIndices: wrong ROC ID "<<rocId<<std::endl;
00146         return -1;
00147       }
00148       if(TP_CHECK_LIMITS) {
00149         if(col<0 || col>=(ROCSizeInY*theChipsInY) || row<0 || 
00150                              row>=(ROCSizeInX*theChipsInX)) {
00151         std::cout<<"PixelIndices: wrong index "<<col<<" "<<row<<std::endl;
00152         return -1;
00153         }
00154       }
00155 
00156       return 0;
00157   }

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 GenMuonPlsPt100GeV_cfg::cout, lat::endl(), rocIndex(), ROCSizeInX, ROCSizeInY, theChipsInX, theChipsInY, and TP_CHECK_LIMITS.

Referenced by SiPixelDigitizerAlgorithm::pixel_inefficiency().

00164                                                                      {
00165 
00166       if(TP_CHECK_LIMITS) {
00167         if(col<0 || col>=(ROCSizeInY*theChipsInY) || row<0 || 
00168                              row>=(ROCSizeInX*theChipsInX)) {
00169           std::cout<<"PixelIndices: wrong index 3 "<<std::endl;
00170           return -1;
00171         }
00172       }
00173 
00174       // Get the 2d ROC coordinate
00175       int chipX = row / ROCSizeInX; // row index of the chip 0-1
00176       int chipY = col / ROCSizeInY; // col index of the chip 0-7
00177 
00178       // Get the ROC id from the 2D index
00179       rocId = rocIndex(chipX,chipY); 
00180       if(TP_CHECK_LIMITS && (rocId<0 || rocId>=16) ) {
00181         std::cout<<"PixelIndices: wrong roc index "<<rocId<<std::endl;
00182         return -1;
00183       }
00184       // get the local ROC coordinates
00185       rowROC = (row%ROCSizeInX); // row in chip
00186       colROC = (col%ROCSizeInY); // col in chip
00187 
00188       if(rocId<8) { // For lower 8 ROCs the coordinates are reversed
00189         colROC = 51 - colROC;
00190         rowROC = 79 - rowROC;
00191       }
00192 
00193       if(TP_CHECK_LIMITS) {
00194         if(colROC<0||colROC>=ROCSizeInY||rowROC<0||rowROC>=ROCSizeInX) {
00195           std::cout<<"PixelIndices: wrong index "<<colROC<<" "<<rowROC<<std::endl;
00196           return -1;
00197         }
00198       }
00199 
00200       return 0;
00201   }


Member Data Documentation

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().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:30:02 2009 for CMSSW by  doxygen 1.5.4