CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TIBLayer Class Reference

#include <TIBLayer.h>

Inheritance diagram for TIBLayer:
BarrelDetLayer GeometricSearchDetWithGroups DetLayer GeometricSearchDet GeometricSearchDet

List of all members.

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
virtual SubDetector subDetector () const
 The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
 TIBLayer (std::vector< const TIBRing * > &innerRings, std::vector< const TIBRing * > &outerRings)
 ~TIBLayer ()

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 &startingState, PropagationDirection propDir) const
float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
BoundCylindercylinder (const std::vector< const GeometricSearchDet * > &rings)
bool overlap (const GlobalPoint &gpos, const GeometricSearchDet &ring, float window) 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

Private Attributes

std::vector< const GeomDet * > theBasicComps
std::vector< const
GeometricSearchDet * > 
theComps
GeneralBinFinderInZforGeometricSearchDet
< float > 
theInnerBinFinder
std::vector< const
GeometricSearchDet * > 
theInnerComps
ReferenceCountingPointer
< BoundCylinder
theInnerCylinder
GeneralBinFinderInZforGeometricSearchDet
< float > 
theOuterBinFinder
std::vector< const
GeometricSearchDet * > 
theOuterComps
ReferenceCountingPointer
< BoundCylinder
theOuterCylinder

Detailed Description

A concrete implementation for TIB layer built out of TIBRings

Definition at line 14 of file TIBLayer.h.


Constructor & Destructor Documentation

TIBLayer::TIBLayer ( std::vector< const TIBRing * > &  innerRings,
std::vector< const TIBRing * > &  outerRings 
)

Definition at line 20 of file TIBLayer.cc.

References BoundSurface::bounds(), cylinder(), i, BarrelDetLayer::initialize(), Bounds::length(), LogDebug, Cylinder::radius(), python::multivaluedict::sort(), BarrelDetLayer::specificSurface(), theBasicComps, theComps, theInnerBinFinder, theInnerComps, theInnerCylinder, theOuterBinFinder, theOuterComps, theOuterCylinder, and Bounds::thickness().

                                                       : 
  theInnerComps(innerRings.begin(),innerRings.end()), 
  theOuterComps(outerRings.begin(),outerRings.end())
{
  theComps.assign(theInnerComps.begin(),theInnerComps.end());
  theComps.insert(theComps.end(),theOuterComps.begin(),theOuterComps.end());
  
  sort(theComps.begin(),theComps.end(),DetLessZ());
  sort(theInnerComps.begin(),theInnerComps.end(),DetLessZ());
  sort(theOuterComps.begin(),theOuterComps.end(),DetLessZ());
  
  for(vector<const GeometricSearchDet*>::const_iterator it=theComps.begin();
      it!=theComps.end();it++){  
    theBasicComps.insert(theBasicComps.end(),   
                         (**it).basicComponents().begin(),
                         (**it).basicComponents().end());
  }

  // initialize the surface
  theInnerCylinder = cylinder( theInnerComps);
  theOuterCylinder = cylinder( theOuterComps);
  initialize();
  
  LogDebug("TkDetLayers") << "==== DEBUG TIBLayer =====" ; 
  LogDebug("TkDetLayers") << "innerCyl radius, thickness, lenght: " 
                          << theInnerCylinder->radius() << " , "
                          << theInnerCylinder->bounds().thickness() << " , "
                          << theInnerCylinder->bounds().length() ;
 
  LogDebug("TkDetLayers") << "outerCyl radius, thickness, lenght: " 
                          << theOuterCylinder->radius() << " , "
                          << theOuterCylinder->bounds().thickness() << " , "
                          << theOuterCylinder->bounds().length() ;

  LogDebug("TkDetLayers") << "Cyl radius, thickness, lenght: " 
                          << specificSurface().radius() << " , "
                          << specificSurface().bounds().thickness() << " , "
                          << specificSurface().bounds().length() ;

  for (vector<const GeometricSearchDet*>::const_iterator i=theInnerComps.begin();
       i != theInnerComps.end(); i++){
    LogDebug("TkDetLayers") << "inner TIBRing pos z,radius,eta,phi: " 
                            << (**i).position().z() << " , " 
                            << (**i).position().perp() << " , " 
                            << (**i).position().eta() << " , " 
                            << (**i).position().phi() ;
  }

  for (vector<const GeometricSearchDet*>::const_iterator i=theOuterComps.begin();
       i != theOuterComps.end(); i++){
    LogDebug("TkDetLayers") << "outer TIBRing pos z,radius,eta,phi: " 
                            << (**i).position().z() << " , " 
                            << (**i).position().perp() << " , " 
                            << (**i).position().eta() << " , " 
                            << (**i).position().phi() ;
  }
  


  // initialise the bin finders
  //  vector<const GeometricSearchDet*> tmpIn;
  //for (vector<const TIBRing*>::const_iterator i=theInnerRings.begin();
  //     i != theInnerRings.end(); i++) tmpIn.push_back(*i);
  theInnerBinFinder = GeneralBinFinderInZforGeometricSearchDet<float>(theInnerComps.begin(), 
                                                                      theInnerComps.end());
 
  theOuterBinFinder = GeneralBinFinderInZforGeometricSearchDet<float>(theOuterComps.begin(),
                                                                      theOuterComps.end());
}
TIBLayer::~TIBLayer ( )

Definition at line 91 of file TIBLayer.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 TIBLayer::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*>& TIBLayer::basicComponents ( ) const [inline, virtual]

Implements GeometricSearchDet.

Definition at line 24 of file TIBLayer.h.

References theBasicComps.

Referenced by MatchedHitRZCorrectionFromBending::MatchedHitRZCorrectionFromBending().

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 26 of file TIBLayer.h.

References theComps.

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

Definition at line 162 of file TIBLayer.cc.

References GeneralBinFinderInZforGeometricSearchDet< T >::binIndex(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), HelixBarrelCylinderCrossing::hasSolution(), HelixBarrelCylinderCrossing::position(), GloballyPositioned< T >::position(), rho, GeometricSearchDet::surface(), theInnerBinFinder, theInnerComps, theInnerCylinder, theOuterBinFinder, theOuterComps, theOuterCylinder, TrajectoryStateOnSurface::transverseCurvature(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by groupedCompatibleDetsV().

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

  HelixBarrelCylinderCrossing innerCrossing( startPos, startDir, rho,
                                             propDir,*theInnerCylinder);
  if (!innerCrossing.hasSolution()) return SubLayerCrossings(); 

  GlobalPoint gInnerPoint( innerCrossing.position());
  int innerIndex = theInnerBinFinder.binIndex(gInnerPoint.z());
  const GeometricSearchDet* innerRing( theInnerComps[innerIndex]);
  float innerDist = fabs( innerRing->surface().position().z() - gInnerPoint.z());
  SubLayerCrossing innerSLC( 0, innerIndex, gInnerPoint);

  HelixBarrelCylinderCrossing outerCrossing( startPos, startDir, rho,
                                             propDir,*theOuterCylinder);
  if (!outerCrossing.hasSolution()) return SubLayerCrossings();

  GlobalPoint gOuterPoint( outerCrossing.position());
  int outerIndex = theOuterBinFinder.binIndex(gOuterPoint.z());
  const GeometricSearchDet* outerRing( theOuterComps[outerIndex]);
  float outerDist = fabs( outerRing->surface().position().z() - gOuterPoint.z());
  SubLayerCrossing outerSLC( 1, outerIndex, gOuterPoint);

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

Definition at line 265 of file TIBLayer.cc.

References BoundSurface::bounds(), TrajectoryStateOnSurface::globalMomentum(), MeasurementEstimator::maximalLocalDisplacement(), GeomDet::surface(), funct::tan(), PV3DBase< T, PVType, FrameType >::theta(), Bounds::thickness(), and PV2DBase< T, PVType, FrameType >::y().

Referenced by groupedCompatibleDetsV().

{
  // we assume the outer and inner rings have about same thickness...

//   edm::LogInfo(TkDetLayers) << "TIBLayer::computeWindowSize: Y axis of tangent plane is"
//        << plane.toGlobal( LocalVector(0,1,0)) ;

  MeasurementEstimator::Local2DVector localError( est.maximalLocalDisplacement(tsos, det->surface()));
  float yError = localError.y();

  float tanTheta = tan( tsos.globalMomentum().theta());
  float thickCorrection = det->surface().bounds().thickness() / (2.*fabs( tanTheta));

  // FIXME: correct this in case of wide phi window !  

  return yError + thickCorrection;
}
BoundCylinder* TIBLayer::cylinder ( const std::vector< const GeometricSearchDet * > &  rings) [private]

Referenced by TIBLayer().

void TIBLayer::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const [virtual]

Reimplemented from GeometricSearchDet.

Definition at line 133 of file TIBLayer.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);
  // this differs from compatibleDets logic, which checks next in such cases!!!
  if (closestResult.empty())    return;
  
  
  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 TIBLayer::overlap ( const GlobalPoint gpos,
const GeometricSearchDet ring,
float  window 
) const [private]

Definition at line 248 of file TIBLayer.cc.

References BoundSurface::bounds(), Bounds::length(), GeometricSearchDet::position(), GeometricSearchDet::surface(), and PV3DBase< T, PVType, FrameType >::z().

{
  float halfLength = det.surface().bounds().length()/2.;

//   edm::LogInfo(TkDetLayers) << " TIBLayer: checking ring with z " << det.position().z();

  if ( fabs( crossPoint.z()-det.position().z()) < (halfLength + window)) {
//     edm::LogInfo(TkDetLayers) << "    PASSED" ;
    return true;
  } else {
//     edm::LogInfo(TkDetLayers) << "    FAILED " ;
    return false;
  }
}
void TIBLayer::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 SubDetector TIBLayer::subDetector ( ) const [inline, virtual]

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

Implements DetLayer.

Definition at line 34 of file TIBLayer.h.

References sistripsummary::TIB.

const std::vector<const GeometricSearchDet*>& TIBLayer::subLayer ( int  ind) const [inline, private]

Definition at line 63 of file TIBLayer.h.

References theInnerComps, and theOuterComps.

                                                                       {
    return (ind==0 ? theInnerComps : theOuterComps);
  }

Member Data Documentation

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

Definition at line 72 of file TIBLayer.h.

Referenced by basicComponents(), and TIBLayer().

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

Definition at line 69 of file TIBLayer.h.

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

Definition at line 77 of file TIBLayer.h.

Referenced by computeCrossings(), and TIBLayer().

std::vector<const GeometricSearchDet*> TIBLayer::theInnerComps [private]

Definition at line 70 of file TIBLayer.h.

Referenced by computeCrossings(), subLayer(), and TIBLayer().

Definition at line 74 of file TIBLayer.h.

Referenced by computeCrossings(), and TIBLayer().

Definition at line 78 of file TIBLayer.h.

Referenced by computeCrossings(), and TIBLayer().

std::vector<const GeometricSearchDet*> TIBLayer::theOuterComps [private]

Definition at line 71 of file TIBLayer.h.

Referenced by computeCrossings(), subLayer(), and TIBLayer().

Definition at line 75 of file TIBLayer.h.

Referenced by computeCrossings(), and TIBLayer().