CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CompositeTECWedge Class Reference

#include <CompositeTECWedge.h>

Inheritance diagram for CompositeTECWedge:
TECWedge GeometricSearchDetWithGroups GeometricSearchDet

List of all members.

Public Member Functions

virtual const std::vector
< const GeomDet * > & 
basicComponents () const
virtual 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.
 CompositeTECWedge (std::vector< const GeomDet * > &innerDets, std::vector< const GeomDet * > &outerDets)
virtual void groupedCompatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
 ~CompositeTECWedge ()

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
int findClosestDet (const GlobalPoint &startPos, int sectorId) 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 * > & 
subWedge (int ind) const

Private Attributes

std::vector< const GeomDet * > theBackDets
ReferenceCountingPointer
< BoundDiskSector
theBackSector
std::vector< const GeomDet * > theDets
std::vector< const GeomDet * > theFrontDets
ReferenceCountingPointer
< BoundDiskSector
theFrontSector

Detailed Description

A concrete implementation for TEC layer built out of TECPetals

Definition at line 14 of file CompositeTECWedge.h.


Constructor & Destructor Documentation

CompositeTECWedge::CompositeTECWedge ( std::vector< const GeomDet * > &  innerDets,
std::vector< const GeomDet * > &  outerDets 
)

Definition at line 34 of file CompositeTECWedge.cc.

References LogDebug, PV3DBase< T, PVType, FrameType >::perp(), GeometricSearchDet::position(), python::multivaluedict::sort(), theBackDets, theBackSector, theDets, TECWedge::theDiskSector, theFrontDets, theFrontSector, and PV3DBase< T, PVType, FrameType >::z().

                                                                       :
  theFrontDets(innerDets.begin(),innerDets.end()), theBackDets(outerDets.begin(),outerDets.end())
{  
  theDets.assign(theFrontDets.begin(),theFrontDets.end());
  theDets.insert(theDets.end(),theBackDets.begin(),theBackDets.end());


  // 
  std::sort( theFrontDets.begin(), theFrontDets.end(), DetPhiLess() );
  std::sort( theBackDets.begin(),  theBackDets.end(),  DetPhiLess() );
  
  theFrontSector = ForwardDiskSectorBuilderFromDet()( theFrontDets );
  theBackSector  = ForwardDiskSectorBuilderFromDet()( theBackDets );
  theDiskSector = ForwardDiskSectorBuilderFromDet()( theDets );

  //--------- DEBUG INFO --------------
  LogDebug("TkDetLayers") << "DEBUG INFO for CompositeTECWedge" << "\n"
                          << "TECWedge 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)->surface().position().phi() << " , "
                            << (*it)->surface().position().z() <<   " , "
                            << (*it)->surface().position().perp();
  }

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


}
CompositeTECWedge::~CompositeTECWedge ( )

Definition at line 79 of file CompositeTECWedge.cc.

                                     {

} 

Member Function Documentation

bool CompositeTECWedge::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*>& CompositeTECWedge::basicComponents ( ) const [inline, virtual]

Implements GeometricSearchDet.

Definition at line 22 of file CompositeTECWedge.h.

References theDets.

{return theDets;}
pair< bool, TrajectoryStateOnSurface > CompositeTECWedge::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 91 of file CompositeTECWedge.cc.

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 85 of file CompositeTECWedge.cc.

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

Definition at line 137 of file CompositeTECWedge.cc.

References abs, Geom::deltaPhi(), findClosestDet(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), LogDebug, GloballyPositioned< T >::phi(), rho, TECWedge::surface(), theBackDets, theBackSector, theFrontDets, theFrontSector, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

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

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

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

  GlobalPoint gFrontPoint( crossing.position(frontPath.second));
  LogDebug("TkDetLayers") << "in TECWedge,front crossing r,z,phi: (" 
       << gFrontPoint.perp() << ","
       << gFrontPoint.z() << "," 
       << gFrontPoint.phi() << ")" ;


  int frontIndex = findClosestDet(gFrontPoint,0); 
  SubLayerCrossing frontSLC( 0, frontIndex, gFrontPoint);

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

  GlobalPoint gBackPoint( crossing.position(backPath.second));
  LogDebug("TkDetLayers") 
    << "in TECWedge,back crossing r,z,phi: (" 
    << gBackPoint.perp() << ","
    << gBackPoint.z() << "," 
    << gBackPoint.phi() << ")" << endl;
  
  int backIndex = findClosestDet(gBackPoint,1);
  SubLayerCrossing backSLC( 1, backIndex, gBackPoint);

  float frontDist = std::abs(Geom::deltaPhi( double(gFrontPoint.barePhi()), 
                                             double(theFrontDets[frontIndex]->surface().phi())));
  /*
  float frontDist = theFrontDets[frontIndex]->surface().phi()  - gFrontPoint.phi(); 
  frontDist *= Geom::phiLess( theFrontDets[frontIndex]->surface().phi(),gFrontPoint.barePhi()) ? -1. : 1.; 
  if (frontDist < 0.) { frontDist += 2.*Geom::pi();}
  */
  float backDist = std::abs(Geom::deltaPhi( double(gBackPoint.barePhi()), 
                                            double(theBackDets[backIndex]->surface().phi())));
  /*
  float backDist = theBackDets[backIndex]->surface().phi()  - gBackPoint.phi(); 
  backDist  *= Geom::phiLess( theBackDets[backIndex]->surface().phi(),gBackPoint.barePhi()) ? -1. : 1.;
  if ( backDist < 0.) { backDist  += 2.*Geom::pi();}
  */
  
  if (frontDist < backDist) {
    return SubLayerCrossings( frontSLC, backSLC, 0);
  }
  else {
    return SubLayerCrossings( backSLC, frontSLC, 1);
  } 
}
int CompositeTECWedge::findClosestDet ( const GlobalPoint startPos,
int  sectorId 
) const [private]

Definition at line 256 of file CompositeTECWedge.cc.

References i, theBackDets, theFrontDets, and x.

Referenced by computeCrossings().

{
  vector<const GeomDet*> myDets = sectorId==0 ? theFrontDets : theBackDets;

  int close = 0;
  float closeDist = fabs( (myDets.front()->toLocal(startPos)).x());
  for (unsigned int i = 0; i < myDets.size(); i++ ) {
    float dist = (myDets[i]->surface().toLocal(startPos)).x();
    if ( fabs(dist) < fabs(closeDist) ) {
      close = i;
      closeDist = dist;
    }
  }
  return close;
}
void CompositeTECWedge::groupedCompatibleDetsV ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const [virtual]

Reimplemented from GeometricSearchDet.

Definition at line 99 of file CompositeTECWedge.cc.

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

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

  std::vector<DetGroup> closestResult;
  addClosest( tsos, prop, est, crossings.closest(), closestResult);
  LogDebug("TkDetLayers") 
    << "in CompositeTECWedge::groupedCompatibleDets,closestResult.size(): "
    << closestResult.size() ;

  if (closestResult.empty()) return;
  
  DetGroupElement closestGel( closestResult.front().front());
  float window = tkDetUtil::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);
}
void CompositeTECWedge::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().

const std::vector<const GeomDet*>& CompositeTECWedge::subWedge ( int  ind) const [inline, private]

Definition at line 57 of file CompositeTECWedge.h.

References theBackDets, and theFrontDets.

                                                            {
    return (ind==0 ? theFrontDets : theBackDets);
  }

Member Data Documentation

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

Definition at line 64 of file CompositeTECWedge.h.

Referenced by CompositeTECWedge(), computeCrossings(), findClosestDet(), and subWedge().

Definition at line 68 of file CompositeTECWedge.h.

Referenced by CompositeTECWedge(), and computeCrossings().

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

Definition at line 65 of file CompositeTECWedge.h.

Referenced by basicComponents(), and CompositeTECWedge().

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

Definition at line 63 of file CompositeTECWedge.h.

Referenced by CompositeTECWedge(), computeCrossings(), findClosestDet(), and subWedge().

Definition at line 67 of file CompositeTECWedge.h.

Referenced by CompositeTECWedge(), and computeCrossings().