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

#include <TrackingRecHitLessFromGlobalPosition.h>

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.

18  :
19  geometry(geometry_), theDir(dir){ }
dbl *** dir
Definition: mlp_gen.cc:35

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().

58  {
59  //
60  // for the moment sort again in z, but since the z in the barrel is wrong (it is in the centre of the module)
61  // add the semi length
62  //
63  DetId ida(a.geographicalId());
64  DetId idb(b.geographicalId());
65  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);
66 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:18
virtual const GeomDet * idToDet(DetId) const =0
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
bool TrackingRecHitLessFromGlobalPosition::insideOutLess ( const TrackingRecHit a,
const TrackingRecHit b 
) const
private

Definition at line 7 of file TrackingRecHitLessFromGlobalPosition.cc.

References funct::abs(), barrelForwardLess(), Exception, 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()().

7  {
8 
9  DetId ida(a.geographicalId());
10  DetId idb(b.geographicalId());
11 
12  unsigned int idetA = static_cast<unsigned int>(ida.subdetId());
13  unsigned int idetB = static_cast<unsigned int>(idb.subdetId());
14 
15  //check for mixed case...
16  bool same_det = (
17  (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TIB) ||
18  (idetA == StripSubdetector::TID && idetB == StripSubdetector::TID) ||
19  (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TID) ||
20  (idetA == StripSubdetector::TID && idetB == StripSubdetector::TIB) ||
21 
22  (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TOB) ||
23  (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TEC) ||
24  (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TEC) ||
25  (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TOB) ||
26 
31 
32  if (!same_det) return (idetA < idetB);
33 
34  if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
36  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);
37  }
38 
39  if( (idetA == StripSubdetector::TEC || idetA == StripSubdetector::TID || idetA == PixelSubdetector::PixelEndcap) &&
41  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);
42  }
43 
44  //
45  // here I have 1 barrel against one forward
46  //
47 
48  if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
50  return barrelForwardLess( a, b);
51  }else{
52  return !barrelForwardLess( b, a);
53  }
54 
55  throw cms::Exception("TrackingRecHitLessFromGlobalPosition", "Arguments are not Ok");
56 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
bool barrelForwardLess(const TrackingRecHit &a, const TrackingRecHit &b) const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:18
virtual const GeomDet * idToDet(DetId) const =0
T perp() const
Magnitude of transverse component.
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
bool TrackingRecHitLessFromGlobalPosition::operator() ( const TrackingRecHit a,
const TrackingRecHit b 
) const
inline

Definition at line 22 of file TrackingRecHitLessFromGlobalPosition.h.

References alongMomentum, insideOutLess(), and theDir.

22  {
23  if (theDir == alongMomentum) return insideOutLess( a, b);
24  else return insideOutLess( b, a);
25  }
bool insideOutLess(const TrackingRecHit &a, const TrackingRecHit &b) const

Member Data Documentation

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

Definition at line 35 of file TrackingRecHitLessFromGlobalPosition.h.

Referenced by operator()().