CMS 3D CMS Logo

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

TOBLayer Class Reference

#include <TOBLayer.h>

Inheritance diagram for TOBLayer:
RodBarrelLayer GeometricSearchDetWithGroups BarrelDetLayer GeometricSearchDet DetLayer GeometricSearchDet

List of all members.

Public Types

typedef PeriodicBinFinderInPhi
< double > 
BinFinderType

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)
 TOBLayer (std::vector< const TOBRod * > &innerRods, std::vector< const TOBRod * > &outerRods)
 ~TOBLayer ()

Private Member Functions

bool addClosest (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const
double calculatePhiWindow (double Xmax, const GeomDet &det, const TrajectoryStateOnSurface &state) const
SubLayerCrossings computeCrossings (const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const
float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
BoundCylindercylinder (const std::vector< const GeometricSearchDet * > &rods) const
bool overlap (const GlobalPoint &gpos, const GeometricSearchDet &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
GeometricSearchDet * > & 
subLayer (int ind) const

Private Attributes

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

Detailed Description

A concrete implementation for TOB layer built out of TOBRods

Definition at line 15 of file TOBLayer.h.


Member Typedef Documentation

Definition at line 17 of file TOBLayer.h.


Constructor & Destructor Documentation

TOBLayer::TOBLayer ( std::vector< const TOBRod * > &  innerRods,
std::vector< const TOBRod * > &  outerRods 
)

Definition at line 20 of file TOBLayer.cc.

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

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

  theInnerCylinder = cylinder( theInnerComps);
  theOuterCylinder = cylinder( theOuterComps);

  if (theInnerComps.size())
    theInnerBinFinder = BinFinderType(theInnerComps.front()->position().phi(),
                                      theInnerComps.size());

  if (theOuterComps.size())
    theOuterBinFinder = BinFinderType(theOuterComps.front()->position().phi(),
                                      theOuterComps.size());
  
  BarrelDetLayer::initialize();

   //--------- DEBUG INFO --------------
  LogDebug("TkDetLayers") << "==== DEBUG TOBLayer =====" ; 
  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 TOBRod pos z,perp,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 TOBRod pos z,perp,eta,phi: " 
                            << (**i).position().z() << " , " 
                            << (**i).position().perp() << " , " 
                            << (**i).position().eta() << " , " 
                            << (**i).position().phi() ;
  }
  LogDebug("TkDetLayers") << "==== end DEBUG TOBLayer =====" ;   
}
TOBLayer::~TOBLayer ( )

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

Implements GeometricSearchDet.

Definition at line 26 of file TOBLayer.h.

References theBasicComps.

{return theBasicComps;}
double TOBLayer::calculatePhiWindow ( double  Xmax,
const GeomDet det,
const TrajectoryStateOnSurface state 
) const [private]

Definition at line 191 of file TOBLayer.cc.

References PV3DBase< T, PVType, FrameType >::barePhi(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::localPosition(), min, edm::shift, GeomDet::surface(), and Surface::toGlobal().

Referenced by computeWindowSize().

{

  LocalPoint startPoint = state.localPosition();
  LocalVector shift( Xmax , 0. , 0.);
  LocalPoint shift1 = startPoint + shift;
  LocalPoint shift2 = startPoint + (-shift); 
  //LocalPoint shift2( startPoint); //original code;
  //shift2 -= shift;

  double phi1 = det.surface().toGlobal(shift1).barePhi();
  double phi2 = det.surface().toGlobal(shift2).barePhi();
  double phiStart = state.globalPosition().barePhi();
  double phiWin = min(fabs(phiStart-phi1),fabs(phiStart-phi2));

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 28 of file TOBLayer.h.

References theComps.

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

Definition at line 131 of file TOBLayer.cc.

References PeriodicBinFinderInPhi< T >::binIndex(), PeriodicBinFinderInPhi< T >::binPosition(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), HelixBarrelCylinderCrossing::hasSolution(), pi, HelixBarrelCylinderCrossing::position(), rho, theInnerBinFinder, theInnerCylinder, theOuterBinFinder, theOuterCylinder, and TrajectoryStateOnSurface::transverseCurvature().

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.phi());
  float innerDist = theInnerBinFinder.binPosition(innerIndex) - gInnerPoint.phi();
  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.phi());
  float outerDist = theOuterBinFinder.binPosition(outerIndex) - gOuterPoint.phi() ;
  SubLayerCrossing outerSLC( 1, outerIndex, gOuterPoint);
  
  innerDist *= PhiLess()( theInnerBinFinder.binPosition(innerIndex),gInnerPoint.phi()) ? -1. : 1.; 
  outerDist *= PhiLess()( theOuterBinFinder.binPosition(outerIndex),gOuterPoint.phi()) ? -1. : 1.; 
  if (innerDist < 0.) { innerDist += 2.*Geom::pi();}
  if (outerDist < 0.) { outerDist += 2.*Geom::pi();}
  

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

Definition at line 181 of file TOBLayer.cc.

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

Referenced by groupedCompatibleDetsV().

{
  double xmax = 
    est.maximalLocalDisplacement(tsos, det->surface()).x();
  return calculatePhiWindow( xmax, *det, tsos);
}
BoundCylinder * TOBLayer::cylinder ( const std::vector< const GeometricSearchDet * > &  rods) const [private]

Definition at line 271 of file PixelBarrelLayer.cc.

References tmp.

Referenced by TOBLayer().

{
  vector<const GeomDet*> tmp;
  for (vector<const GeometricSearchDet*>::const_iterator it=rods.begin(); it!=rods.end(); it++) {    
    tmp.insert(tmp.end(),(*it)->basicComponents().begin(),(*it)->basicComponents().end());
  }
  return CylinderBuilderFromDet()( tmp.begin(), tmp.end());
}
void TOBLayer::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 TOBLayer.cc.

References addClosest(), LayerCrossingSide::barrelSide(), SubLayerCrossings::closest(), SubLayerCrossings::closestIndex(), computeCrossings(), computeWindowSize(), SubLayerCrossings::isValid(), DetGroupMerger::orderAndMergeTwoLevels(), SubLayerCrossings::other(), Propagator::propagationDirection(), query::result, 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()){
    addClosest( tsos, prop, est, crossings.other(), result);
    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 TOBLayer::overlap ( const GlobalPoint gpos,
const GeometricSearchDet rod,
float  phiWin 
) const [private]

Definition at line 254 of file TOBLayer.cc.

References PV3DBase< T, PVType, FrameType >::phi(), BoundSurface::phiSpan(), rangesIntersect(), and GeometricSearchDet::surface().

{
  GlobalPoint crossPoint(gpos);

  // introduce offset (extrapolated point and true propagated point differ by 0.0003 - 0.00033, 
  // due to thickness of Rod of 1 cm) 
  const float phiOffset = 0.00034;  //...TOBE CHECKED LATER...
  phiWin += phiOffset;

  // detector phi range
  std::pair<float,float> phiRange(crossPoint.phi()-phiWin, crossPoint.phi()+phiWin);

  //   // debug
  //   edm::LogInfo(TkDetLayers) ;
  //   edm::LogInfo(TkDetLayers) << " overlapInPhi: position, det phi range " 
  //        << "("<< rod.position().perp() << ", " << rod.position().phi() << ")  "
  //        << rodRange.phiRange().first << " " << rodRange.phiRange().second ;
  //   edm::LogInfo(TkDetLayers) << " overlapInPhi: cross point phi, window " << crossPoint.phi() << " " << phiWin ;
  //   edm::LogInfo(TkDetLayers) << " overlapInPhi: search window: " << crossPoint.phi()-phiWin << "  " << crossPoint.phi()+phiWin ;

  return rangesIntersect(phiRange, gsdet.surface().phiSpan(), PhiLess());
} 
void TOBLayer::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 TOBLayer::subDetector ( ) const [inline, virtual]

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

Implements DetLayer.

Definition at line 37 of file TOBLayer.h.

References sistripsummary::TOB.

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

Definition at line 70 of file TOBLayer.h.

References theInnerComps, and theOuterComps.

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

Member Data Documentation

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

Definition at line 80 of file TOBLayer.h.

Referenced by basicComponents(), and TOBLayer().

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

Definition at line 77 of file TOBLayer.h.

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

Definition at line 82 of file TOBLayer.h.

Referenced by computeCrossings(), and TOBLayer().

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

Definition at line 78 of file TOBLayer.h.

Referenced by subLayer(), and TOBLayer().

Definition at line 85 of file TOBLayer.h.

Referenced by computeCrossings(), and TOBLayer().

Definition at line 83 of file TOBLayer.h.

Referenced by computeCrossings(), and TOBLayer().

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

Definition at line 79 of file TOBLayer.h.

Referenced by subLayer(), and TOBLayer().

Definition at line 86 of file TOBLayer.h.

Referenced by computeCrossings(), and TOBLayer().