CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes

PixelForwardLayer Class Reference

#include <PixelForwardLayer.h>

Inheritance diagram for PixelForwardLayer:
ForwardDetLayer GeometricSearchDetWithGroups DetLayer GeometricSearchDet GeometricSearchDet

List of all members.

Classes

struct  SubTurbineCrossings

Public Member Functions

virtual const std::vector
< const GeomDet * > & 
basicComponents () const
virtual const std::vector
< const GeometricSearchDet * > & 
components () const
 Returns basic components, if any.
void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
 PixelForwardLayer (std::vector< const PixelBlade * > &blades)
virtual SubDetector subDetector () const
 The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
 ~PixelForwardLayer ()

Private Types

typedef PeriodicBinFinderInPhi
< double > 
BinFinderType

Private Member Functions

SubTurbineCrossings computeCrossings (const TrajectoryStateOnSurface &startingState, PropagationDirection propDir) const
int computeHelicity (const GeometricSearchDet *firstBlade, const GeometricSearchDet *secondBlade) const
float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
void searchNeighbors (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubTurbineCrossings &crossings, float window, std::vector< DetGroup > &result) const

Private Attributes

std::vector< const GeomDet * > theBasicComps
BinFinderType theBinFinder
std::vector< const
GeometricSearchDet * > 
theComps

Detailed Description

A concrete implementation for PixelForward layer built out of ForwardPixelBlade

Definition at line 14 of file PixelForwardLayer.h.


Member Typedef Documentation

Definition at line 65 of file PixelForwardLayer.h.


Constructor & Destructor Documentation

PixelForwardLayer::PixelForwardLayer ( std::vector< const PixelBlade * > &  blades)

Definition at line 23 of file PixelForwardLayer.cc.

References ForwardDetLayer::computeSurface(), BoundDisk::innerRadius(), LogDebug, BoundDisk::outerRadius(), PV3DBase< T, PVType, FrameType >::phi(), GloballyPositioned< T >::position(), ForwardDetLayer::setSurface(), ForwardDetLayer::specificSurface(), ForwardDetLayer::surface(), theBasicComps, theBinFinder, theComps, and PV3DBase< T, PVType, FrameType >::z().

                                                                     :
  theComps(blades.begin(),blades.end())
{
  for(vector<const GeometricSearchDet*>::const_iterator it=theComps.begin();
      it!=theComps.end();it++){  
    theBasicComps.insert(theBasicComps.end(),   
                         (**it).basicComponents().begin(),
                         (**it).basicComponents().end());
  }

  //They should be already phi-ordered. TO BE CHECKED!!
  //sort( theBlades.begin(), theBlades.end(), PhiLess());
  setSurface( computeSurface() );
  
  //Is a "periodic" binFinderInPhi enough?. TO BE CHECKED!!
  theBinFinder = BinFinderType( theComps.front()->surface().position().phi(),
                                theComps.size());

  //--------- DEBUG INFO --------------
  LogDebug("TkDetLayers") << "DEBUG INFO for PixelForwardLayer" << "\n"
                          << "PixelForwardLayer.surfcace.phi(): " 
                          << this->surface().position().phi() << "\n"
                          << "PixelForwardLayer.surfcace.z(): " 
                          << this->surface().position().z() << "\n"
                          << "PixelForwardLayer.surfcace.innerR(): " 
                          << this->specificSurface().innerRadius() << "\n"
                          << "PixelForwardLayer.surfcace.outerR(): " 
                          << this->specificSurface().outerRadius() ;

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

    
}
PixelForwardLayer::~PixelForwardLayer ( )

Definition at line 64 of file PixelForwardLayer.cc.

References i, and theComps.

                                     {
  vector<const GeometricSearchDet*>::const_iterator i;
  for (i=theComps.begin(); i!=theComps.end(); i++) {
    delete *i;
  }
} 

Member Function Documentation

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

Implements GeometricSearchDet.

Definition at line 21 of file PixelForwardLayer.h.

References theBasicComps.

{return theBasicComps;}
virtual const std::vector<const GeometricSearchDet*>& PixelForwardLayer::components ( ) const [inline, virtual]

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 23 of file PixelForwardLayer.h.

References theComps.

{return theComps;}
PixelForwardLayer::SubTurbineCrossings PixelForwardLayer::computeCrossings ( const TrajectoryStateOnSurface startingState,
PropagationDirection  propDir 
) const [private]

Definition at line 182 of file PixelForwardLayer.cc.

References PeriodicBinFinderInPhi< T >::binIndex(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), HelixArbitraryPlaneCrossing2Order::pathLength(), PV3DBase< T, PVType, FrameType >::phi(), HelixArbitraryPlaneCrossing2Order::position(), GloballyPositioned< T >::position(), rho, ForwardDetLayer::specificSurface(), ForwardDetLayer::surface(), theBinFinder, theComps, GloballyPositioned< T >::toLocal(), TrajectoryStateOnSurface::transverseCurvature(), and PV3DBase< T, PVType, FrameType >::x().

Referenced by groupedCompatibleDetsV().

{  
  typedef MeasurementEstimator::Local2DVector Local2DVector;

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

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

  pair<bool,double> thePath = turbineCrossing.pathLength( specificSurface() );
  
  if (!thePath.first) {
    //edm::LogInfo("TkDetLayers") << "ERROR in PixelForwardLayer: disk not crossed by track" ;
    return SubTurbineCrossings();
  }

  HelixPlaneCrossing::PositionType  turbinePoint( turbineCrossing.position(thePath.second));
  HelixPlaneCrossing::DirectionType turbineDir( turbineCrossing.direction(thePath.second));
  int closestIndex = theBinFinder.binIndex(turbinePoint.phi());

  const BoundPlane& closestPlane( static_cast<const BoundPlane&>( 
    theComps[closestIndex]->surface()));


  HelixArbitraryPlaneCrossing2Order theBladeCrossing(turbinePoint, turbineDir, rho);

  pair<bool,double> theClosestBladePath = theBladeCrossing.pathLength( closestPlane );
  LocalPoint closestPos = closestPlane.toLocal(GlobalPoint(theBladeCrossing.position(theClosestBladePath.second)) );
    
  float closestDist = closestPos.x(); // use fact that local X perp to global Y

  //int next = turbinePoint.phi() - closestPlane.position().phi() > 0 ? closest+1 : closest-1;
  int nextIndex = PhiLess()( closestPlane.position().phi(), turbinePoint.phi()) ? 
    closestIndex+1 : closestIndex-1;

  const BoundPlane& nextPlane( static_cast<const BoundPlane&>( 
    theComps[ theBinFinder.binIndex(nextIndex)]->surface()));

  pair<bool,double> theNextBladePath    = theBladeCrossing.pathLength( nextPlane );
  LocalPoint nextPos = nextPlane.toLocal(GlobalPoint(theBladeCrossing.position(theNextBladePath.second)) );

  float nextDist = nextPos.x();

  if (fabs(closestDist) < fabs(nextDist)) {
    return SubTurbineCrossings( closestIndex, nextIndex, nextDist);
  }
  else {
    return SubTurbineCrossings( nextIndex, closestIndex, closestDist);
  }
}
int PixelForwardLayer::computeHelicity ( const GeometricSearchDet firstBlade,
const GeometricSearchDet secondBlade 
) const [private]

Definition at line 175 of file PixelForwardLayer.cc.

References GeometricSearchDet::position(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by groupedCompatibleDetsV().

{  
  if( fabs(firstBlade->position().z()) < fabs(secondBlade->position().z()) ) return 0;
  return 1;
}
float PixelForwardLayer::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const [private]

Definition at line 237 of file PixelForwardLayer.cc.

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

Referenced by groupedCompatibleDetsV().

{
  return est.maximalLocalDisplacement(tsos, det->surface()).x();
}
void PixelForwardLayer::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const [virtual]

Reimplemented from GeometricSearchDet.

Definition at line 72 of file PixelForwardLayer.cc.

References Clusterizer1DCommons::add(), PeriodicBinFinderInPhi< T >::binIndex(), PixelForwardLayer::SubTurbineCrossings::closestIndex, computeCrossings(), computeHelicity(), computeWindowSize(), LayerCrossingSide::endcapSide(), PixelForwardLayer::SubTurbineCrossings::isValid, PixelForwardLayer::SubTurbineCrossings::nextIndex, DetGroupMerger::orderAndMergeTwoLevels(), Propagator::propagationDirection(), query::result, searchNeighbors(), theBinFinder, theComps, and svgfig::window().

                                                                               {
  vector<DetGroup> closestResult;
  SubTurbineCrossings  crossings; 

  crossings = computeCrossings( tsos, prop.propagationDirection());
  if (!crossings.isValid){
    //edm::LogInfo("TkDetLayers") << "computeCrossings returns invalid in PixelForwardLayer::groupedCompatibleDets:";
    return;
  }

  typedef CompatibleDetToGroupAdder Adder;
  Adder::add( *theComps[theBinFinder.binIndex(crossings.closestIndex)], 
             tsos, prop, est, closestResult);

  if(closestResult.empty()){
    Adder::add( *theComps[theBinFinder.binIndex(crossings.nextIndex)], 
               tsos, prop, est, result);
    return;
  }      

  DetGroupElement closestGel( closestResult.front().front());
  float window = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);

  //float detWidth = closestGel.det()->surface().bounds().width();
  //if (crossings.nextDistance < detWidth + window) {
  vector<DetGroup> nextResult;
  if (Adder::add( *theComps[theBinFinder.binIndex(crossings.nextIndex)], 
                  tsos, prop, est, nextResult)) {
    int crossingSide = LayerCrossingSide().endcapSide( tsos, prop);
    int theHelicity = computeHelicity(theComps[theBinFinder.binIndex(crossings.closestIndex)],
                                        theComps[theBinFinder.binIndex(crossings.nextIndex)] );
    DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result, 
                                            theHelicity, crossingSide);
  }
  else {
    result.swap(closestResult);
  }
  
  /*
  }
  else {
    result.swap(closestResult);
  }
  */

  // --- THIS lines may speed up the reconstruction. But it reduces slightly the efficiency.
  // only loop over neighbors (other than closest and next) if window is BIG  
  //if (window > 0.5*detWidth) {
  searchNeighbors( tsos, prop, est, crossings, window, result);
  //} 
}
void PixelForwardLayer::searchNeighbors ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
const SubTurbineCrossings crossings,
float  window,
std::vector< DetGroup > &  result 
) const [private]

Referenced by groupedCompatibleDetsV().

virtual SubDetector PixelForwardLayer::subDetector ( ) const [inline, virtual]

The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)

Implements DetLayer.

Definition at line 31 of file PixelForwardLayer.h.

References GeomDetEnumerators::PixelEndcap.


Member Data Documentation

std::vector<const GeomDet*> PixelForwardLayer::theBasicComps [private]

Definition at line 69 of file PixelForwardLayer.h.

Referenced by basicComponents(), and PixelForwardLayer().

Definition at line 66 of file PixelForwardLayer.h.

Referenced by computeCrossings(), groupedCompatibleDetsV(), and PixelForwardLayer().

std::vector<const GeometricSearchDet*> PixelForwardLayer::theComps [private]