CMS 3D CMS Logo

SortHitPointersByGlobalPosition Class Reference

#include <TrackingTools/RoadSearchHitAccess/interface/RoadSearchHitSorting.h>

List of all members.

Public Member Functions

bool operator() (const TrackingRecHit *a, const TrackingRecHit *b) const
 SortHitPointersByGlobalPosition (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

Definition at line 53 of file RoadSearchHitSorting.h.


Constructor & Destructor Documentation

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

Definition at line 56 of file RoadSearchHitSorting.h.

00057                                                                       :
00058     geometry(geometry_), theDir(dir){}
  


Member Function Documentation

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

Definition at line 136 of file RoadSearchHitSorting.cc.

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

Referenced by insideOutLess().

00136                                                                                                                {
00137   //
00138   // for the moment sort again in z, but since the z in the barrel is wrong (it is in the centre of the module)
00139   // add the semi length
00140   //
00141   DetId ida(a->geographicalId());
00142   DetId idb(b->geographicalId());
00143   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);
00144 }

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

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

00085                                                                                                            {
00086   
00087   DetId ida(a->geographicalId());
00088   DetId idb(b->geographicalId());
00089 
00090   unsigned int idetA = static_cast<unsigned int>(ida.subdetId());
00091   unsigned int idetB = static_cast<unsigned int>(idb.subdetId());
00092 
00093   //check for mixed case...
00094   bool same_det = ( 
00095                    (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TIB) ||
00096                    (idetA == StripSubdetector::TID && idetB == StripSubdetector::TID) ||
00097                    (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TID) ||
00098                    (idetA == StripSubdetector::TID && idetB == StripSubdetector::TIB) ||
00099 
00100                    (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TOB) ||
00101                    (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TEC) ||
00102                    (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TEC) ||
00103                    (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TOB) ||
00104 
00105                    (idetA == PixelSubdetector::PixelBarrel && idetB == PixelSubdetector::PixelBarrel) ||
00106                    (idetA == PixelSubdetector::PixelEndcap && idetB == PixelSubdetector::PixelEndcap) ||
00107                    (idetA == PixelSubdetector::PixelBarrel && idetB == PixelSubdetector::PixelEndcap) ||
00108                    (idetA == PixelSubdetector::PixelEndcap && idetB == PixelSubdetector::PixelBarrel) );
00109 
00110   if (!same_det) return (idetA < idetB);
00111 
00112   if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
00113       (idetB == StripSubdetector::TIB || idetB == StripSubdetector::TOB || idetB == PixelSubdetector::PixelBarrel)) {  
00114     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);
00115   }
00116   
00117   if( (idetA == StripSubdetector::TEC || idetA == StripSubdetector::TID || idetA == PixelSubdetector::PixelEndcap) &&
00118       (idetB == StripSubdetector::TEC || idetB == StripSubdetector::TID || idetB == PixelSubdetector::PixelEndcap)) {  
00119     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);
00120   }
00121   
00122   //
00123   //  here I have 1 barrel against one forward
00124   //
00125   
00126   if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
00127       (idetB == StripSubdetector::TEC || idetB == StripSubdetector::TID || idetB == PixelSubdetector::PixelEndcap)) {
00128     return barrelForwardLess( a, b);
00129   }else{
00130     return !barrelForwardLess( b, a);
00131   }
00132   
00133   throw Genexception("SortHitPointersByGlobalPosition: arguments are not Ok");
00134 }

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

Definition at line 61 of file RoadSearchHitSorting.h.

References alongMomentum, insideOutLess(), and theDir.

00061                                                                            {
00062     if (theDir == alongMomentum) return insideOutLess( a, b);
00063     else return insideOutLess( b, a);
00064   }


Member Data Documentation

const TrackingGeometry* SortHitPointersByGlobalPosition::geometry [private]

Definition at line 72 of file RoadSearchHitSorting.h.

Referenced by barrelForwardLess(), and insideOutLess().

PropagationDirection SortHitPointersByGlobalPosition::theDir [private]

Definition at line 73 of file RoadSearchHitSorting.h.

Referenced by operator()().


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