CMS 3D CMS Logo

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 64 of file TrackingRecHitLessFromGlobalPosition.cc.

References funct::abs(), TrackingRecHit::geographicalId(), TrackingRecHit::localPosition(), and z.

Referenced by insideOutLess(), and operator()().

64  {
65  //
66  // for the moment sort again in z, but since the z in the barrel is wrong (it is in the centre of the module)
67  // add the semi length
68  //
69  DetId ida(a.geographicalId());
70  DetId idb(b.geographicalId());
71  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);
72 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual LocalPoint localPosition() const =0
Definition: DetId.h:18
DetId geographicalId() const
bool TrackingRecHitLessFromGlobalPosition::insideOutLess ( const TrackingRecHit a,
const TrackingRecHit b 
) const
private

Definition at line 13 of file TrackingRecHitLessFromGlobalPosition.cc.

References funct::abs(), barrelForwardLess(), Exception, TrackingRecHit::geographicalId(), TrackingRecHit::localPosition(), perp(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, and z.

Referenced by operator()().

13  {
14 
15  DetId ida(a.geographicalId());
16  DetId idb(b.geographicalId());
17 
18  unsigned int idetA = static_cast<unsigned int>(ida.subdetId());
19  unsigned int idetB = static_cast<unsigned int>(idb.subdetId());
20 
21  //check for mixed case...
22  bool same_det = (
23  (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TIB) ||
24  (idetA == StripSubdetector::TID && idetB == StripSubdetector::TID) ||
25  (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TID) ||
26  (idetA == StripSubdetector::TID && idetB == StripSubdetector::TIB) ||
27 
28  (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TOB) ||
29  (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TEC) ||
30  (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TEC) ||
31  (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TOB) ||
32 
37 
38  if (!same_det) return (idetA < idetB);
39 
40  if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
42  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);
43  }
44 
45  if( (idetA == StripSubdetector::TEC || idetA == StripSubdetector::TID || idetA == PixelSubdetector::PixelEndcap) &&
47  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);
48  }
49 
50  //
51  // here I have 1 barrel against one forward
52  //
53 
54  if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
56  return barrelForwardLess( a, b);
57  }else{
58  return !barrelForwardLess( b, a);
59  }
60 
61  throw cms::Exception("TrackingRecHitLessFromGlobalPosition", "Arguments are not Ok");
62 }
bool barrelForwardLess(const TrackingRecHit &a, const TrackingRecHit &b) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual LocalPoint localPosition() const =0
Definition: DetId.h:18
T perp() const
Magnitude of transverse component.
DetId geographicalId() const
bool TrackingRecHitLessFromGlobalPosition::operator() ( const TrackingRecHit a,
const TrackingRecHit b 
) const
inline

Definition at line 22 of file TrackingRecHitLessFromGlobalPosition.h.

References a, alongMomentum, b, barrelForwardLess(), 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()().