CMS 3D CMS Logo

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

TECLayer Class Reference

#include <TECLayer.h>

Inheritance diagram for TECLayer:
ForwardDetLayer 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)
 TECLayer (std::vector< const TECPetal * > &innerPetals, std::vector< const TECPetal * > &outerPetals)
 ~TECLayer ()

Protected Types

typedef PeriodicBinFinderInPhi
< double > 
BinFinderPhi

Protected Member Functions

virtual BoundDiskcomputeDisk (std::vector< const GeometricSearchDet * > &petals) const

Protected Attributes

BinFinderPhi theBackBinFinder
std::vector< const
GeometricSearchDet * > 
theBackComps
ReferenceCountingPointer
< BoundDisk
theBackDisk
std::vector< const GeomDet * > theBasicComps
std::vector< const
GeometricSearchDet * > 
theComps
BinFinderPhi theFrontBinFinder
std::vector< const
GeometricSearchDet * > 
theFrontComps
ReferenceCountingPointer
< BoundDisk
theFrontDisk

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
bool overlap (const GlobalPoint &gpos, const GeometricSearchDet &petal, 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

Detailed Description

A concrete implementation for TEC layer built out of TECPetals

Definition at line 16 of file TECLayer.h.


Member Typedef Documentation

typedef PeriodicBinFinderInPhi<double> TECLayer::BinFinderPhi [protected]

Definition at line 77 of file TECLayer.h.


Constructor & Destructor Documentation

TECLayer::TECLayer ( std::vector< const TECPetal * > &  innerPetals,
std::vector< const TECPetal * > &  outerPetals 
)

Definition at line 21 of file TECLayer.cc.

References computeDisk(), BoundDisk::innerRadius(), LogDebug, BoundDisk::outerRadius(), PV3DBase< T, PVType, FrameType >::perp(), GeometricSearchDet::position(), ForwardDetLayer::setSurface(), ForwardDetLayer::specificSurface(), theBackBinFinder, theBackComps, theBackDisk, theBasicComps, theComps, theFrontBinFinder, theFrontComps, theFrontDisk, and PV3DBase< T, PVType, FrameType >::z().

                                                         : 
  theFrontComps(innerPetals.begin(),innerPetals.end()), 
  theBackComps(outerPetals.begin(),outerPetals.end())
{
  theComps.assign(theFrontComps.begin(),theFrontComps.end());
  theComps.insert(theComps.end(),theBackComps.begin(),theBackComps.end());

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


  //This should be no necessary. TO BE CHECKED
  //sort(theFrontPetals.begin(), theFrontPetals.end(), PetalLessPhi());
  //sort(theBackPetals.begin(), theBackPetals.end(), PetalLessPhi());

  // building disk for front and back petals
  setSurface( computeDisk( theComps ) );
  theFrontDisk = computeDisk( theFrontComps);
  theBackDisk  = computeDisk( theBackComps);

  // set up the bin finders
  theFrontBinFinder = BinFinderPhi(theFrontComps.front()->position().phi(),
                                   theFrontComps.size());
  theBackBinFinder  = BinFinderPhi(theBackComps.front()->position().phi(),
                                   theBackComps.size());  

  //--------- DEBUG INFO --------------
  LogDebug("TkDetLayers") << "DEBUG INFO for TECLayer" << "\n"
                          << "TECLayer z,perp, innerRadius, outerR: " 
                          << this->position().z()    << " , "
                          << this->position().perp() << " , "
                          << this->specificSurface().innerRadius() << " , "
                          << this->specificSurface().outerRadius() ;
  

  for(vector<const GeometricSearchDet*>::const_iterator it=theFrontComps.begin(); 
      it!=theFrontComps.end(); it++){
    LogDebug("TkDetLayers") << "frontPetal 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") << "backPetal phi,z,r: " 
         << (*it)->surface().position().phi() << " , "
         << (*it)->surface().position().z() <<   " , "
         << (*it)->surface().position().perp() ;
  }
  //----------------------------------- 


}
TECLayer::~TECLayer ( )

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

Implements GeometricSearchDet.

Definition at line 24 of file TECLayer.h.

References theBasicComps.

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 26 of file TECLayer.h.

References theComps.

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

Definition at line 132 of file TECLayer.cc.

References abs, PeriodicBinFinderInPhi< T >::binIndex(), Geom::deltaPhi(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), LogDebug, GloballyPositioned< T >::phi(), rho, ForwardDetLayer::surface(), theBackBinFinder, theBackComps, theBackDisk, theFrontBinFinder, theFrontComps, theFrontDisk, 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( *theFrontDisk);
  if (!frontPath.first) SubLayerCrossings();


  GlobalPoint gFrontPoint(crossing.position(frontPath.second));
  LogDebug("TkDetLayers") 
    << "in TECLayer,front crossing point: r,z,phi: (" 
    << gFrontPoint.perp() << ","
    << gFrontPoint.z() << "," 
    << gFrontPoint.phi() << ")" << endl;
  

  int frontIndex = theFrontBinFinder.binIndex(gFrontPoint.barePhi()); 
  SubLayerCrossing frontSLC( 0, frontIndex, gFrontPoint);



  pair<bool,double> backPath = crossing.pathLength( *theBackDisk);
  if (!backPath.first) SubLayerCrossings();


  GlobalPoint gBackPoint( crossing.position(backPath.second));
  LogDebug("TkDetLayers") 
    << "in TECLayer,back crossing point: r,z,phi: (" 
    << gBackPoint.perp() << "," 
    << gFrontPoint.z() << "," 
    << gBackPoint.phi() << ")" << endl;


  int backIndex = theBackBinFinder.binIndex(gBackPoint.barePhi());
  SubLayerCrossing backSLC( 1, backIndex, gBackPoint);

  
  // 0ss: frontDisk has index=0, backDisk has index=1
  float frontDist = std::abs(Geom::deltaPhi( double(gFrontPoint.barePhi()), 
                                             double(theFrontComps[frontIndex]->surface().phi())));
  float backDist = std::abs(Geom::deltaPhi( double(gBackPoint.barePhi()), 
                                            double(theBackComps[backIndex]->surface().phi())));
  

  if (frontDist < backDist) {
    return SubLayerCrossings( frontSLC, backSLC, 0);
  }
  else {
    return SubLayerCrossings( backSLC, frontSLC, 1);
  } 
}
virtual BoundDisk* TECLayer::computeDisk ( std::vector< const GeometricSearchDet * > &  petals) const [protected, virtual]

Referenced by TECLayer().

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

Reimplemented from GeometricSearchDet.

Definition at line 92 of file TECLayer.cc.

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

                                                                               {  
  SubLayerCrossings  crossings; 
  crossings = computeCrossings( tsos, prop.propagationDirection());
  if(! crossings.isValid()) return;

  vector<DetGroup> closestResult;
  addClosest( tsos, prop, est, crossings.closest(), closestResult); 
  LogDebug("TkDetLayers") << "in TECLayer, closestResult.size(): " << closestResult.size();

  // this differs from other groupedCompatibleDets logic, which DON'T check next in such cases!!!
  if(closestResult.empty()){
    vector<DetGroup> nextResult;
    addClosest( tsos, prop, est, crossings.other(), nextResult);   
    LogDebug("TkDetLayers") << "in TECLayer, 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 phiWindow = tkDetUtil::computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est); 
    searchNeighbors( tsos, prop, est, crossings.closest(), phiWindow,
                     closestResult, false); 
    vector<DetGroup> nextResult;  
    searchNeighbors( tsos, prop, est, crossings.other(), phiWindow,
                     nextResult, true); 
    
    int crossingSide = LayerCrossingSide().endcapSide( closestGel.trajectoryState(), prop);
    DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result,
                                            crossings.closestIndex(), crossingSide);
  }
}
bool TECLayer::overlap ( const GlobalPoint gpos,
const GeometricSearchDet petal,
float  window 
) const [private]

Definition at line 250 of file TECLayer.cc.

References PV3DBase< T, PVType, FrameType >::barePhi(), phi, GloballyPositioned< T >::phi(), BoundDiskSector::phiExtension(), rangesIntersect(), and GeometricSearchDet::surface().

{
  float phi = gpos.barePhi();
  const BoundDiskSector&  diskSector = static_cast<const BoundDiskSector&>(gsdet.surface());
  pair<float,float> phiRange(phi-phiWin,phi+phiWin);
  pair<float,float> petalPhiRange(diskSector.phi() - 0.5*diskSector.phiExtension(),
                                  diskSector.phi() + 0.5*diskSector.phiExtension());


  return rangesIntersect(phiRange, petalPhiRange, PhiLess());
}
void TECLayer::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 TECLayer::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 TECLayer.h.

References sistripsummary::TEC.

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

Definition at line 60 of file TECLayer.h.

References theBackComps, and theFrontComps.

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

Member Data Documentation

Definition at line 80 of file TECLayer.h.

Referenced by computeCrossings(), and TECLayer().

std::vector<const GeometricSearchDet*> TECLayer::theBackComps [protected]

Definition at line 70 of file TECLayer.h.

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

Definition at line 75 of file TECLayer.h.

Referenced by computeCrossings(), and TECLayer().

std::vector<const GeomDet*> TECLayer::theBasicComps [protected]

Definition at line 71 of file TECLayer.h.

Referenced by basicComponents(), and TECLayer().

std::vector<const GeometricSearchDet*> TECLayer::theComps [protected]

Definition at line 68 of file TECLayer.h.

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

Definition at line 79 of file TECLayer.h.

Referenced by computeCrossings(), and TECLayer().

std::vector<const GeometricSearchDet*> TECLayer::theFrontComps [protected]

Definition at line 69 of file TECLayer.h.

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

Definition at line 74 of file TECLayer.h.

Referenced by computeCrossings(), and TECLayer().