CMS 3D CMS Logo

Public Member Functions | Private Attributes

WindowFinder Class Reference

#include <WindowFinder.h>

List of all members.

Public Member Functions

void dumphit (const StackedTrackerDetId &anId, unsigned int hitIdentifier, const double &aInnerRow, const double &aInnerColumn)
 Dump hit.
StackedTrackerWindow getWindow (const StackedTrackerDetId &anId, const double &aInnerRow, const double &aInnerColumn)
 Get window.
 WindowFinder (const StackedTrackerGeometry *aGeometry, double aPtScalingFactor, double aIPwidth, double aRowResolution, double aColResolution)
 Constructor.
virtual ~WindowFinder ()
 Destructor.

Private Attributes

double mColResolution
const StackedTrackerGeometrymGeometry
double mHalfPixelLength
PixelGeomDetUnitmInnerDet
double mInnerDetPhi
double mInnerDetRadius
double mIPwidth
StackedTrackerDetId mLastId
 As all hits in the same stack are tested sequentially, cache the sensor parameters for speed!
double mlastInnerCol
double mlastInnerRow
double mMaxcol
double mMaxrow
double mMincol
double mMinrow
 These are the variables which need to be filled!
PixelGeomDetUnitmOuterDet
double mPtScalingFactor
double mRowResolution
double mSeparation

Detailed Description

Definition at line 31 of file WindowFinder.h.


Constructor & Destructor Documentation

WindowFinder::WindowFinder ( const StackedTrackerGeometry aGeometry,
double  aPtScalingFactor,
double  aIPwidth,
double  aRowResolution,
double  aColResolution 
) [explicit]

Constructor.

//////////////////////////////////////// Stacked Tracker Simulations /// Written by: /// Andrew W. Rose /// 2008 /// / ////////////////////////////////////// ***************************** IMPLEMENTATION OF METHODS *****************************

Definition at line 19 of file WindowFinder.cc.

  : mGeometry( aGeometry ),
    mPtScalingFactor( aPtScalingFactor ),
    mIPwidth( aIPwidth ),
    mRowResolution( aRowResolution ),
    mColResolution( aColResolution ),
    mMinrow(0), mMaxrow(0), mMincol(0), mMaxcol(0),
    mLastId(0), mlastInnerRow(-1), mlastInnerCol(-1){}
WindowFinder::~WindowFinder ( ) [virtual]

Destructor.

Definition at line 33 of file WindowFinder.cc.

{}

Member Function Documentation

void WindowFinder::dumphit ( const StackedTrackerDetId anId,
unsigned int  hitIdentifier,
const double &  aInnerRow,
const double &  aInnerColumn 
)

Dump hit.

Find the centre of the Pixel

Definition at line 36 of file WindowFinder.cc.

References gather_cfg::cout, PV3DBase< T, PVType, FrameType >::eta(), Topology::localPosition(), mColResolution, mGeometry, mRowResolution, GeomDet::surface(), Surface::toGlobal(), and PixelGeomDetUnit::topology().

{
  const PixelGeomDetUnit* detunit = reinterpret_cast< const PixelGeomDetUnit* > (mGeometry -> idToDetUnit( anId, hitIdentifier ));

  MeasurementPoint mp( aInnerRow + (0.5*mRowResolution), aInnerColumn + (0.5*mColResolution) );
  LocalPoint LP  = detunit->topology().localPosition( mp );
  GlobalPoint GP = detunit->surface().toGlobal( LP );
  std::cout << (hitIdentifier?"INNER":"OUTER") << " -> eta = " << GP.eta() << std::endl;
}
StackedTrackerWindow WindowFinder::getWindow ( const StackedTrackerDetId anId,
const double &  aInnerRow,
const double &  aInnerColumn 
)

Get window.

Particular cases

Find the bounds of the inner "pixel" in pixel units Remember to use the centre of the "pixel"

Find the bounds of the inner "pixel" in cm

Find the positions of the inner "pixels" corners in global coordinates

Calculate the maximum allowed track angle to the tangent at the "pixels" bounds

Calculate the angle of the sensor to the tangent at the bounds

Calculate the deviation in the r-phi direction

Inner pixel z-bounds

IP z-bounds

Stack radial separation through inner hit

Calculate the deviation in the z direction

Make boundary points in the inner reference frame

Migrate into the global frame

Migrate into the local frame of the outer det

Convert into pixel units

Calculate window coordinates

Return the window

Definition at line 51 of file WindowFinder.cc.

References funct::cos(), StackedTrackerGeometry::idToDetUnit(), Topology::localPosition(), Plane::localZ(), mColResolution, mGeometry, mHalfPixelLength, mInnerDet, mInnerDetPhi, mInnerDetRadius, MINUS, mIPwidth, mLastId, mlastInnerCol, mlastInnerRow, mMaxcol, mMaxrow, mMincol, mMinrow, mOuterDet, mPtScalingFactor, mRowResolution, mSeparation, PV3DBase< T, PVType, FrameType >::perp(), PHI, PV3DBase< T, PVType, FrameType >::phi(), PixelTopology::pitch(), GeomDet::position(), funct::sin(), PixelGeomDetUnit::specificTopology(), GeomDet::surface(), swap(), funct::tan(), Surface::toGlobal(), GloballyPositioned< T >::toLocal(), PixelGeomDetUnit::topology(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

{
  if ( (anId == mLastId) && (mlastInnerRow == aInnerRow) && (mlastInnerCol == aInnerColumn) )
  {
    StackedTrackerWindow thisWindow = StackedTrackerWindow( mMinrow, mMaxrow, mMincol, mMaxcol );
    return thisWindow;
  }

  mlastInnerRow = aInnerRow;
  mlastInnerCol = aInnerColumn;

  if (anId != mLastId)
  {
    mLastId = anId;
    mInnerDet = const_cast< PixelGeomDetUnit* >(reinterpret_cast< const PixelGeomDetUnit* > (mGeometry->idToDetUnit( anId, 0 )));
    mOuterDet = const_cast< PixelGeomDetUnit* >(reinterpret_cast< const PixelGeomDetUnit* > (mGeometry->idToDetUnit( anId, 1 )));

    mHalfPixelLength = mInnerDet->specificTopology().pitch().second * mColResolution * 0.5;
    mSeparation = mInnerDet->surface().localZ( mOuterDet->position() );
    if ( mSeparation < 0 )
      mSeparation = -mSeparation;

    mInnerDetRadius  = mInnerDet->position().perp();
    mInnerDetPhi     = mInnerDet->position().phi();
  }

  MeasurementPoint MP_INNER( aInnerRow + (0.5*mRowResolution), aInnerColumn + (0.5*mColResolution) );

  LocalPoint       LP_INNER = mInnerDet->topology().localPosition( MP_INNER );

  GlobalPoint      GP_INNER = mInnerDet->surface().toGlobal( LP_INNER );

  double           PHI = asin( mPtScalingFactor * GP_INNER.perp() );

  double           PixelAngle = acos( sin( mInnerDetPhi - GP_INNER.phi() ) * mInnerDetRadius / LP_INNER.x() );

  double           deltaXminus = ( mSeparation * tan( PixelAngle - PHI ));  
  double           deltaXplus  = ( mSeparation * tan( PixelAngle + PHI ));  

  double           PIXEL_Z_PLUS  = GP_INNER.z()+mHalfPixelLength;
  double           PIXEL_Z_MINUS = GP_INNER.z()-mHalfPixelLength;

  double           IP_Z_PLUS  =  mIPwidth;
  double           IP_Z_MINUS = -mIPwidth;

  double                R_SEPARATION =  mSeparation / cos( PixelAngle );
  if (R_SEPARATION < 0)
    R_SEPARATION = -R_SEPARATION;

  double           deltaZminus = (PIXEL_Z_MINUS-IP_Z_PLUS) * R_SEPARATION / GP_INNER.perp();  
  double           deltaZplus  = (PIXEL_Z_PLUS-IP_Z_MINUS) * R_SEPARATION / GP_INNER.perp();    

  LocalPoint LP_OUTER_PLUS( LP_INNER.x()-deltaXplus , LP_INNER.y()-mHalfPixelLength-deltaZplus , -mSeparation );
  LocalPoint LP_OUTER_MINUS( LP_INNER.x()-deltaXminus , LP_INNER.y()+mHalfPixelLength-deltaZminus , -mSeparation );

  GlobalPoint GP_OUTER_PLUS = mInnerDet ->surface().toGlobal(LP_OUTER_PLUS);
  GlobalPoint GP_OUTER_MINUS = mInnerDet ->surface().toGlobal(LP_OUTER_MINUS);

  LocalPoint LP_OUTER_PLUS_2 = mOuterDet ->surface().toLocal(GP_OUTER_PLUS);
  LocalPoint LP_OUTER_MINUS_2 = mOuterDet ->surface().toLocal(GP_OUTER_MINUS);

  std::pair<float,float> PLUS = mOuterDet -> specificTopology().pixel(LP_OUTER_PLUS_2);
  std::pair<float,float> MINUS = mOuterDet -> specificTopology().pixel(LP_OUTER_MINUS_2);

  mMinrow = mRowResolution * floor( PLUS.first / mRowResolution ); 
  mMincol = mColResolution * floor( PLUS.second / mColResolution );
  mMaxrow = mRowResolution * floor( MINUS.first / mRowResolution );
  mMaxcol = mColResolution * floor( MINUS.second / mColResolution ); 

  if (mMinrow>mMaxrow)
    std::swap(mMinrow,mMaxrow);
  if (mMincol>mMaxcol)
    std::swap(mMincol,mMaxcol);

  StackedTrackerWindow theWindow = StackedTrackerWindow( mMinrow, mMaxrow, mMincol, mMaxcol );
  return theWindow;
}

Member Data Documentation

double WindowFinder::mColResolution [private]

Definition at line 54 of file WindowFinder.h.

Referenced by dumphit(), and getWindow().

Definition at line 50 of file WindowFinder.h.

Referenced by dumphit(), and getWindow().

Definition at line 61 of file WindowFinder.h.

Referenced by getWindow().

Definition at line 59 of file WindowFinder.h.

Referenced by getWindow().

double WindowFinder::mInnerDetPhi [private]

Definition at line 62 of file WindowFinder.h.

Referenced by getWindow().

Definition at line 62 of file WindowFinder.h.

Referenced by getWindow().

double WindowFinder::mIPwidth [private]

Definition at line 52 of file WindowFinder.h.

Referenced by getWindow().

As all hits in the same stack are tested sequentially, cache the sensor parameters for speed!

Definition at line 58 of file WindowFinder.h.

Referenced by getWindow().

double WindowFinder::mlastInnerCol [private]

Definition at line 63 of file WindowFinder.h.

Referenced by getWindow().

double WindowFinder::mlastInnerRow [private]

Definition at line 63 of file WindowFinder.h.

Referenced by getWindow().

double WindowFinder::mMaxcol [private]

Definition at line 56 of file WindowFinder.h.

Referenced by getWindow().

double WindowFinder::mMaxrow [private]

Definition at line 56 of file WindowFinder.h.

Referenced by getWindow().

double WindowFinder::mMincol [private]

Definition at line 56 of file WindowFinder.h.

Referenced by getWindow().

double WindowFinder::mMinrow [private]

These are the variables which need to be filled!

Definition at line 56 of file WindowFinder.h.

Referenced by getWindow().

Definition at line 59 of file WindowFinder.h.

Referenced by getWindow().

Definition at line 51 of file WindowFinder.h.

Referenced by getWindow().

double WindowFinder::mRowResolution [private]

Definition at line 53 of file WindowFinder.h.

Referenced by dumphit(), and getWindow().

double WindowFinder::mSeparation [private]

Definition at line 60 of file WindowFinder.h.

Referenced by getWindow().