CMS 3D CMS Logo

TIDLayer Class Reference

A concrete implementation for TID layer built out of TIDRings. More...

#include <RecoTracker/TkDetLayers/interface/TIDLayer.h>

Inheritance diagram for TIDLayer:

RingedForwardLayer GeometricSearchDetWithGroups ForwardDetLayer GeometricSearchDet DetLayer 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).
 TIDLayer (std::vector< const TIDRing * > &rings)
 ~TIDLayer ()

Protected Member Functions

float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
int findClosest (const GlobalPoint[3]) const
int findNextIndex (const GlobalPoint[3], int) const
bool overlapInR (const TrajectoryStateOnSurface &tsos, int i, double ymax) const

Static Protected Member Functions

static void orderAndMergeLevels (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const std::vector< std::vector< DetGroup > > &groups, const std::vector< int > &indices, std::vector< DetGroup > &result)

Protected Attributes

std::vector< const GeomDet * > theBasicComps
std::vector< const
GeometricSearchDet * > 
theComps

Private Member Functions

virtual BoundDiskcomputeDisk (const std::vector< const TIDRing * > &rings) const
virtual std::vector< intringIndicesByCrossingProximity (const TrajectoryStateOnSurface &startingState, const Propagator &prop) const


Detailed Description

A concrete implementation for TID layer built out of TIDRings.

Definition at line 13 of file TIDLayer.h.


Constructor & Destructor Documentation

TIDLayer::TIDLayer ( std::vector< const TIDRing * > &  rings  ) 

TIDLayer::~TIDLayer (  ) 

Definition at line 92 of file TIDLayer.cc.

References i, and theComps.

00092                    {
00093   vector<const GeometricSearchDet*>::const_iterator i;
00094   for (i=theComps.begin(); i!=theComps.end(); i++) {
00095     delete *i;
00096   }
00097 
00098 } 


Member Function Documentation

virtual const std::vector<const GeomDet*>& TIDLayer::basicComponents (  )  const [inline, virtual]

Implements GeometricSearchDet.

Definition at line 20 of file TIDLayer.h.

References theBasicComps.

00020 {return theBasicComps;}

virtual const std::vector<const GeometricSearchDet*>& TIDLayer::components (  )  const [inline, virtual]

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 22 of file TIDLayer.h.

References theComps.

00022 {return theComps;}

virtual BoundDisk* TIDLayer::computeDisk ( const std::vector< const TIDRing * > &  rings  )  const [private, virtual]

float TIDLayer::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const [protected]

Definition at line 218 of file TIDLayer.cc.

References MeasurementEstimator::maximalLocalDisplacement(), GeomDet::surface(), and PV2DBase< T, PVType, FrameType >::y().

Referenced by groupedCompatibleDetsV().

00221 {
00222   const BoundPlane& startPlane = det->surface();  
00223   MeasurementEstimator::Local2DVector maxDistance = 
00224     est.maximalLocalDisplacement( tsos, startPlane);
00225   return maxDistance.y();
00226 }

int TIDLayer::findClosest ( const   GlobalPoint[3]  )  const [protected]

Definition at line 293 of file TIDLayer.cc.

References i, BoundDisk::innerRadius(), BoundDisk::outerRadius(), muonGeometry::perp(), and theComps.

Referenced by ringIndicesByCrossingProximity().

00294 {
00295   int theBin = 0;
00296   const BoundDisk & theFrontRing  = static_cast<const BoundDisk &>(theComps[0]->surface());
00297   float initialR = 0.5*( theFrontRing.innerRadius() +
00298                          theFrontRing.outerRadius());
00299   float rDiff = fabs( ringCrossing[0].perp() - initialR);
00300   for (int i = 1; i < 3 ; i++){
00301     const BoundDisk & theRing  = static_cast<const BoundDisk &>(theComps[i]->surface());
00302     float ringR = 0.5*( theRing.innerRadius() + 
00303                         theRing.outerRadius());
00304     float testDiff = fabs( ringCrossing[i].perp() - ringR);
00305     if ( theBin<0 || testDiff<rDiff ) {
00306       rDiff = testDiff;
00307       theBin = i;
00308     }
00309   }
00310   return theBin;
00311 }

int TIDLayer::findNextIndex ( const   GlobalPoint[3],
int  closest 
) const [protected]

Definition at line 314 of file TIDLayer.cc.

References i, BoundDisk::innerRadius(), BoundDisk::outerRadius(), muonGeometry::perp(), and theComps.

Referenced by ringIndicesByCrossingProximity().

00315 {
00316 
00317   int firstIndexToCheck = (closest != 0)? 0 : 1; 
00318   const BoundDisk & theFrontRing  = static_cast<const BoundDisk &>(theComps[firstIndexToCheck]->surface());
00319   float initialR = ( theFrontRing.innerRadius() +
00320                      theFrontRing.outerRadius())/2.;         
00321 
00322   float rDiff = fabs( ringCrossing[0].perp() - initialR);
00323   int theBin = firstIndexToCheck;
00324   for (int i = firstIndexToCheck+1; i < 3 ; i++){
00325     if ( i != closest) {
00326       const BoundDisk & theRing  = static_cast<const BoundDisk &>(theComps[i]->surface());
00327       float ringR = ( theRing.innerRadius() + 
00328                       theRing.outerRadius())/2.;
00329       float testDiff = fabs( ringCrossing[i].perp() - ringR);
00330       if ( testDiff<rDiff ) {
00331         rDiff = testDiff;
00332         theBin = i;
00333       }
00334     }
00335   }
00336   return theBin;
00337 }

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

Reimplemented from GeometricSearchDet.

Definition at line 103 of file TIDLayer.cc.

References computeWindowSize(), orderAndMergeLevels(), overlapInR(), ringIndicesByCrossingProximity(), and theComps.

00107 {
00108   vector<int> ringIndices = ringIndicesByCrossingProximity(startingState,prop);
00109   if ( ringIndices.size()!=3 ) {
00110     edm::LogError("TkDetLayers") << "TkRingedForwardLayer::groupedCompatibleDets : ringIndices.size() = "
00111                                  << ringIndices.size() << " and not =3!!" ;
00112     return;
00113   }
00114 
00115   vector<DetGroup> closestResult;
00116   vector<DetGroup> nextResult;
00117   vector<DetGroup> nextNextResult;
00118   vector<vector<DetGroup> > groupsAtRingLevel;
00119 
00120   theComps[ringIndices[0]]->groupedCompatibleDetsV( startingState, prop, est, closestResult);           
00121   if ( closestResult.empty() ){
00122     theComps[ringIndices[1]]->groupedCompatibleDetsV( startingState, prop, est, result); 
00123     return;
00124   }
00125 
00126   groupsAtRingLevel.push_back(closestResult);
00127 
00128   DetGroupElement closestGel( closestResult.front().front());  
00129   float rWindow = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est); 
00130   if(!overlapInR(closestGel.trajectoryState(),ringIndices[1],rWindow)) {
00131     result.swap(closestResult);
00132     return;
00133   };
00134 
00135   nextResult.clear();
00136   theComps[ringIndices[1]]->groupedCompatibleDetsV( startingState, prop, est, nextResult);
00137   if(nextResult.empty()) {
00138     result.swap(closestResult);
00139     return;
00140   }
00141   groupsAtRingLevel.push_back(nextResult);
00142 
00143   if(!overlapInR(closestGel.trajectoryState(),ringIndices[2],rWindow) ) {
00144     //then merge 2 levels & return 
00145     orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel,ringIndices,result);      
00146     return;
00147   }
00148 
00149   theComps[ringIndices[2]]->groupedCompatibleDetsV( startingState, prop, est, nextNextResult);   
00150   if(nextNextResult.empty()) {
00151     // then merge 2 levels and return 
00152     orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel,ringIndices,result);
00153     return;
00154   }
00155 
00156   groupsAtRingLevel.push_back(nextNextResult);
00157   // merge 3 level and return merged   
00158   orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel,ringIndices, result);  
00159 }

static void TIDLayer::orderAndMergeLevels ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const std::vector< std::vector< DetGroup > > &  groups,
const std::vector< int > &  indices,
std::vector< DetGroup > &  result 
) [static, protected]

Referenced by groupedCompatibleDetsV().

bool TIDLayer::overlapInR ( const TrajectoryStateOnSurface tsos,
int  i,
double  ymax 
) const [protected]

Definition at line 342 of file TIDLayer.cc.

References BoundSurface::bounds(), TrajectoryStateOnSurface::globalPosition(), BoundDisk::innerRadius(), max, BoundDisk::outerRadius(), PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::position(), theComps, Bounds::thickness(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by groupedCompatibleDetsV().

00343 {
00344   // assume "fixed theta window", i.e. margin in local y = r is changing linearly with z
00345   float tsRadius = tsos.globalPosition().perp();
00346   float thetamin = ( max(0.,tsRadius-ymax))/(fabs(tsos.globalPosition().z())+10.); // add 10 cm contingency 
00347   float thetamax = ( tsRadius + ymax)/(fabs(tsos.globalPosition().z())-10.);
00348   
00349   const BoundDisk& ringDisk = static_cast<const BoundDisk&>(theComps[index]->surface());
00350   float ringMinZ = fabs( ringDisk.position().z()) - ringDisk.bounds().thickness()/2.;
00351   float ringMaxZ = fabs( ringDisk.position().z()) + ringDisk.bounds().thickness()/2.; 
00352   float thetaRingMin =  ringDisk.innerRadius()/ ringMaxZ;
00353   float thetaRingMax =  ringDisk.outerRadius()/ ringMinZ;
00354 
00355   // do the theta regions overlap ?
00356 
00357   return !( thetamin > thetaRingMax || thetaRingMin > thetamax);
00358 }

vector< int > TIDLayer::ringIndicesByCrossingProximity ( const TrajectoryStateOnSurface startingState,
const Propagator prop 
) const [private, virtual]

Definition at line 163 of file TIDLayer.cc.

References findClosest(), findNextIndex(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), i, Propagator::propagationDirection(), rho, theComps, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

00165 {
00166   typedef HelixForwardPlaneCrossing Crossing; 
00167   typedef MeasurementEstimator::Local2DVector Local2DVector;
00168 
00169   HelixPlaneCrossing::PositionType startPos( startingState.globalPosition());
00170   HelixPlaneCrossing::DirectionType startDir( startingState.globalMomentum());
00171   PropagationDirection propDir( prop.propagationDirection());
00172   float rho( startingState.transverseCurvature());
00173 
00174   // calculate the crossings with the ring surfaces
00175   // rings are assumed to be sorted in R !
00176   
00177   Crossing myXing(  startPos, startDir, rho, propDir );
00178 
00179   GlobalPoint   ringCrossings[3];
00180   // vector<GlobalVector>  ringXDirections;
00181 
00182   for (int i = 0; i < 3 ; i++ ) {
00183     const BoundDisk & theRing  = static_cast<const BoundDisk &>(theComps[i]->surface());
00184     pair<bool,double> pathlen = myXing.pathLength( theRing);
00185     if ( pathlen.first ) { 
00186       ringCrossings[i] = GlobalPoint( myXing.position(pathlen.second ));
00187       // ringXDirections.push_back( GlobalVector( myXing.direction(pathlen.second )));
00188     } else {
00189       // TO FIX.... perhaps there is something smarter to do
00190       //throw DetLayerException("trajectory doesn't cross TID rings");
00191       ringCrossings[i] = GlobalPoint( 0.,0.,0.);
00192       //  ringXDirections.push_back( GlobalVector( 0.,0.,0.));
00193     }
00194   }
00195 
00196   int closestIndex = findClosest(ringCrossings);
00197   int nextIndex    = findNextIndex(ringCrossings,closestIndex);
00198   if ( closestIndex<0 || nextIndex<0 )  return vector<int>();
00199   int nextNextIndex = -1;
00200   for(int i=0; i<3 ; i++){
00201     if(i!= closestIndex && i!=nextIndex) {
00202       nextNextIndex = i;
00203       break;
00204     }
00205   }
00206   
00207   vector<int> indices;
00208   indices.push_back(closestIndex);
00209   indices.push_back(nextIndex);
00210   indices.push_back(nextNextIndex);
00211   return indices;
00212 }

virtual SubDetector TIDLayer::subDetector (  )  const [inline, virtual]

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

Implements DetLayer.

Definition at line 30 of file TIDLayer.h.

References GeomDetEnumerators::TID.

00030 {return GeomDetEnumerators::TID;}


Member Data Documentation

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

Definition at line 65 of file TIDLayer.h.

Referenced by basicComponents().

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

Definition at line 64 of file TIDLayer.h.

Referenced by components(), findClosest(), findNextIndex(), groupedCompatibleDetsV(), overlapInR(), ringIndicesByCrossingProximity(), and ~TIDLayer().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:28 2009 for CMSSW by  doxygen 1.5.4