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
SortHitsByGlobalPosition Class Reference

#include <RoadSearchHitSorting.h>

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.

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

Member Function Documentation

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

Definition at line 75 of file RoadSearchHitSorting.cc.

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

Referenced by insideOutLess().

75  {
76  //
77  // for the moment sort again in z, but since the z in the barrel is wrong (it is in the centre of the module)
78  // add the semi length
79  //
80  DetId ida(a.geographicalId());
81  DetId idb(b.geographicalId());
82  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);
83 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
#define abs(x)
Definition: mlp_lapack.h:159
Definition: DDAxes.h:10
const TrackingGeometry * geometry
Definition: DetId.h:20
virtual const GeomDet * idToDet(DetId) const =0
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
bool SortHitsByGlobalPosition::insideOutLess ( const TrackingRecHit a,
const TrackingRecHit b 
) const
private

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

Referenced by operator()().

24  {
25 
26  DetId ida(a.geographicalId());
27  DetId idb(b.geographicalId());
28 
29  unsigned int idetA = static_cast<unsigned int>(ida.subdetId());
30  unsigned int idetB = static_cast<unsigned int>(idb.subdetId());
31 
32  //check for mixed case...
33  bool same_det = (
34  (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TIB) ||
35  (idetA == StripSubdetector::TID && idetB == StripSubdetector::TID) ||
36  (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TID) ||
37  (idetA == StripSubdetector::TID && idetB == StripSubdetector::TIB) ||
38 
39  (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TOB) ||
40  (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TEC) ||
41  (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TEC) ||
42  (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TOB) ||
43 
48 
49  if (!same_det) return (idetA < idetB);
50 
51  if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
53  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);
54  }
55 
56  if( (idetA == StripSubdetector::TEC || idetA == StripSubdetector::TID || idetA == PixelSubdetector::PixelEndcap) &&
58  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);
59  }
60 
61  //
62  // here I have 1 barrel against one forward
63  //
64 
65  if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
67  return barrelForwardLess( a, b);
68  }else{
69  return !barrelForwardLess( b, a);
70  }
71 
72  throw Genexception("SortHitsByGlobalPosition: arguments are not Ok");
73 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
T perp() const
Magnitude of transverse component.
#define abs(x)
Definition: mlp_lapack.h:159
Definition: DDAxes.h:10
const TrackingGeometry * geometry
Definition: DetId.h:20
virtual const GeomDet * idToDet(DetId) const =0
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
bool barrelForwardLess(const TrackingRecHit &a, const TrackingRecHit &b) const
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
bool SortHitsByGlobalPosition::operator() ( const TrackingRecHit a,
const TrackingRecHit b 
) const
inline

Definition at line 38 of file RoadSearchHitSorting.h.

References alongMomentum, insideOutLess(), and theDir.

38  {
39  if (theDir == alongMomentum) return insideOutLess( a, b);
40  else return insideOutLess( b, a);
41  }
bool insideOutLess(const TrackingRecHit &a, const TrackingRecHit &b) const
PropagationDirection theDir

Member Data Documentation

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

Definition at line 50 of file RoadSearchHitSorting.h.

Referenced by operator()().