CMS 3D CMS Logo

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

PixelBarrelLayer Class Reference

#include <PixelBarrelLayer.h>

Inheritance diagram for PixelBarrelLayer:
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
 PixelBarrelLayer (std::vector< const PixelRod * > &innerRods, std::vector< const PixelRod * > &outerRods)
virtual SubDetector subDetector () const
 The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
 ~PixelBarrelLayer ()

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 PixelBarrel layer built out of BarrelPixelRod

Definition at line 17 of file PixelBarrelLayer.h.


Member Typedef Documentation

Definition at line 19 of file PixelBarrelLayer.h.


Constructor & Destructor Documentation

PixelBarrelLayer::PixelBarrelLayer ( std::vector< const PixelRod * > &  innerRods,
std::vector< const PixelRod * > &  outerRods 
)

Definition at line 20 of file PixelBarrelLayer.cc.

References cylinder(), i, BarrelDetLayer::initialize(), LogDebug, theBasicComps, theComps, theInnerBinFinder, theInnerComps, theInnerCylinder, theOuterBinFinder, theOuterComps, and theOuterCylinder.

                                                                       : 
  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);

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

  
  BarrelDetLayer::initialize();


  //--------- DEBUG INFO --------------
  LogDebug("TkDetLayers") << "==== DEBUG PixelBarrelLayer =====" ; 
  LogDebug("TkDetLayers") << "PixelBarrelLayer innerCyl r,lenght: "
                          << theInnerCylinder->radius() << " , "
                          << theInnerCylinder->bounds().length();

  LogDebug("TkDetLayers") << "PixelBarrelLayer outerCyl r,lenght: " 
                          << theOuterCylinder->radius() << " , "
                          << theOuterCylinder->bounds().length();


    for (vector<const GeometricSearchDet*>::const_iterator i=theInnerComps.begin();
       i != theInnerComps.end(); i++){
    LogDebug("TkDetLayers") << "inner PixelRod 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 PixelRod pos z,perp,eta,phi: " 
                            << (**i).position().z()    << " , " 
                            << (**i).position().perp() << " , " 
                            << (**i).position().eta()  << " , " 
                            << (**i).position().phi()  ;
  }
  LogDebug("TkDetLayers") << "==== end DEBUG PixelBarrelLayer =====" ; 
  //----------------------------------- 
}
PixelBarrelLayer::~PixelBarrelLayer ( )

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

Implements GeometricSearchDet.

Definition at line 29 of file PixelBarrelLayer.h.

References theBasicComps.

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

Definition at line 190 of file PixelBarrelLayer.cc.

References TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::localPosition(), min, PV3DBase< T, PVType, FrameType >::phi(), 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).phi();
  double phi2 = det.surface().toGlobal(shift2).phi();
  double phiStart = state.globalPosition().phi();
  double phiWin = min(fabs(phiStart-phi1),fabs(phiStart-phi2));

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 31 of file PixelBarrelLayer.h.

References theComps.

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

Definition at line 121 of file PixelBarrelLayer.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();
  //{
  //edm::LogInfo(TkDetLayers) << "ERROR in PixelBarrelLayer: inner cylinder not crossed by track" ;
  //throw DetLayerException("TkRodBarrelLayer: inner subRod not crossed by track");
  //}

  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();
  //if (!outerCrossing.hasSolution()) {
  //  throw DetLayerException("PixelBarrelLayer: inner cylinder not crossed by track");
  //}

  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 PixelBarrelLayer::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const [private]

Definition at line 180 of file PixelBarrelLayer.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* PixelBarrelLayer::cylinder ( const std::vector< const GeometricSearchDet * > &  rods) const [private]

Referenced by PixelBarrelLayer().

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

Reimplemented from GeometricSearchDet.

Definition at line 88 of file PixelBarrelLayer.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().

                                                                               {
  vector<DetGroup> closestResult;
  SubLayerCrossings  crossings;
  crossings = computeCrossings( tsos, prop.propagationDirection());
  if(! crossings.isValid()) return;  
  
  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 PixelBarrelLayer::overlap ( const GlobalPoint gpos,
const GeometricSearchDet rod,
float  phiWin 
) const [private]

Definition at line 253 of file PixelBarrelLayer.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
  
  pair<float,float> phiRange(crossPoint.phi()-phiWin, crossPoint.phi()+phiWin);

  return rangesIntersect(phiRange, gsdet.surface().phiSpan(), PhiLess());

} 
void PixelBarrelLayer::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 PixelBarrelLayer::subDetector ( ) const [inline, virtual]

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

Implements DetLayer.

Definition at line 40 of file PixelBarrelLayer.h.

References GeomDetEnumerators::PixelBarrel.

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

Definition at line 75 of file PixelBarrelLayer.h.

References theInnerComps, and theOuterComps.

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

Member Data Documentation

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

Definition at line 85 of file PixelBarrelLayer.h.

Referenced by basicComponents(), and PixelBarrelLayer().

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

Definition at line 82 of file PixelBarrelLayer.h.

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

Definition at line 87 of file PixelBarrelLayer.h.

Referenced by computeCrossings(), and PixelBarrelLayer().

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

Definition at line 83 of file PixelBarrelLayer.h.

Referenced by PixelBarrelLayer(), and subLayer().

Definition at line 90 of file PixelBarrelLayer.h.

Referenced by computeCrossings(), and PixelBarrelLayer().

Definition at line 88 of file PixelBarrelLayer.h.

Referenced by computeCrossings(), and PixelBarrelLayer().

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

Definition at line 84 of file PixelBarrelLayer.h.

Referenced by PixelBarrelLayer(), and subLayer().

Definition at line 91 of file PixelBarrelLayer.h.

Referenced by computeCrossings(), and PixelBarrelLayer().