CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PixelBlade Class Reference

#include <PixelBlade.h>

Inheritance diagram for PixelBlade:
GeometricSearchDetWithGroups GeometricSearchDet

List of all members.

Public Member Functions

virtual const std::vector
< const GeomDet * > & 
basicComponents () const
std::pair< bool,
TrajectoryStateOnSurface
compatible (const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const
virtual const std::vector
< const GeometricSearchDet * > & 
components () const
 Returns basic components, if any.
virtual void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
 PixelBlade (std::vector< const GeomDet * > &frontDets, std::vector< const GeomDet * > &backDets)
virtual const BoundDiskSectorspecificSurface () const
virtual const BoundSurfacesurface () const
 The surface of the GeometricSearchDet.
 ~PixelBlade ()

Private Member Functions

bool addClosest (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const
SubLayerCrossings computeCrossings (const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const
float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
int findBin (float R, int layer) const
GlobalPoint findPosition (int index, int diskSectorIndex) const
bool overlap (const GlobalPoint &gpos, const GeomDet &det, float phiWin) const
void searchNeighbors (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const
const std::vector< const
GeomDet * > & 
subBlade (int ind) const

Private Attributes

std::vector< const GeomDet * > theBackDets
ReferenceCountingPointer
< BoundDiskSector
theBackDiskSector
std::vector< const GeomDet * > theDets
ReferenceCountingPointer
< BoundDiskSector
theDiskSector
std::vector< const GeomDet * > theFrontDets
ReferenceCountingPointer
< BoundDiskSector
theFrontDiskSector

Detailed Description

A concrete implementation for PixelBlade

Definition at line 15 of file PixelBlade.h.


Constructor & Destructor Documentation

PixelBlade::PixelBlade ( std::vector< const GeomDet * > &  frontDets,
std::vector< const GeomDet * > &  backDets 
)

Definition at line 20 of file PixelBlade.cc.

References LogDebug, PV3DBase< T, PVType, FrameType >::perp(), GeometricSearchDet::position(), theBackDets, theBackDiskSector, theDets, theDiskSector, theFrontDets, theFrontDiskSector, and PV3DBase< T, PVType, FrameType >::z().

                                                        :                      
  theFrontDets(frontDets), theBackDets(backDets) 
{
  theDets.assign(theFrontDets.begin(),theFrontDets.end());
  theDets.insert(theDets.end(),theBackDets.begin(),theBackDets.end());

  theDiskSector      = BladeShapeBuilderFromDet()(theDets);  
  theFrontDiskSector = BladeShapeBuilderFromDet()(theFrontDets);
  theBackDiskSector  = BladeShapeBuilderFromDet()(theBackDets);   


  //--------- DEBUG INFO --------------
  LogDebug("TkDetLayers") << "DEBUG INFO for PixelBlade" ;
  LogDebug("TkDetLayers") << "Blade z, perp, innerRadius, outerR: " 
                          << this->position().z() << " , "
                          << this->position().perp() << " , "
                          << theDiskSector->innerRadius() << " , "
                          << theDiskSector->outerRadius() ;

  for(vector<const GeomDet*>::const_iterator it=theFrontDets.begin(); 
      it!=theFrontDets.end(); it++){
    LogDebug("TkDetLayers") << "frontDet phi,z,r: " 
                            << (*it)->position().phi() << " , "
                            << (*it)->position().z()   << " , "
                            << (*it)->position().perp() ;;
  }

  for(vector<const GeomDet*>::const_iterator it=theBackDets.begin(); 
      it!=theBackDets.end(); it++){
    LogDebug("TkDetLayers") << "backDet phi,z,r: " 
                            << (*it)->position().phi() << " , "
                            << (*it)->position().z()   << " , "
                            << (*it)->position().perp() ;
  }
  //-----------------------------------

}
PixelBlade::~PixelBlade ( )

Definition at line 18 of file PixelBlade.cc.

{}

Member Function Documentation

bool PixelBlade::addClosest ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
const SubLayerCrossing crossing,
std::vector< DetGroup > &  result 
) const [private]

Referenced by groupedCompatibleDetsV().

virtual const std::vector<const GeomDet*>& PixelBlade::basicComponents ( ) const [inline, virtual]

Implements GeometricSearchDet.

Definition at line 26 of file PixelBlade.h.

References theDets.

{return theDets;}
pair< bool, TrajectoryStateOnSurface > PixelBlade::compatible ( const TrajectoryStateOnSurface ts,
const Propagator ,
const MeasurementEstimator  
) const [virtual]

tests the geometrical compatibility of the Det with the predicted state. The FreeTrajectoryState argument is propagated to the Det surface using the Propagator argument. The resulting TrajectoryStateOnSurface is tested for compatibility with the surface bounds. If compatible, a std::pair< true, propagatedState> is returned. If the propagation fails, or if the state is not compatible, a std::pair< false, propagatedState> is returned.

Implements GeometricSearchDet.

Definition at line 66 of file PixelBlade.cc.

                                                          {
  edm::LogError("TkDetLayers") << "temporary dummy implementation of PixelBlade::compatible()!!" ;
  return pair<bool,TrajectoryStateOnSurface>();
}
const vector< const GeometricSearchDet * > & PixelBlade::components ( ) const [virtual]

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 61 of file PixelBlade.cc.

                            {
  throw DetLayerException("TOBRod doesn't have GeometricSearchDet components"); 
}
SubLayerCrossings PixelBlade::computeCrossings ( const TrajectoryStateOnSurface tsos,
PropagationDirection  propDir 
) const [private]

Definition at line 115 of file PixelBlade.cc.

References findBin(), findPosition(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), perp(), rho, theBackDiskSector, theFrontDiskSector, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

{
  HelixPlaneCrossing::PositionType startPos( startingState.globalPosition());
  HelixPlaneCrossing::DirectionType startDir( startingState.globalMomentum());
  double rho( startingState.transverseCurvature());

  HelixArbitraryPlaneCrossing crossing( startPos, startDir, rho, propDir);

  pair<bool,double> innerPath = crossing.pathLength( *theFrontDiskSector);
  if (!innerPath.first) return SubLayerCrossings();

  GlobalPoint gInnerPoint( crossing.position(innerPath.second));
  //Code for use of binfinder
  //int innerIndex = theInnerBinFinder.binIndex(gInnerPoint.perp());  
  //float innerDist = fabs( theInnerBinFinder.binPosition(innerIndex) - gInnerPoint.z());
  int innerIndex = findBin(gInnerPoint.perp(),0);
  float innerDist = fabs( findPosition(innerIndex,0).perp() - gInnerPoint.perp());
  SubLayerCrossing innerSLC( 0, innerIndex, gInnerPoint);

  pair<bool,double> outerPath = crossing.pathLength( *theBackDiskSector);
  if (!outerPath.first) return SubLayerCrossings();

  GlobalPoint gOuterPoint( crossing.position(outerPath.second));
  //Code for use of binfinder
  //int outerIndex = theOuterBinFinder.binIndex(gOuterPoint.perp());
  //float outerDist = fabs( theOuterBinFinder.binPosition(outerIndex) - gOuterPoint.perp());
  int outerIndex  = findBin(gOuterPoint.perp(),1);
  float outerDist = fabs( findPosition(outerIndex,1).perp() - gOuterPoint.perp());
  SubLayerCrossing outerSLC( 1, outerIndex, gOuterPoint);

  if (innerDist < outerDist) {
    return SubLayerCrossings( innerSLC, outerSLC, 0);
  }
  else {
    return SubLayerCrossings( outerSLC, innerSLC, 1);
  } 
}
float PixelBlade::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const [private]

Definition at line 171 of file PixelBlade.cc.

References MeasurementEstimator::maximalLocalDisplacement(), GeomDet::surface(), and x.

Referenced by groupedCompatibleDetsV().

{
  return
    est.maximalLocalDisplacement(tsos, det->surface()).x();
}
int PixelBlade::findBin ( float  R,
int  layer 
) const [private]

Definition at line 247 of file PixelBlade.cc.

References i, theBackDets, and theFrontDets.

Referenced by computeCrossings().

{
  vector<const GeomDet*> localDets = diskSectorIndex==0 ? theFrontDets : theBackDets;
  
  int theBin = 0;
  float rDiff = fabs( R - localDets.front()->surface().position().perp());;
  for (vector<const GeomDet*>::const_iterator i=localDets.begin(); i !=localDets.end(); i++){
    float testDiff = fabs( R - (**i).surface().position().perp());
    if ( testDiff < rDiff) {
      rDiff = testDiff;
      theBin = i - localDets.begin();
    }
  }
  return theBin;
}
GlobalPoint PixelBlade::findPosition ( int  index,
int  diskSectorIndex 
) const [private]

Definition at line 266 of file PixelBlade.cc.

References theBackDets, and theFrontDets.

Referenced by computeCrossings().

{
  vector<const GeomDet*> diskSector = diskSectorType == 0 ? theFrontDets : theBackDets; 
  return (diskSector[index])->surface().position();
}
void PixelBlade::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const [virtual]

Reimplemented from GeometricSearchDet.

Definition at line 75 of file PixelBlade.cc.

References addClosest(), SubLayerCrossings::closest(), SubLayerCrossings::closestIndex(), computeCrossings(), computeWindowSize(), LayerCrossingSide::endcapSide(), SubLayerCrossings::isValid(), DetGroupMerger::orderAndMergeTwoLevels(), SubLayerCrossings::other(), Propagator::propagationDirection(), searchNeighbors(), and svgfig::window().

                                                                              {
 SubLayerCrossings  crossings; 
  crossings = computeCrossings( tsos, prop.propagationDirection());
  if(! crossings.isValid()) return;

  vector<DetGroup> closestResult;
  addClosest( tsos, prop, est, crossings.closest(), closestResult);

  if (closestResult.empty()){
    vector<DetGroup> nextResult;
    addClosest( tsos, prop, est, crossings.other(), nextResult);
    if(nextResult.empty())    return;
    
    DetGroupElement nextGel( nextResult.front().front());  
    int crossingSide = LayerCrossingSide().endcapSide( nextGel.trajectoryState(), prop);

    DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result,
                                            crossings.closestIndex(), crossingSide);   
  }
  else {
    DetGroupElement closestGel( closestResult.front().front());
    float window = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
    
    searchNeighbors( tsos, prop, est, crossings.closest(), window,
                     closestResult, false);
    
    vector<DetGroup> nextResult;
    searchNeighbors( tsos, prop, est, crossings.other(), window,
                     nextResult, true);
    
    int crossingSide = LayerCrossingSide().endcapSide( closestGel.trajectoryState(), prop);
    DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result,
                                            crossings.closestIndex(), crossingSide);
  }
}
bool PixelBlade::overlap ( const GlobalPoint gpos,
const GeomDet det,
float  phiWin 
) const [private]

Definition at line 220 of file PixelBlade.cc.

References BoundSurface::bounds(), Bounds::length(), GeomDet::surface(), GloballyPositioned< T >::toLocal(), and PV3DBase< T, PVType, FrameType >::x().

{
  // check if the z window around TSOS overlaps with the detector theDet (with a 1% margin added)
  
  //   const float tolerance = 0.1;
  const float relativeMargin = 1.01;

  LocalPoint localCrossPoint( det.surface().toLocal(crossPoint));
  //   if (fabs(localCrossPoint.z()) > tolerance) {
  //     edm::LogInfo(TkDetLayers) << "PixelBlade::overlap calculation assumes point on surface, but it is off by "
  //     << localCrossPoint.z() ;
  //   }

  float localX = localCrossPoint.x();
  float detHalfLength = det.surface().bounds().length()/2.;

  //   edm::LogInfo(TkDetLayers) << "PixelBlade::overlap: Det at " << det.position() << " hit at " << localY 
  //        << " Window " << window << " halflength "  << detHalfLength ;
  
  if ( ( fabs(localX)-window) < relativeMargin*detHalfLength ) { // FIXME: margin hard-wired!
    return true;
  } else {
    return false;
  }
}
void PixelBlade::searchNeighbors ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
const SubLayerCrossing crossing,
float  window,
std::vector< DetGroup > &  result,
bool  checkClosest 
) const [private]

Referenced by groupedCompatibleDetsV().

virtual const BoundDiskSector& PixelBlade::specificSurface ( ) const [inline, virtual]

Definition at line 41 of file PixelBlade.h.

References theDiskSector.

{return *theDiskSector;}
const std::vector<const GeomDet*>& PixelBlade::subBlade ( int  ind) const [inline, private]

Definition at line 77 of file PixelBlade.h.

References theBackDets, and theFrontDets.

                                                            {
    return (ind==0 ? theFrontDets : theBackDets);
  }
virtual const BoundSurface& PixelBlade::surface ( ) const [inline, virtual]

The surface of the GeometricSearchDet.

Implements GeometricSearchDet.

Definition at line 24 of file PixelBlade.h.

References theDiskSector.

{return *theDiskSector;}

Member Data Documentation

std::vector<const GeomDet*> PixelBlade::theBackDets [private]

Definition at line 86 of file PixelBlade.h.

Referenced by findBin(), findPosition(), PixelBlade(), and subBlade().

Definition at line 90 of file PixelBlade.h.

Referenced by computeCrossings(), and PixelBlade().

std::vector<const GeomDet*> PixelBlade::theDets [private]

Definition at line 84 of file PixelBlade.h.

Referenced by basicComponents(), and PixelBlade().

Definition at line 88 of file PixelBlade.h.

Referenced by PixelBlade(), specificSurface(), and surface().

std::vector<const GeomDet*> PixelBlade::theFrontDets [private]

Definition at line 85 of file PixelBlade.h.

Referenced by findBin(), findPosition(), PixelBlade(), and subBlade().

Definition at line 89 of file PixelBlade.h.

Referenced by computeCrossings(), and PixelBlade().