CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

RectangularPixelTopology Class Reference

#include <RectangularPixelTopology.h>

Inheritance diagram for RectangularPixelTopology:
PixelTopology Topology

List of all members.

Public Member Functions

virtual int channel (const LocalPoint &lp) const
bool containsBigPixelInX (const int &ixmin, const int &ixmax) const
bool containsBigPixelInY (const int &iymin, const int &iymax) const
virtual bool isItBigPixelInX (const int ixbin) const
virtual bool isItBigPixelInY (const int iybin) const
bool isItEdgePixel (int ixbin, int iybin) const
bool isItEdgePixelInX (int ixbin) const
bool isItEdgePixelInY (int iybin) const
virtual LocalError localError (const MeasurementPoint &, const MeasurementError &) const
virtual LocalPoint localPosition (const MeasurementPoint &mp) const
virtual float localX (const float mpX) const
virtual float localY (const float mpY) const
virtual MeasurementError measurementError (const LocalPoint &, const LocalError &) const
virtual MeasurementPoint measurementPosition (const LocalPoint &lp) const
virtual int ncolumns () const
virtual int nrows () const
virtual std::pair< float, float > pitch () const
virtual std::pair< float, float > pixel (const LocalPoint &p) const
 RectangularPixelTopology (int nrows, int ncols, float pitchx, float pitchy)

Private Attributes

int m_ncols
int m_nrows
float m_pitchx
float m_pitchy
float m_xoffset
float m_yoffset

Static Private Attributes

static const int BIG_PIX_PER_ROC_X = 1
static const int BIG_PIX_PER_ROC_Y = 2
static const int COLS_PER_ROC = 52
static const int ROWS_PER_ROC = 80

Detailed Description

Definition at line 46 of file RectangularPixelTopology.h.


Constructor & Destructor Documentation

RectangularPixelTopology::RectangularPixelTopology ( int  nrows,
int  ncols,
float  pitchx,
float  pitchy 
) [inline]

Definition at line 57 of file RectangularPixelTopology.h.

References BIG_PIX_PER_ROC_X, BIG_PIX_PER_ROC_Y, COLS_PER_ROC, gather_cfg::cout, m_ncols, m_nrows, m_pitchx, m_pitchy, m_xoffset, m_yoffset, ROWS_PER_ROC, and TP_DEBUG.

                                          :
    m_nrows(nrows), m_ncols(ncols), 
    m_pitchx(pitchx), m_pitchy(pitchy) {
                                
    //using std::cout;
    //using std::endl;

    // Calculate the edge of the active sensor with respect to the center,
    // that is simply the half-size.       
    // Take into account large pixels
    m_xoffset = -(m_nrows + BIG_PIX_PER_ROC_X*m_nrows/ROWS_PER_ROC)/2. * 
      m_pitchx;
    m_yoffset = -(m_ncols + BIG_PIX_PER_ROC_Y*m_ncols/COLS_PER_ROC)/2. * 
      m_pitchy;

    if(TP_DEBUG) std::cout<<" RectangularPixelTopology: "
                  <<m_nrows<<" "<<m_ncols<<" "
                  <<m_pitchx<<" "<<m_pitchy<<" "<<m_xoffset<<" "<<m_yoffset
                  <<BIG_PIX_PER_ROC_X<<" "<<BIG_PIX_PER_ROC_Y<<" "
                  <<ROWS_PER_ROC<<" "<<COLS_PER_ROC<<std::endl;
  }

Member Function Documentation

virtual int RectangularPixelTopology::channel ( const LocalPoint lp) const [inline, virtual]

Implements Topology.

Definition at line 105 of file RectangularPixelTopology.h.

References L1TEmulatorMonitor_cff::p, pixel(), and PixelChannelIdentifier::pixelToChannel().

                                                   {
    std::pair<float,float> p = pixel(lp);
    return PixelChannelIdentifier::pixelToChannel( int(p.first), 
                                                   int(p.second));
  }
bool RectangularPixelTopology::containsBigPixelInX ( const int &  ixmin,
const int &  ixmax 
) const [virtual]

Implements PixelTopology.

Definition at line 516 of file RectangularPixelTopology.cc.

References i, and isItBigPixelInX().

                                                                                           {
  bool big = false;
  for(int i=ixmin; i!=ixmax+1; i++) {
    if(isItBigPixelInX(i) && big==false) big=true;
  }
  return big;
}
bool RectangularPixelTopology::containsBigPixelInY ( const int &  iymin,
const int &  iymax 
) const [virtual]

Implements PixelTopology.

Definition at line 524 of file RectangularPixelTopology.cc.

References i, and isItBigPixelInY().

                                                                                           {
  bool big = false;
  for(int i=iymin; i!=iymax+1; i++) {
    if(isItBigPixelInY(i) && big==false) big=true;
  }
  return big;
}
virtual bool RectangularPixelTopology::isItBigPixelInX ( const int  ixbin) const [inline, virtual]

Implements PixelTopology.

Definition at line 119 of file RectangularPixelTopology.h.

Referenced by containsBigPixelInX(), and localError().

                                                      {
    return ( (ixbin == 79) || (ixbin == 80));
  } 
virtual bool RectangularPixelTopology::isItBigPixelInY ( const int  iybin) const [inline, virtual]

Implements PixelTopology.

Definition at line 122 of file RectangularPixelTopology.h.

Referenced by containsBigPixelInY(), and localError().

                                                      {
    int iybin0 = iybin%52;
    return ( (iybin0 == 0) || (iybin0 == 51));
  } 
bool RectangularPixelTopology::isItEdgePixel ( int  ixbin,
int  iybin 
) const [inline, virtual]

Implements PixelTopology.

Definition at line 140 of file RectangularPixelTopology.h.

References isItEdgePixelInX(), and isItEdgePixelInY().

                                                  {
    return ( isItEdgePixelInX( ixbin ) || isItEdgePixelInY( iybin ) );
  } 
bool RectangularPixelTopology::isItEdgePixelInX ( int  ixbin) const [inline, virtual]

Implements PixelTopology.

Definition at line 134 of file RectangularPixelTopology.h.

References m_nrows.

Referenced by isItEdgePixel().

                                          {
    return ( (ixbin == 0) || (ixbin == (m_nrows-1)) );
  } 
bool RectangularPixelTopology::isItEdgePixelInY ( int  iybin) const [inline, virtual]

Implements PixelTopology.

Definition at line 137 of file RectangularPixelTopology.h.

References m_ncols.

Referenced by isItEdgePixel().

                                          {
    return ( (iybin == 0) || (iybin == (m_ncols-1)) );
  } 
LocalError RectangularPixelTopology::localError ( const MeasurementPoint mp,
const MeasurementError me 
) const [virtual]

Implements Topology.

Definition at line 480 of file RectangularPixelTopology.cc.

References isItBigPixelInX(), isItBigPixelInY(), m_pitchx, m_pitchy, MeasurementError::uu(), MeasurementError::vv(), PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().

                                                                        {
  float pitchy=m_pitchy;
  int binoffy=int(mp.y());
  if( isItBigPixelInY(binoffy) )pitchy = 2.*m_pitchy;

  float pitchx=m_pitchx;
  int binoffx=int(mp.x());
  if( isItBigPixelInX(binoffx) )pitchx = 2.*m_pitchx;

  return LocalError( me.uu()*float(pitchx*pitchx), 0,
                     me.vv()*float(pitchy*pitchy));
}
LocalPoint RectangularPixelTopology::localPosition ( const MeasurementPoint mp) const [virtual]

Implements Topology.

Definition at line 141 of file RectangularPixelTopology.cc.

References gather_cfg::cout, EPS, localX(), localY(), m_ncols, m_nrows, TP_DEBUG, PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().

                                          {
  using std::cout;
  using std::endl;

  float mpy = mp.y(); // measurements 
  float mpx = mp.x();

  // check limits
  if(TP_DEBUG) {
    if( mpy<0.) { //  
      cout<<" wrong mp y, fix "<<mpy<<" "
          <<0<<endl;
      mpy = 0.;
    }
    if( mpy>=m_ncols) {
      cout<<" wrong mp y, fix "<<mpy<<" "
          <<m_ncols<<endl;
      mpy = float(m_ncols) - EPS; // EPS is a small number
    }
    if( mpx<0.) { //  
      cout<<" wrong mp x, fix "<<mpx<<" "
          <<0<<endl;
      mpx = 0.;
    }
    if( mpx>=m_nrows) {
      cout<<" wrong mp x, fix "<<mpx<<" "
          <<m_nrows<<endl;
      mpx = float(m_nrows) - EPS; // EPS is a small number
    }
  } // if TP_DEBUG
  

  // IF IT WORKS OK REPLACE THE CODE BELOW BY A CALL TO localY()
  float lpY = localY(mpy);

//   // Start with Y
//   int binoffy = int(mpy);             // truncate to int
//   float fractionY = mpy - binoffy; // find the fraction 
//   float local_pitchy = m_pitchy;      // defaultpitch
//   //if(fractionY<0.) cout<<" fractiony m "<<fractionY<<" "<<mpy<<endl;

//   if (binoffy>415) {   // too large
//     if(TP_DEBUG) { 
//       cout<<" very bad, biny "<<binoffy<<endl;
//       cout<<mpy<<" "<<binoffy<<" "
//        <<fractionY<<" "<<local_pitchy<<" "<<m_yoffset<<endl;
//     }
//   } else if (binoffy==415) {    // ROC 7, last big pixel
//     binoffy=binoffy+15;
//     local_pitchy = 2 * m_pitchy;
//   } else if (binoffy>364) {     // ROC 7
//     binoffy=binoffy+15;
//   } else if (binoffy==364) {    // ROC 7
//     binoffy=binoffy+14;
//     local_pitchy = 2 * m_pitchy;
    
//   } else if (binoffy==363) {      // ROC 6
//     binoffy=binoffy+13;
//     local_pitchy = 2 * m_pitchy;    
//   } else if (binoffy>312) {       // ROC 6
//     binoffy=binoffy+13;
//   } else if (binoffy==312) {      // ROC 6
//     binoffy=binoffy+12;
//     local_pitchy = 2 * m_pitchy;
    
//   } else if (binoffy==311) {      // ROC 5
//     binoffy=binoffy+11;
//     local_pitchy = 2 * m_pitchy;    
//   } else if (binoffy>260) {       // ROC 5
//     binoffy=binoffy+11;
//   } else if (binoffy==260) {      // ROC 5
//     binoffy=binoffy+10;
//     local_pitchy = 2 * m_pitchy;
    
//   } else if (binoffy==259) {      // ROC 4
//     binoffy=binoffy+9;
//     local_pitchy = 2 * m_pitchy;    
//   } else if (binoffy>208) {       // ROC 4
//     binoffy=binoffy+9;
//   } else if (binoffy==208) {      // ROC 4
//     binoffy=binoffy+8;
//     local_pitchy = 2 * m_pitchy;
    
//   } else if (binoffy==207) {      // ROC 3
//     binoffy=binoffy+7;
//     local_pitchy = 2 * m_pitchy;    
//     } else if (binoffy>156) {       // ROC 3
//     binoffy=binoffy+7;
//   } else if (binoffy==156) {      // ROC 3
//     binoffy=binoffy+6;
//     local_pitchy = 2 * m_pitchy;
    
//   } else if (binoffy==155) {      // ROC 2
//     binoffy=binoffy+5;
//     local_pitchy = 2 * m_pitchy;    
//   } else if (binoffy>104) {       // ROC 2
//     binoffy=binoffy+5;
//   } else if (binoffy==104) {      // ROC 2
//     binoffy=binoffy+4;
//     local_pitchy = 2 * m_pitchy;
    
//   } else if (binoffy==103) {      // ROC 1
//     binoffy=binoffy+3;
//     local_pitchy = 2 * m_pitchy;    
//   } else if (binoffy>52) {       // ROC 1
//     binoffy=binoffy+3;
//   } else if (binoffy==52) {      // ROC 1
//     binoffy=binoffy+2;
//     local_pitchy = 2 * m_pitchy;
    
//   } else if (binoffy==51) {      // ROC 0
//     binoffy=binoffy+1;
//     local_pitchy = 2 * m_pitchy;    
//   } else if (binoffy>0) {        // ROC 0
//     binoffy=binoffy+1;
//   } else if (binoffy==0) {       // ROC 0
//     binoffy=binoffy+0;
//     local_pitchy = 2 * m_pitchy;
//   } else { // too small
//     if(TP_DEBUG) { 
//       cout<<" very bad, biny "<<binoffy<<endl;
//       cout<<mpy<<" "<<binoffy<<" "
//        <<fractionY<<" "<<local_pitchy<<" "<<m_yoffset<<endl;
//     }
//   }
  
//   // The final position in local coordinates 
//   float lpY = float(binoffy*m_pitchy) + fractionY*local_pitchy + 
//     m_yoffset;
//   if(TP_DEBUG && (lpY<m_yoffset || lpY>(-m_yoffset)) ) {
//     cout<<" bad lp y "<<lpY<<endl; 
//     cout<<mpy<<" "<<binoffy<<" "
//      <<fractionY<<" "<<local_pitchy<<" "<<m_yoffset<<endl;
//   }
  

  // IF IT WORKS OK REPLACE THE CODE BELOW BY A CALL TO localX()
  float lpX = localX(mpx);

//   // Do the X
//   int binoffx=int(mpx);             // truncate to int
//   float fractionX = mpx - binoffx; // find the fraction 
//   float local_pitchx = m_pitchx;      // defaultpitch
//   //if(fractionX<0.) cout<<" fractionx m "<<fractionX<<" "<<mpx<<endl;
  
//   if (binoffx>159) {   // too large
//     if(TP_DEBUG) { 
//       cout<<" very bad, binx "<<binoffx<<endl;
//       cout<<mpx<<" "<<binoffx<<" "
//        <<fractionX<<" "<<local_pitchx<<" "<<m_xoffset<<endl;
//     }
//   } else if (binoffx>80) {     // ROC 1
//     binoffx=binoffx+2;
//   } else if (binoffx==80) {    // ROC 1
//     binoffx=binoffx+1;
//     local_pitchx = 2 * m_pitchx;
    
//   } else if (binoffx==79) {      // ROC 0
//     binoffx=binoffx+0;
//     local_pitchx = 2 * m_pitchx;    
//   } else if (binoffx>=0) {       // ROC 0
//     binoffx=binoffx+0;
    
//   } else { // too small
//     if(TP_DEBUG) { 
//       cout<<" very bad, binx "<<binoffx<<endl;
//       cout<<mpx<<" "<<binoffx<<" "
//        <<fractionX<<" "<<local_pitchx<<" "<<m_xoffset<<endl;
//     }
//   }
  
//   // The final position in local coordinates 
//   float lpX = float(binoffx*m_pitchx) + fractionX*local_pitchx + 
//     m_xoffset;
  
//   if(TP_DEBUG && (lpX<m_xoffset || lpX>(-m_xoffset)) ) {
//     cout<<" bad lp x "<<lpX<<endl; 
//     cout<<mpx<<" "<<binoffx<<" "
//      <<fractionX<<" "<<local_pitchx<<" "<<m_xoffset<<endl;
//   }
  
  // Return it as a LocalPoint
  return LocalPoint( lpX, lpY);
}
float RectangularPixelTopology::localX ( const float  mpX) const [virtual]

Implements PixelTopology.

Definition at line 330 of file RectangularPixelTopology.cc.

References gather_cfg::cout, m_pitchx, m_xoffset, and TP_DEBUG.

Referenced by localPosition().

                                                            {
  using std::cout;
  using std::endl;

  int binoffx=int(mpx);             // truncate to int
  float fractionX = mpx - binoffx; // find the fraction 
  float local_pitchx = m_pitchx;      // defaultpitch
  //if(fractionX<0.) cout<<" fractionx m "<<fractionX<<" "<<mpx<<endl;
  
        if (binoffx>80) {            // ROC 1 - handles x on edge cluster
    binoffx=binoffx+2;
  } else if (binoffx==80) {    // ROC 1
    binoffx=binoffx+1;
    local_pitchx = 2 * m_pitchx;
    
  } else if (binoffx==79) {      // ROC 0
    binoffx=binoffx+0;
    local_pitchx = 2 * m_pitchx;    
  } else if (binoffx>=0) {       // ROC 0
    binoffx=binoffx+0;
    
  } else { // too small
    if(TP_DEBUG) { 
      cout<<" very bad, binx "<<binoffx<<endl;
      cout<<mpx<<" "<<binoffx<<" "
          <<fractionX<<" "<<local_pitchx<<" "<<m_xoffset<<endl;
    }
  }
  
  // The final position in local coordinates 
  float lpX = float(binoffx*m_pitchx) + fractionX*local_pitchx + 
    m_xoffset;
  
  if(TP_DEBUG && (lpX<m_xoffset || lpX>(-m_xoffset)) ) {
    cout<<" bad lp x "<<lpX<<endl; 
    cout<<mpx<<" "<<binoffx<<" "
        <<fractionX<<" "<<local_pitchx<<" "<<m_xoffset<<endl;
  }

  return lpX;
} 
float RectangularPixelTopology::localY ( const float  mpY) const [virtual]

Implements PixelTopology.

Definition at line 374 of file RectangularPixelTopology.cc.

References gather_cfg::cout, m_pitchy, m_yoffset, and TP_DEBUG.

Referenced by localPosition().

                                                            {
  using std::cout;
  using std::endl;
  int binoffy = int(mpy);             // truncate to int
  float fractionY = mpy - binoffy; // find the fraction 
  float local_pitchy = m_pitchy;      // defaultpitch
  //if(fractionY<0.) cout<<" fractiony m "<<fractionY<<" "<<mpy<<endl;

  if (binoffy>416) {            // ROC 8, not real ROC
    binoffy=binoffy+17;
  } else if (binoffy==416) {    // ROC 8
    binoffy=binoffy+16;
    local_pitchy = 2 * m_pitchy;
                
  } else if (binoffy==415) {    // ROC 7, last big pixel
    binoffy=binoffy+15;
    local_pitchy = 2 * m_pitchy;
  } else if (binoffy>364) {     // ROC 7
    binoffy=binoffy+15;
  } else if (binoffy==364) {    // ROC 7
    binoffy=binoffy+14;
    local_pitchy = 2 * m_pitchy;
    
  } else if (binoffy==363) {      // ROC 6
    binoffy=binoffy+13;
    local_pitchy = 2 * m_pitchy;    
  } else if (binoffy>312) {       // ROC 6
    binoffy=binoffy+13;
  } else if (binoffy==312) {      // ROC 6
    binoffy=binoffy+12;
    local_pitchy = 2 * m_pitchy;
    
  } else if (binoffy==311) {      // ROC 5
    binoffy=binoffy+11;
    local_pitchy = 2 * m_pitchy;    
  } else if (binoffy>260) {       // ROC 5
    binoffy=binoffy+11;
  } else if (binoffy==260) {      // ROC 5
    binoffy=binoffy+10;
    local_pitchy = 2 * m_pitchy;
    
  } else if (binoffy==259) {      // ROC 4
    binoffy=binoffy+9;
    local_pitchy = 2 * m_pitchy;    
  } else if (binoffy>208) {       // ROC 4
    binoffy=binoffy+9;
  } else if (binoffy==208) {      // ROC 4
    binoffy=binoffy+8;
    local_pitchy = 2 * m_pitchy;
    
  } else if (binoffy==207) {      // ROC 3
    binoffy=binoffy+7;
    local_pitchy = 2 * m_pitchy;    
    } else if (binoffy>156) {       // ROC 3
    binoffy=binoffy+7;
  } else if (binoffy==156) {      // ROC 3
    binoffy=binoffy+6;
    local_pitchy = 2 * m_pitchy;
    
  } else if (binoffy==155) {      // ROC 2
    binoffy=binoffy+5;
    local_pitchy = 2 * m_pitchy;    
  } else if (binoffy>104) {       // ROC 2
    binoffy=binoffy+5;
  } else if (binoffy==104) {      // ROC 2
    binoffy=binoffy+4;
    local_pitchy = 2 * m_pitchy;
    
  } else if (binoffy==103) {      // ROC 1
    binoffy=binoffy+3;
    local_pitchy = 2 * m_pitchy;    
  } else if (binoffy>52) {       // ROC 1
    binoffy=binoffy+3;
  } else if (binoffy==52) {      // ROC 1
    binoffy=binoffy+2;
    local_pitchy = 2 * m_pitchy;
    
  } else if (binoffy==51) {      // ROC 0
    binoffy=binoffy+1;
    local_pitchy = 2 * m_pitchy;    
  } else if (binoffy>0) {        // ROC 0
    binoffy=binoffy+1;
  } else if (binoffy==0) {       // ROC 0
    binoffy=binoffy+0;
    local_pitchy = 2 * m_pitchy;
  } else { // too small
    if(TP_DEBUG) { 
      cout<<" very bad, biny "<<binoffy<<endl;
      cout<<mpy<<" "<<binoffy<<" "
          <<fractionY<<" "<<local_pitchy<<" "<<m_yoffset<<endl;
    }
  }
  
  // The final position in local coordinates 
  float lpY = float(binoffy*m_pitchy) + fractionY*local_pitchy + 
    m_yoffset;
  if(TP_DEBUG && (lpY<m_yoffset || lpY>(-m_yoffset)) ) {
    cout<<" bad lp y "<<lpY<<endl; 
    cout<<mpy<<" "<<binoffy<<" "
        <<fractionY<<" "<<local_pitchy<<" "<<m_yoffset<<endl;
  }

  return lpY;
} 
MeasurementError RectangularPixelTopology::measurementError ( const LocalPoint lp,
const LocalError le 
) const [virtual]

Implements Topology.

Definition at line 496 of file RectangularPixelTopology.cc.

References m_pitchx, m_pitchy, m_xoffset, m_yoffset, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

                                             {

  float pitchy=m_pitchy;
  int iybin = int( (lp.y() - m_yoffset)/m_pitchy );   //get bin for equal picth 
  int iybin0 = iybin%54;  //This is just to avoid many ifs by using the periodicy
  //quasi bins 0,1,52,53 fall into larger pixels  
  if(iybin0==0 || iybin0==1 || iybin0==52 || iybin0==53 )
    pitchy = 2. * m_pitchy;

  float pitchx=m_pitchx;
  int ixbin = int( (lp.x() - m_xoffset)/m_pitchx );   //get bin for equal pitch
  //quasi bins 79,80,81,82 fall into the 2 larger pixels  
  if(ixbin>=79 && ixbin<=82) pitchx = 2. * m_pitchx;  

  return MeasurementError( le.xx()/float(pitchx*pitchx), 0,
                           le.yy()/float(pitchy*pitchy));
}
virtual MeasurementPoint RectangularPixelTopology::measurementPosition ( const LocalPoint lp) const [inline, virtual]

Implements Topology.

Definition at line 85 of file RectangularPixelTopology.h.

References L1TEmulatorMonitor_cff::p, and pixel().

            {
    std::pair<float,float> p = pixel(lp);
    return MeasurementPoint( p.first, p.second);
  }
virtual int RectangularPixelTopology::ncolumns ( ) const [inline, virtual]

Implements PixelTopology.

Definition at line 154 of file RectangularPixelTopology.h.

References m_ncols.

                               {
    return m_ncols;
  }
virtual int RectangularPixelTopology::nrows ( ) const [inline, virtual]

Implements PixelTopology.

Definition at line 150 of file RectangularPixelTopology.h.

References m_nrows.

                            {
    return m_nrows;
  }
virtual std::pair<float,float> RectangularPixelTopology::pitch ( ) const [inline, virtual]

Implements PixelTopology.

Definition at line 146 of file RectangularPixelTopology.h.

References m_pitchx, and m_pitchy.

                                             {
    return std::pair<float,float>( float(m_pitchx), float(m_pitchy));
  }
std::pair< float, float > RectangularPixelTopology::pixel ( const LocalPoint p) const [virtual]

Topology for rectangular pixel detector with BIG pixels.

Implements PixelTopology.

Definition at line 13 of file RectangularPixelTopology.cc.

References gather_cfg::cout, m_pitchx, m_pitchy, m_xoffset, m_yoffset, TP_DEBUG, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by channel(), and measurementPosition().

                                     {
  using std::cout;
  using std::endl;

  // check limits       
  float py = p.y();
  float px = p.x();
  
  if(TP_DEBUG) {
    // This will catch points which are outside the active sensor area.
    // In the digitizer during the early induce_signal phase non valid
    // location are passed here. They are cleaned later.
    if( py<m_yoffset ) { // m_yoffset is negative 
      cout<<" wrong lp y "<<py<<" "<<m_yoffset<<endl;
      py = m_yoffset + EPSCM; // make sure it is in, add an EPS in cm
    }
    if( py>-m_yoffset ) {
      cout<<" wrong lp y "<<py<<" "<<-m_yoffset<<endl;
      py = -m_yoffset - EPSCM;
    }
    if( px<m_xoffset ) { // m_xoffset is negative 
      cout<<" wrong lp x "<<px<<" "<<m_xoffset<<endl;
      px = m_xoffset + EPSCM;
    }
    if( px>-m_xoffset ) {
      cout<<" wrong lp x "<<px<<" "<<-m_xoffset<<endl;
      px = -m_xoffset - EPSCM;
    }
  } // end TP_DEBUG

  float newybin=(py - m_yoffset)/m_pitchy;
  int iybin = int(newybin);
  float fractionY = newybin - iybin;
  //if(fractionY<0.) cout<<" fractiony "<<fractionY<<" "<<newybin<<endl;
  
  // Normalize it all to 1 ROC
  int iybin0 = (iybin%54); // 0-53
  int numROC = iybin/54;  // 0-7
  
  if (iybin0>53) {
    if(TP_DEBUG) {
      cout<<" very bad, newbiny "<<iybin0<<endl;
      cout<<py<<" "<<m_yoffset<<" "<<m_pitchy<<" "
          <<newybin<<" "<<iybin<<" "<<fractionY<<" "<<iybin0<<" "
          <<numROC<<endl;
    }
  } else if (iybin0==53) {   // inside big pixel
    iybin0=51;
    fractionY = (fractionY+1.)/2.;
  } else if (iybin0==52) {   // inside big pixel
    iybin0=51;
    fractionY = fractionY/2.;
  } else if (iybin0>1) {   // inside normal pixel
    iybin0=iybin0-1;
  } else if (iybin0==1) {   // inside big pixel
    iybin0=0;
    fractionY = (fractionY+1.)/2.;
  } else if (iybin0==0) {   // inside big pixel
    iybin0=0;
    fractionY = fractionY/2.;
  } else {
    if(TP_DEBUG) {
      cout<<" very bad, newbiny "<<newybin<<endl;
      cout<<py<<" "<<m_yoffset<<" "<<m_pitchy<<" "
          <<newybin<<" "<<iybin<<" "<<fractionY<<" "
          <<iybin0<<" "<<numROC<<endl;
    }
  }
  float mpY = float(numROC*52. + iybin0) + fractionY;
  if(TP_DEBUG && (mpY<0. || mpY>=416.)) {
    cout<<" bad pix y "<<mpY<<endl;
    cout<<py<<" "<<m_yoffset<<" "<<m_pitchy<<" "
        <<newybin<<" "<<iybin<<" "<<fractionY<<" "
        <<iybin0<<" "<<numROC<<endl;
  }
  
  // In X
  float newxbin=(px - m_xoffset) / m_pitchx; 
  int ixbin = int(newxbin);
  float fractionX = newxbin - ixbin;
  // if(fractionX<0.) {
  //   cout<<" fractionx "<<fractionX<<" "<<newxbin<<" "<<ixbin<<" ";
  //   cout<<px<<" "<<m_xoffset<<" "<<m_pitchx<<" "
  //      <<newxbin<<" "<<ixbin<<" "<<fractionX<<endl;
  // }

  if (ixbin>161) {
    if(TP_DEBUG) {
      cout<<" very bad, newbinx "<<ixbin<<endl;
      cout<<px<<" "<<m_xoffset<<" "<<m_pitchx<<" "
          <<newxbin<<" "<<ixbin<<" "<<fractionX<<endl;
    }
  } else if (ixbin>82) {   // inside normal pixel, ROC 1 
    ixbin=ixbin-2;
  } else if (ixbin==82) {   // inside bin pixel 
    ixbin=80;
    fractionX = (fractionX+1.)/2.;
  } else if (ixbin==81) {   // inside big pixel
    ixbin=80;
    fractionX = fractionX/2.;
  } else if (ixbin==80) {   // inside bin pixel, ROC 0 
    ixbin=79;
    fractionX = (fractionX+1.)/2.;
  } else if (ixbin==79) {   // inside big pixel
    ixbin=79;
    fractionX = fractionX/2.;
  } else if (ixbin<0) {   // outside range
    if(TP_DEBUG) {
      cout<<" very bad, newbinx "<<ixbin<<endl;
      cout<<px<<" "<<m_xoffset<<" "<<m_pitchx<<" "
          <<newxbin<<" "<<ixbin<<" "<<fractionX<<endl;
    }
  }
  
  float mpX = float(ixbin) + fractionX;
  
  if(TP_DEBUG && (mpX<0. || mpX>=160.) ) {
    cout<<" bad pix x "<<mpX<<" "<<endl;
    cout<<px<<" "<<m_xoffset<<" "<<m_pitchx<<" "
        <<newxbin<<" "<<ixbin<<" "<<fractionX<<endl;
  }
  
  return std::pair<float,float>(mpX,mpY);
}

Member Data Documentation

const int RectangularPixelTopology::BIG_PIX_PER_ROC_X = 1 [static, private]

Definition at line 51 of file RectangularPixelTopology.h.

Referenced by RectangularPixelTopology().

const int RectangularPixelTopology::BIG_PIX_PER_ROC_Y = 2 [static, private]

Definition at line 52 of file RectangularPixelTopology.h.

Referenced by RectangularPixelTopology().

const int RectangularPixelTopology::COLS_PER_ROC = 52 [static, private]

Definition at line 50 of file RectangularPixelTopology.h.

Referenced by RectangularPixelTopology().

const int RectangularPixelTopology::ROWS_PER_ROC = 80 [static, private]

Definition at line 49 of file RectangularPixelTopology.h.

Referenced by RectangularPixelTopology().