CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

CompositeTECPetal Class Reference

#include <CompositeTECPetal.h>

Inheritance diagram for CompositeTECPetal:
TECPetal 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.
 CompositeTECPetal (std::vector< const TECWedge * > &innerWedges, std::vector< const TECWedge * > &outerWedges)
virtual void groupedCompatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
 ~CompositeTECPetal ()

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 findBin (float R, int layer) const
GlobalPoint findPosition (int index, int diskSectorIndex) 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
GeometricSearchDet * > & 
subLayer (int ind) const

Static Private Member Functions

static float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
static bool overlap (const GlobalPoint &gpos, const GeometricSearchDet &rod, float window)

Private Attributes

std::vector< float > theBackBoundaries
std::vector< const
GeometricSearchDet * > 
theBackComps
ReferenceCountingPointer
< BoundDiskSector
theBackSector
std::vector< const GeomDet * > theBasicComps
std::vector< const
GeometricSearchDet * > 
theComps
std::vector< float > theFrontBoundaries
std::vector< const
GeometricSearchDet * > 
theFrontComps
ReferenceCountingPointer
< BoundDiskSector
theFrontSector

Detailed Description

A concrete implementation for TEC petals

Definition at line 14 of file CompositeTECPetal.h.


Constructor & Destructor Documentation

CompositeTECPetal::CompositeTECPetal ( std::vector< const TECWedge * > &  innerWedges,
std::vector< const TECWedge * > &  outerWedges 
)

Definition at line 57 of file CompositeTECPetal.cc.

References details::fillBoundaries(), LogDebug, theBackBoundaries, theBackComps, theBackSector, theBasicComps, theComps, TECPetal::theDiskSector, theFrontBoundaries, theFrontComps, and theFrontSector.

                                                                           : 
  theFrontComps(innerWedges.begin(),innerWedges.end()), 
  theBackComps(outerWedges.begin(),outerWedges.end())
{
  theComps.assign(theFrontComps.begin(),theFrontComps.end());
  theComps.insert(theComps.end(),theBackComps.begin(),theBackComps.end());

  details::fillBoundaries( theFrontComps, theFrontBoundaries);
  details::fillBoundaries( theBackComps, theBackBoundaries);


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


  //the Wedge are already R ordered
  //sort( theWedges.begin(), theWedges.end(), DetLessR());
  //sort( theFrontWedges.begin(), theFrontWedges.end(), DetLessR() );
  //sort( theBackWedges.begin(), theBackWedges.end(), DetLessR() );
  vector<const TECWedge*> allWedges;
  allWedges.assign(innerWedges.begin(),innerWedges.end());
  allWedges.insert(allWedges.end(),outerWedges.begin(),outerWedges.end());

  theDiskSector  = ForwardDiskSectorBuilderFromWedges()( allWedges );
  theFrontSector = ForwardDiskSectorBuilderFromWedges()( innerWedges);
  theBackSector  = ForwardDiskSectorBuilderFromWedges()( outerWedges);

  //--------- DEBUG INFO --------------
  LogDebug("TkDetLayers") << "DEBUG INFO for CompositeTECPetal" ;

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

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


}
CompositeTECPetal::~CompositeTECPetal ( )

Definition at line 113 of file CompositeTECPetal.cc.

References i, and theComps.

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

Member Function Documentation

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

Implements GeometricSearchDet.

Definition at line 22 of file CompositeTECPetal.h.

References theBasicComps.

{return theBasicComps;}
pair< bool, TrajectoryStateOnSurface > CompositeTECPetal::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 122 of file CompositeTECPetal.cc.

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 24 of file CompositeTECPetal.h.

References theComps.

{return theComps;}
SubLayerCrossings CompositeTECPetal::computeCrossings ( const TrajectoryStateOnSurface tsos,
PropagationDirection  propDir 
) const [private]

Definition at line 172 of file CompositeTECPetal.cc.

References findBin(), findPosition(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), LogDebug, perp(), rho, theBackSector, theFrontSector, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

{
  double rho( startingState.transverseCurvature());
  
  HelixPlaneCrossing::PositionType startPos( startingState.globalPosition() );
  HelixPlaneCrossing::DirectionType startDir( startingState.globalMomentum() );
  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 TECPetal,front crossing : r,z,phi: (" 
    << gFrontPoint.perp() << ","
    << gFrontPoint.z() << "," 
    << gFrontPoint.phi() << ")";
  

  int frontIndex = findBin(gFrontPoint.perp(),0);
  float frontDist = fabs( findPosition(frontIndex,0).perp() - gFrontPoint.perp());
  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 TECPetal,back crossing r,z,phi: (" 
    << gBackPoint.perp() << ","
    << gBackPoint.z() << "," 
    << gBackPoint.phi() << ")" ;

  int backIndex = findBin(gBackPoint.perp(),1);
  float backDist = fabs( findPosition(backIndex,1).perp() - gBackPoint.perp());
  
  SubLayerCrossing backSLC( 1, backIndex, gBackPoint);
  
  
  // 0ss: frontDisk has index=0, backDisk has index=1
  if (frontDist < backDist) {
    return SubLayerCrossings( frontSLC, backSLC, 0);
  }
  else {
    return SubLayerCrossings( backSLC, frontSLC, 1);
  } 
}
float CompositeTECPetal::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) [static, private]
int CompositeTECPetal::findBin ( float  R,
int  layer 
) const [private]

Definition at line 330 of file CompositeTECPetal.cc.

References theBackBoundaries, and theFrontBoundaries.

Referenced by computeCrossings().

{
  return details::findBin(diskSectorType==0 ? theFrontBoundaries : theBackBoundaries,R);
}
GlobalPoint CompositeTECPetal::findPosition ( int  index,
int  diskSectorIndex 
) const [private]

Definition at line 338 of file CompositeTECPetal.cc.

References theBackComps, and theFrontComps.

Referenced by computeCrossings().

{
  vector<const GeometricSearchDet*> const & diskSector = diskSectorType == 0 ? theFrontComps : theBackComps; 
  return (diskSector[index])->position();
}
void CompositeTECPetal::groupedCompatibleDetsV ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const [virtual]

Reimplemented from GeometricSearchDet.

Definition at line 130 of file CompositeTECPetal.cc.

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

                                                             {

  vector<DetGroup> closestResult;
  SubLayerCrossings  crossings; 
  crossings = computeCrossings( tsos, prop.propagationDirection());
  if(! crossings.isValid()) return;

  addClosest( tsos, prop, est, crossings.closest(), closestResult); 
  LogDebug("TkDetLayers") << "in TECPetal, closestResult.size(): "<< closestResult.size();

  if (closestResult.empty()){
    vector<DetGroup> nextResult;
    addClosest( tsos, prop, est, crossings.other(), nextResult); 
    LogDebug("TkDetLayers") << "in TECPetal, nextResult.size(): "<< nextResult.size() ;
    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 CompositeTECPetal::overlap ( const GlobalPoint gpos,
const GeometricSearchDet rod,
float  window 
) [static, private]

Definition at line 296 of file CompositeTECPetal.cc.

References BoundDiskSector::bounds(), BoundDiskSector::innerRadius(), max(), BoundDiskSector::outerRadius(), PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::position(), GeometricSearchDet::surface(), DiskSectorBounds::thickness(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by TOBRod::searchNeighbors().

{
  // this method is just a duplication of overlapInR 
  // adapeted for groupedCompatibleDets() needs

  // assume "fixed theta window", i.e. margin in local y = r is changing linearly with z
  float tsRadius = gpos.perp();
  float thetamin = ( max((float)0.,tsRadius-ymax))/(fabs(gpos.z())+10.); // add 10 cm contingency 
  float thetamax = ( tsRadius + ymax)/(fabs(gpos.z())-10.);

  const BoundDiskSector& wedgeSector = static_cast<const BoundDiskSector&>( gsdet.surface());                   
  float wedgeMinZ = fabs( wedgeSector.position().z()) - 0.5*wedgeSector.bounds().thickness();
  float wedgeMaxZ = fabs( wedgeSector.position().z()) + 0.5*wedgeSector.bounds().thickness(); 
  float thetaWedgeMin =  wedgeSector.innerRadius()/ wedgeMaxZ;
  float thetaWedgeMax =  wedgeSector.outerRadius()/ wedgeMinZ;
  
  // do the theta regions overlap ?

  return  !( thetamin > thetaWedgeMax || thetaWedgeMin > thetamax);
  
} 
void CompositeTECPetal::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 GeometricSearchDet*>& CompositeTECPetal::subLayer ( int  ind) const [inline, private]

Definition at line 70 of file CompositeTECPetal.h.

References theBackComps, and theFrontComps.

Referenced by TOBRod::addClosest(), and TOBRod::searchNeighbors().

                                                                       {
    return (ind==0 ? theFrontComps : theBackComps);
  }

Member Data Documentation

std::vector<float> CompositeTECPetal::theBackBoundaries [private]

Definition at line 82 of file CompositeTECPetal.h.

Referenced by CompositeTECPetal(), and findBin().

std::vector<const GeometricSearchDet*> CompositeTECPetal::theBackComps [private]

Definition at line 85 of file CompositeTECPetal.h.

Referenced by CompositeTECPetal(), and computeCrossings().

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

Definition at line 79 of file CompositeTECPetal.h.

Referenced by basicComponents(), and CompositeTECPetal().

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

Definition at line 76 of file CompositeTECPetal.h.

Referenced by components(), CompositeTECPetal(), and ~CompositeTECPetal().

std::vector<float> CompositeTECPetal::theFrontBoundaries [private]

Definition at line 81 of file CompositeTECPetal.h.

Referenced by CompositeTECPetal(), and findBin().

Definition at line 84 of file CompositeTECPetal.h.

Referenced by CompositeTECPetal(), and computeCrossings().