CMS 3D CMS Logo

SortHitsByGlobalPosition Class Reference

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

List of all members.

Public Member Functions

bool operator() (const TrackingRecHit &a, const TrackingRecHit &b) const
 SortHitsByGlobalPosition (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 30 of file RoadSearchHitSorting.h.


Constructor & Destructor Documentation

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

Definition at line 33 of file RoadSearchHitSorting.h.

00034                                                                       :
00035     geometry(geometry_), theDir(dir){}
  


Member Function Documentation

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

Definition at line 75 of file RoadSearchHitSorting.cc.

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

Referenced by insideOutLess().

00075                                                                                                         {
00076   //
00077   // for the moment sort again in z, but since the z in the barrel is wrong (it is in the centre of the module)
00078   // add the semi length
00079   //
00080   DetId ida(a.geographicalId());
00081   DetId idb(b.geographicalId());
00082   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);
00083 }

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

Definition at line 24 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()().

00024                                                                                                     {
00025   
00026   DetId ida(a.geographicalId());
00027   DetId idb(b.geographicalId());
00028 
00029   unsigned int idetA = static_cast<unsigned int>(ida.subdetId());
00030   unsigned int idetB = static_cast<unsigned int>(idb.subdetId());
00031 
00032   //check for mixed case...
00033   bool same_det = ( 
00034                    (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TIB) ||
00035                    (idetA == StripSubdetector::TID && idetB == StripSubdetector::TID) ||
00036                    (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TID) ||
00037                    (idetA == StripSubdetector::TID && idetB == StripSubdetector::TIB) ||
00038 
00039                    (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TOB) ||
00040                    (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TEC) ||
00041                    (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TEC) ||
00042                    (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TOB) ||
00043 
00044                    (idetA == PixelSubdetector::PixelBarrel && idetB == PixelSubdetector::PixelBarrel) ||
00045                    (idetA == PixelSubdetector::PixelEndcap && idetB == PixelSubdetector::PixelEndcap) ||
00046                    (idetA == PixelSubdetector::PixelBarrel && idetB == PixelSubdetector::PixelEndcap) ||
00047                    (idetA == PixelSubdetector::PixelEndcap && idetB == PixelSubdetector::PixelBarrel) );
00048 
00049   if (!same_det) return (idetA < idetB);
00050 
00051   if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
00052       (idetB == StripSubdetector::TIB || idetB == StripSubdetector::TOB || idetB == PixelSubdetector::PixelBarrel)) {  
00053     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);
00054   }
00055   
00056   if( (idetA == StripSubdetector::TEC || idetA == StripSubdetector::TID || idetA == PixelSubdetector::PixelEndcap) &&
00057       (idetB == StripSubdetector::TEC || idetB == StripSubdetector::TID || idetB == PixelSubdetector::PixelEndcap)) {  
00058     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);
00059   }
00060   
00061   //
00062   //  here I have 1 barrel against one forward
00063   //
00064   
00065   if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
00066       (idetB == StripSubdetector::TEC || idetB == StripSubdetector::TID || idetB == PixelSubdetector::PixelEndcap)) {
00067     return barrelForwardLess( a, b);
00068   }else{
00069     return !barrelForwardLess( b, a);
00070   }
00071   
00072   throw Genexception("SortHitsByGlobalPosition: arguments are not Ok");
00073 }

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

Definition at line 38 of file RoadSearchHitSorting.h.

References alongMomentum, insideOutLess(), and theDir.

00038                                                                            {
00039     if (theDir == alongMomentum) return insideOutLess( a, b);
00040     else return insideOutLess( b, a);
00041   }


Member Data Documentation

const TrackingGeometry* SortHitsByGlobalPosition::geometry [private]

Definition at line 49 of file RoadSearchHitSorting.h.

Referenced by barrelForwardLess(), and insideOutLess().

PropagationDirection SortHitsByGlobalPosition::theDir [private]

Definition at line 50 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