CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SortHitPointersByGlobalPosition Class Reference

#include <RoadSearchHitSorting.h>

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.

57  :
58  geometry(geometry_), theDir(dir){}
const TrackingGeometry * geometry
dbl *** dir
Definition: mlp_gen.cc:35

Member Function Documentation

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

Definition at line 136 of file RoadSearchHitSorting.cc.

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

Referenced by insideOutLess().

136  {
137  //
138  // for the moment sort again in z, but since the z in the barrel is wrong (it is in the centre of the module)
139  // add the semi length
140  //
141  DetId ida(a->geographicalId());
142  DetId idb(b->geographicalId());
143  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);
144 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
const TrackingGeometry * geometry
#define abs(x)
Definition: mlp_lapack.h:159
double double double z
Definition: DetId.h:20
virtual const GeomDet * idToDet(DetId) const =0
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
bool SortHitPointersByGlobalPosition::insideOutLess ( const TrackingRecHit a,
const TrackingRecHit b 
) const
private

Definition at line 85 of file RoadSearchHitSorting.cc.

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

Referenced by operator()().

85  {
86 
87  DetId ida(a->geographicalId());
88  DetId idb(b->geographicalId());
89 
90  unsigned int idetA = static_cast<unsigned int>(ida.subdetId());
91  unsigned int idetB = static_cast<unsigned int>(idb.subdetId());
92 
93  //check for mixed case...
94  bool same_det = (
95  (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TIB) ||
96  (idetA == StripSubdetector::TID && idetB == StripSubdetector::TID) ||
97  (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TID) ||
98  (idetA == StripSubdetector::TID && idetB == StripSubdetector::TIB) ||
99 
100  (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TOB) ||
101  (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TEC) ||
102  (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TEC) ||
103  (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TOB) ||
104 
109 
110  if (!same_det) return (idetA < idetB);
111 
112  if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
113  (idetB == StripSubdetector::TIB || idetB == StripSubdetector::TOB || idetB == PixelSubdetector::PixelBarrel)) {
114  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);
115  }
116 
117  if( (idetA == StripSubdetector::TEC || idetA == StripSubdetector::TID || idetA == PixelSubdetector::PixelEndcap) &&
118  (idetB == StripSubdetector::TEC || idetB == StripSubdetector::TID || idetB == PixelSubdetector::PixelEndcap)) {
119  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);
120  }
121 
122  //
123  // here I have 1 barrel against one forward
124  //
125 
126  if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
128  return barrelForwardLess( a, b);
129  }else{
130  return !barrelForwardLess( b, a);
131  }
132 
133  throw Genexception("SortHitPointersByGlobalPosition: arguments are not Ok");
134 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
const TrackingGeometry * geometry
bool barrelForwardLess(const TrackingRecHit *a, const TrackingRecHit *b) const
#define abs(x)
Definition: mlp_lapack.h:159
double double double z
Definition: DetId.h:20
virtual const GeomDet * idToDet(DetId) const =0
T perp() const
Magnitude of transverse component.
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
bool SortHitPointersByGlobalPosition::operator() ( const TrackingRecHit a,
const TrackingRecHit b 
) const
inline

Definition at line 61 of file RoadSearchHitSorting.h.

References alongMomentum, insideOutLess(), and theDir.

61  {
62  if (theDir == alongMomentum) return insideOutLess( a, b);
63  else return insideOutLess( b, a);
64  }
bool insideOutLess(const TrackingRecHit *a, const TrackingRecHit *b) const

Member Data Documentation

const TrackingGeometry* SortHitPointersByGlobalPosition::geometry
private
PropagationDirection SortHitPointersByGlobalPosition::theDir
private

Definition at line 73 of file RoadSearchHitSorting.h.

Referenced by operator()().