CMS 3D CMS Logo

TrackingRecHitLessFromGlobalPosition Class Reference

Defines order of layers in the Tracker as seen by straight tracks coming from the interaction region. More...

#include <RecoTracker/TrackProducer/interface/TrackingRecHitLessFromGlobalPosition.h>

List of all members.

Public Member Functions

bool operator() (const TrackingRecHit &a, const TrackingRecHit &b) const
 TrackingRecHitLessFromGlobalPosition (const TrackingGeometry *geometry_, PropagationDirection dir=alongMomentum)

Private Member Functions

bool barrelForwardLess (const TrackingRecHit &a, const TrackingRecHit &b) const
bool insideOutLess (const TrackingRecHit &a, const TrackingRecHit &b) const

Private Attributes

const TrackingGeometrygeometry
PropagationDirection theDir


Detailed Description

Defines order of layers in the Tracker as seen by straight tracks coming from the interaction region.

Definition at line 15 of file TrackingRecHitLessFromGlobalPosition.h.


Constructor & Destructor Documentation

TrackingRecHitLessFromGlobalPosition::TrackingRecHitLessFromGlobalPosition ( const TrackingGeometry geometry_,
PropagationDirection  dir = alongMomentum 
) [inline]

Definition at line 18 of file TrackingRecHitLessFromGlobalPosition.h.

00018                                                                                                                       :
00019     geometry(geometry_), theDir(dir){  }
  


Member Function Documentation

bool TrackingRecHitLessFromGlobalPosition::barrelForwardLess ( const TrackingRecHit a,
const TrackingRecHit b 
) const [private]

Definition at line 58 of file TrackingRecHitLessFromGlobalPosition.cc.

References funct::abs(), TrackingRecHit::geographicalId(), geometry, TrackingGeometry::idToDet(), TrackingRecHit::localPosition(), GeomDet::surface(), Surface::toGlobal(), and z.

Referenced by insideOutLess().

00058                                                                                                                     {
00059   //
00060   // for the moment sort again in z, but since the z in the barrel is wrong (it is in the centre of the module)
00061   // add the semi length
00062   //
00063   DetId ida(a.geographicalId());
00064   DetId idb(b.geographicalId());
00065   return  static_cast<unsigned int>(std::abs( geometry->idToDet(ida)->surface().toGlobal(a.localPosition()).z()) * 1E7) < static_cast<unsigned int>(std::abs( geometry->idToDet(idb)->surface().toGlobal(b.localPosition()).z()) * 1E7);
00066 }

bool TrackingRecHitLessFromGlobalPosition::insideOutLess ( const TrackingRecHit a,
const TrackingRecHit b 
) const [private]

Definition at line 7 of file TrackingRecHitLessFromGlobalPosition.cc.

References funct::abs(), barrelForwardLess(), TrackingRecHit::geographicalId(), geometry, TrackingGeometry::idToDet(), TrackingRecHit::localPosition(), muonGeometry::perp(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, GeomDet::surface(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, Surface::toGlobal(), and z.

Referenced by operator()().

00007                                                                                                                 {
00008   
00009   DetId ida(a.geographicalId());
00010   DetId idb(b.geographicalId());
00011 
00012   unsigned int idetA = static_cast<unsigned int>(ida.subdetId());
00013   unsigned int idetB = static_cast<unsigned int>(idb.subdetId());
00014 
00015   //check for mixed case...
00016   bool same_det = ( 
00017                    (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TIB) ||
00018                    (idetA == StripSubdetector::TID && idetB == StripSubdetector::TID) ||
00019                    (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TID) ||
00020                    (idetA == StripSubdetector::TID && idetB == StripSubdetector::TIB) ||
00021 
00022                    (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TOB) ||
00023                    (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TEC) ||
00024                    (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TEC) ||
00025                    (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TOB) ||
00026 
00027                    (idetA == PixelSubdetector::PixelBarrel && idetB == PixelSubdetector::PixelBarrel) ||
00028                    (idetA == PixelSubdetector::PixelEndcap && idetB == PixelSubdetector::PixelEndcap) ||
00029                    (idetA == PixelSubdetector::PixelBarrel && idetB == PixelSubdetector::PixelEndcap) ||
00030                    (idetA == PixelSubdetector::PixelEndcap && idetB == PixelSubdetector::PixelBarrel) );
00031 
00032   if (!same_det) return (idetA < idetB);
00033 
00034   if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
00035       (idetB == StripSubdetector::TIB || idetB == StripSubdetector::TOB || idetB == PixelSubdetector::PixelBarrel)) {  
00036     return  static_cast<unsigned int>(geometry->idToDet(ida)->surface().toGlobal(a.localPosition()).perp() * 1E7) < static_cast<unsigned int>(geometry->idToDet(idb)->surface().toGlobal(b.localPosition()).perp() * 1E7);
00037   }
00038   
00039   if( (idetA == StripSubdetector::TEC || idetA == StripSubdetector::TID || idetA == PixelSubdetector::PixelEndcap) &&
00040       (idetB == StripSubdetector::TEC || idetB == StripSubdetector::TID || idetB == PixelSubdetector::PixelEndcap)) {  
00041     return static_cast<unsigned int>(std::abs(geometry->idToDet(ida)->surface().toGlobal(a.localPosition()).z()) * 1E7) < static_cast<unsigned int>(std::abs(geometry->idToDet(idb)->surface().toGlobal(b.localPosition()).z()) * 1E7);
00042   }
00043   
00044   //
00045   //  here I have 1 barrel against one forward
00046   //
00047   
00048   if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
00049       (idetB == StripSubdetector::TEC || idetB == StripSubdetector::TID || idetB == PixelSubdetector::PixelEndcap)) {
00050     return barrelForwardLess( a, b);
00051   }else{
00052     return !barrelForwardLess( b, a);
00053   }
00054   
00055   throw Genexception("TrackingRecHitLessFromGlobalPosition: arguments are not Ok");
00056 }

bool TrackingRecHitLessFromGlobalPosition::operator() ( const TrackingRecHit a,
const TrackingRecHit b 
) const [inline]

Definition at line 22 of file TrackingRecHitLessFromGlobalPosition.h.

References alongMomentum, insideOutLess(), and theDir.

00022                                                                            {
00023     if (theDir == alongMomentum) return insideOutLess( a, b);
00024     else return insideOutLess( b, a);
00025   }


Member Data Documentation

const TrackingGeometry* TrackingRecHitLessFromGlobalPosition::geometry [private]

Definition at line 34 of file TrackingRecHitLessFromGlobalPosition.h.

Referenced by barrelForwardLess(), and insideOutLess().

PropagationDirection TrackingRecHitLessFromGlobalPosition::theDir [private]

Definition at line 35 of file TrackingRecHitLessFromGlobalPosition.h.

Referenced by operator()().


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