CMS 3D CMS Logo

ClusterShape Class Reference

#include <RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShape.h>

List of all members.

Public Member Functions

 ClusterShape ()
void getExtra (const PixelGeomDetUnit &pixelDet, const SiPixelRecHit &recHit, ClusterData &data)
 ~ClusterShape ()

Private Member Functions

void determineShape (const PixelGeomDetUnit &pixelDet, const SiPixelRecHit &recHit, ClusterData &data)
int getDirection (int low, int hig, int olow, int ohig)
void getOrientation (const PixelGeomDetUnit &pixelDet, ClusterData &data)
bool processColumn (std::pair< int, int > pos, bool inTheLoop)

Private Attributes

int hig
int low
int odir
int ohig
int olow
int x [2]
int y [2]


Detailed Description

Definition at line 17 of file ClusterShape.h.


Constructor & Destructor Documentation

ClusterShape::ClusterShape (  ) 

Definition at line 12 of file ClusterShape.cc.

00013 {
00014 }

ClusterShape::~ClusterShape (  ) 

Definition at line 17 of file ClusterShape.cc.

00018 {
00019 }


Member Function Documentation

void ClusterShape::determineShape ( const PixelGeomDetUnit pixelDet,
const SiPixelRecHit recHit,
ClusterData data 
) [private]

Definition at line 94 of file ClusterShape.cc.

References BoundSurface::bounds(), SiPixelRecHit::cluster(), hig, i, int, ClusterData::isComplete, RectangularPixelTopology::isItBigPixelInX(), RectangularPixelTopology::isItBigPixelInY(), ClusterData::isStraight, ClusterData::isXBorder, PixelTopology::ncolumns(), PixelTopology::nrows(), odir, ohig, olow, PixelTopology::pitch(), ClusterData::posBorder, processColumn(), size, python::multivaluedict::sort(), PixelGeomDetUnit::specificTopology(), GeomDet::surface(), ClusterData::tangent, Bounds::thickness(), x, and y.

Referenced by getExtra().

00096 {
00097  // Dimensions
00098  int nrows = pixelDet.specificTopology().nrows();
00099  int ncols = pixelDet.specificTopology().ncolumns();
00100 
00101  // Tangents
00102  data.tangent.first  = pixelDet.specificTopology().pitch().first/
00103                        pixelDet.surface().bounds().thickness();    
00104  data.tangent.second = pixelDet.specificTopology().pitch().second/
00105                        pixelDet.surface().bounds().thickness();    
00106 
00107  // Initialize
00108  data.isStraight = true;
00109  data.isComplete = true;
00110 
00111  x[1]=-1; olow=-2; ohig=-2; odir=0;
00112  pair<int,int> pos;
00113 
00114  // Process channels
00115  SiPixelRecHit::ClusterRef const& cluster = recHit.cluster();
00116  vector<SiPixelCluster::Pixel> pixels = (*cluster).pixels();
00117 
00118  // Sort pixels
00119  sort(pixels.begin(),pixels.end(),lessPixel());
00120 
00121  int size = pixels.size();
00122  for(int i=0; i<size; i++)
00123  {
00124    // Position
00125    pos.first  = (int)pixels[i].x;
00126    pos.second = (int)pixels[i].y;
00127 
00128    // Check if at the edge
00129    if(pos.first  == 0 || pos.first  == nrows-1 ||
00130       pos.second == 0 || pos.second == ncols-1)
00131    { 
00132      data.isComplete = false;
00133 
00134      if(pos.first == 0 || pos.first  == nrows-1)
00135      {
00136        data.isXBorder = true;
00137        if(pos.first == 0) data.posBorder = 0;
00138                     else data.posBorder = nrows;
00139      }
00140 
00141      // overwrite
00142      if(pos.second == 0 || pos.second  == ncols-1)
00143      {
00144        data.isXBorder = false;
00145        if(pos.second == 0) data.posBorder = 0;
00146                       else data.posBorder = ncols;
00147      }
00148 
00149      break;
00150    }
00151 
00152    // Check if it is big
00153    if(RectangularPixelTopology::isItBigPixelInX(pos.first) ||
00154       RectangularPixelTopology::isItBigPixelInY(pos.second))
00155    { data.isComplete = false; break; }
00156 
00157    if(pos.first > x[1])
00158    { // Process column
00159      if(processColumn(pos, true) == false)
00160      { data.isStraight = false; break; }
00161    }
00162    else
00163    { // Increasing row
00164      if(pos.second > hig+1)
00165      { data.isStraight = false; break; }
00166 
00167      hig = pos.second;
00168    }
00169  }
00170 
00171  // Process last column
00172  if(processColumn(pos, false) == false)
00173    data.isStraight = false;
00174 }

int ClusterShape::getDirection ( int  low,
int  hig,
int  olow,
int  ohig 
) [private]

Definition at line 22 of file ClusterShape.cc.

00023 {
00024   if(hig == ohig && low == olow) return  0;
00025   if(hig >= ohig && low >= olow) return  1; 
00026   if(hig <= ohig && low <= olow) return -1;
00027    
00028   return -2;
00029 }

void ClusterShape::getExtra ( const PixelGeomDetUnit pixelDet,
const SiPixelRecHit recHit,
ClusterData data 
)

Definition at line 200 of file ClusterShape.cc.

References determineShape(), getOrientation(), int, ClusterData::isUnlocked, odir, ClusterData::size, x, and y.

Referenced by TripletFilter::isCompatible(), ClusterShapeTrackFilter::isCompatible(), and ClusterShapeTrajectoryFilter::processHit().

00202 {
00203   data.isUnlocked = true;
00204 
00205   getOrientation(pixelDet,        data);
00206   determineShape(pixelDet,recHit, data);
00207 
00208   int dx = x[1] - x[0];
00209   int dy = y[1] - y[0];
00210   if(odir != 0) dy *= odir;
00211 
00212   data.size.first  = (unsigned short int)dx;
00213   data.size.second = (short int)dy;
00214 }

void ClusterShape::getOrientation ( const PixelGeomDetUnit pixelDet,
ClusterData data 
) [private]

Definition at line 178 of file ClusterShape.cc.

References ClusterData::isInBarrel, ClusterData::isNormalOriented, PV3DBase< T, PVType, FrameType >::perp(), GeomDetEnumerators::PixelBarrel, rot, GeomDetType::subDetector(), GeomDet::toGlobal(), PixelGeomDetUnit::type(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by getExtra().

00179 {
00180   if(pixelDet.type().subDetector() == GeomDetEnumerators::PixelBarrel)
00181   {
00182     data.isInBarrel = true;
00183 
00184     float perp0 = pixelDet.toGlobal( Local3DPoint(0.,0.,0.) ).perp();
00185     float perp1 = pixelDet.toGlobal( Local3DPoint(0.,0.,1.) ).perp();
00186     data.isNormalOriented = (perp1 > perp0);
00187   }
00188   else
00189   {
00190     data.isInBarrel = false;
00191 
00192     float rot = pixelDet.toGlobal( LocalVector (0.,0.,1.) ).z();
00193     float pos = pixelDet.toGlobal( Local3DPoint(0.,0.,0.) ).z();
00194     data.isNormalOriented = (rot * pos > 0);
00195   }
00196 }

bool ClusterShape::processColumn ( std::pair< int, int pos,
bool  inTheLoop 
) [private]

Referenced by determineShape().


Member Data Documentation

int ClusterShape::hig [private]

Definition at line 34 of file ClusterShape.h.

Referenced by determineShape().

int ClusterShape::low [private]

Definition at line 34 of file ClusterShape.h.

int ClusterShape::odir [private]

Definition at line 34 of file ClusterShape.h.

Referenced by determineShape(), and getExtra().

int ClusterShape::ohig [private]

Definition at line 34 of file ClusterShape.h.

Referenced by determineShape().

int ClusterShape::olow [private]

Definition at line 34 of file ClusterShape.h.

Referenced by determineShape().

int ClusterShape::x[2] [private]

Definition at line 34 of file ClusterShape.h.

Referenced by determineShape(), and getExtra().

int ClusterShape::y[2] [private]

Definition at line 34 of file ClusterShape.h.

Referenced by determineShape(), and getExtra().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:16:22 2009 for CMSSW by  doxygen 1.5.4