CMS 3D CMS Logo

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

TOBRod Class Reference

#include <TOBRod.h>

Inheritance diagram for TOBRod:
DetRod GeometricSearchDetWithGroups GeometricSearchDet GeometricSearchDet

List of all members.

Public Types

typedef PeriodicBinFinderInZ
< float > 
BinFinderType

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

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
bool overlap (const GlobalPoint &gpos, const GeomDet &rod, 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 * > & 
subRod (int ind) const

Private Attributes

std::vector< const GeomDet * > theDets
BinFinderType theInnerBinFinder
std::vector< const GeomDet * > theInnerDets
ReferenceCountingPointer
< BoundPlane
theInnerPlane
BinFinderType theOuterBinFinder
std::vector< const GeomDet * > theOuterDets
ReferenceCountingPointer
< BoundPlane
theOuterPlane

Detailed Description

A concrete implementation for TOB Rod

Definition at line 15 of file TOBRod.h.


Member Typedef Documentation

Definition at line 17 of file TOBRod.h.


Constructor & Destructor Documentation

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

Definition at line 28 of file TOBRod.cc.

References i, LogDebug, DetRod::setPlane(), python::multivaluedict::sort(), theDets, theInnerBinFinder, theInnerDets, theInnerPlane, theOuterBinFinder, theOuterDets, and theOuterPlane.

                                                 :
  theInnerDets(innerDets),theOuterDets(outerDets)
{
  theDets.assign(theInnerDets.begin(),theInnerDets.end());
  theDets.insert(theDets.end(),theOuterDets.begin(),theOuterDets.end());


  RodPlaneBuilderFromDet planeBuilder;
  setPlane( planeBuilder( theDets));
  theInnerPlane = planeBuilder( theInnerDets);
  theOuterPlane = planeBuilder( theOuterDets);


  sort(theDets.begin(),theDets.end(),DetZLess());
  sort(theInnerDets.begin(),theInnerDets.end(),DetZLess());
  sort(theOuterDets.begin(),theOuterDets.end(),DetZLess());
  theInnerBinFinder = BinFinderType(theInnerDets.begin(), theInnerDets.end());
  theOuterBinFinder = BinFinderType(theOuterDets.begin(), theOuterDets.end());


 
  LogDebug("TkDetLayers") << "==== DEBUG TOBRod =====" ; 
  for (vector<const GeomDet*>::const_iterator i=theInnerDets.begin();
       i != theInnerDets.end(); i++){
    LogDebug("TkDetLayers") << "inner TOBRod's Det pos z,perp,eta,phi: " 
                            << (**i).position().z() << " , " 
                            << (**i).position().perp() << " , " 
                            << (**i).position().eta() << " , " 
                            << (**i).position().phi() ;
  }
  
  for (vector<const GeomDet*>::const_iterator i=theOuterDets.begin();
       i != theOuterDets.end(); i++){
    LogDebug("TkDetLayers") << "outer TOBRod's Det pos z,perp,eta,phi: " 
                            << (**i).position().z() << " , " 
                            << (**i).position().perp() << " , " 
                            << (**i).position().eta() << " , " 
                            << (**i).position().phi() ;
  }
  LogDebug("TkDetLayers") << "==== end DEBUG TOBRod =====" ; 
  


}
TOBRod::~TOBRod ( )

Definition at line 74 of file TOBRod.cc.

               {
  
} 

Member Function Documentation

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

Definition at line 225 of file CompositeTECPetal.cc.

References Clusterizer1DCommons::add(), SubLayerCrossing::closestDetIndex(), LogDebug, CompositeTECPetal::subLayer(), and SubLayerCrossing::subLayerIndex().

Referenced by groupedCompatibleDetsV().

{
  const vector<const GeometricSearchDet*>& sub( subLayer( crossing.subLayerIndex()));
  const GeometricSearchDet* det(sub[crossing.closestDetIndex()]);

  LogDebug("TkDetLayers") 
    << "in TECPetal, adding Wedge at r,z,phi: (" 
    << det->position().perp() << "," 
    << det->position().z() << "," 
    << det->position().phi() << ")" ;
  LogDebug("TkDetLayers") 
    << "wedge comps size: " 
    << det->basicComponents().size();

  return CompatibleDetToGroupAdder::add( *det, tsos, prop, est, result);
}
virtual const std::vector<const GeomDet*>& TOBRod::basicComponents ( ) const [inline, virtual]

Implements GeometricSearchDet.

Definition at line 25 of file TOBRod.h.

References theDets.

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

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 80 of file TOBRod.cc.

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

Definition at line 136 of file TOBRod.cc.

References PeriodicBinFinderInZ< T >::binIndex(), PeriodicBinFinderInZ< T >::binPosition(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), rho, theInnerBinFinder, theInnerPlane, theOuterBinFinder, theOuterPlane, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

{
  GlobalPoint startPos( startingState.globalPosition());
  GlobalVector startDir( startingState.globalMomentum());
  double rho( startingState.transverseCurvature());

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

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

  GlobalPoint gInnerPoint( crossing.position(innerPath.second));
  int innerIndex = theInnerBinFinder.binIndex(gInnerPoint.z());
  float innerDist = fabs( theInnerBinFinder.binPosition(innerIndex) - gInnerPoint.z());
  SubLayerCrossing innerSLC( 0, innerIndex, gInnerPoint);

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

  GlobalPoint gOuterPoint( crossing.position(outerPath.second));
  int outerIndex = theOuterBinFinder.binIndex(gOuterPoint.z());
  float outerDist = fabs( theOuterBinFinder.binPosition(outerIndex) - gOuterPoint.z());
  SubLayerCrossing outerSLC( 1, outerIndex, gOuterPoint);

  if (innerDist < outerDist) {
    return SubLayerCrossings( innerSLC, outerSLC, 0);
  }
  else {
    return SubLayerCrossings( outerSLC, innerSLC, 1);
  } 
}
float TOBRod::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const [private]
void TOBRod::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const [virtual]

Reimplemented from GeometricSearchDet.

Definition at line 96 of file TOBRod.cc.

References addClosest(), LayerCrossingSide::barrelSide(), SubLayerCrossings::closest(), SubLayerCrossings::closestIndex(), computeCrossings(), computeWindowSize(), 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().barrelSide( 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().barrelSide( closestGel.trajectoryState(), prop);
    DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result, 
                                            crossings.closestIndex(), crossingSide);
  }
}
bool TOBRod::overlap ( const GlobalPoint gpos,
const GeomDet rod,
float  phiWin 
) const [private]

Definition at line 235 of file TOBRod.cc.

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

{
  // 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) << "TOBRod::overlap calculation assumes point on surface, but it is off by "
  //     << localCrossPoint.z() ;
  //   }

  float localY = localCrossPoint.y();
  float detHalfLength = det.surface().bounds().length()/2.;

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

Definition at line 249 of file CompositeTECPetal.cc.

References Clusterizer1DCommons::add(), SubLayerCrossing::closestDetIndex(), CompositeTECPetal::overlap(), PV3DBase< T, PVType, FrameType >::perp(), SubLayerCrossing::position(), CompositeTECPetal::subLayer(), SubLayerCrossing::subLayerIndex(), CompositeTECPetal::theBackComps, and CompositeTECPetal::theFrontComps.

Referenced by groupedCompatibleDetsV().

{
  GlobalPoint gCrossingPos = crossing.position();

  const vector<const GeometricSearchDet*>& sLayer( subLayer( crossing.subLayerIndex()));
 
  int closestIndex = crossing.closestDetIndex(); 
  int negStartIndex = closestIndex-1;
  int posStartIndex = closestIndex+1;

  if (checkClosest) { // must decide if the closest is on the neg or pos side
    if ( gCrossingPos.perp() < sLayer[closestIndex]->position().perp() ) {
      posStartIndex = closestIndex;
    }
    else {
      negStartIndex = closestIndex;
    }
  }


  //const BinFinderType& binFinder = (crossing.subLayerIndex()==0 ? theFrontBinFinder : theBackBinFinder);
  int theSize = crossing.subLayerIndex()==0 ? theFrontComps.size() : theBackComps.size();
  
  typedef CompatibleDetToGroupAdder Adder;
  for (int idet=negStartIndex; idet >= 0; idet--) {
    //if(idet<0 || idet>= theSize) {edm::LogInfo(TkDetLayers) << "===== error! gone out vector bounds.idet: " << idet ;exit;}
    const GeometricSearchDet & neighborWedge = *sLayer[idet];
    if (!overlap( gCrossingPos, neighborWedge, window)) break;  // --- to check
    if (!Adder::add( neighborWedge, tsos, prop, est, result)) break;
    // maybe also add shallow crossing angle test here???
  }
  for (int idet=posStartIndex; idet <theSize; idet++) {
    //if(idet<0 || idet>= theSize) {edm::LogInfo(TkDetLayers) << "===== error! gone out vector bounds.idet: " << idet ;exit;}
    const GeometricSearchDet & neighborWedge = *sLayer[idet];
    if (!overlap( gCrossingPos, neighborWedge, window)) break;  // ---- to check
    if (!Adder::add( neighborWedge, tsos, prop, est, result)) break;
    // maybe also add shallow crossing angle test here???
  }
}
const std::vector<const GeomDet*>& TOBRod::subRod ( int  ind) const [inline, private]

Definition at line 67 of file TOBRod.h.

References theInnerDets, and theOuterDets.

                                                          {
    return (ind==0 ? theInnerDets : theOuterDets);
  }

Member Data Documentation

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

Definition at line 73 of file TOBRod.h.

Referenced by basicComponents(), and TOBRod().

Definition at line 80 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

std::vector<const GeomDet*> TOBRod::theInnerDets [private]

Definition at line 74 of file TOBRod.h.

Referenced by subRod(), and TOBRod().

Definition at line 77 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

Definition at line 81 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

std::vector<const GeomDet*> TOBRod::theOuterDets [private]

Definition at line 75 of file TOBRod.h.

Referenced by subRod(), and TOBRod().

Definition at line 78 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().