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 13 of file TrackingRecHitLessFromGlobalPosition.h.

Constructor & Destructor Documentation

◆ TrackingRecHitLessFromGlobalPosition()

TrackingRecHitLessFromGlobalPosition::TrackingRecHitLessFromGlobalPosition ( const TrackingGeometry geometry_,
PropagationDirection  dir = alongMomentum 
)
inline

Definition at line 15 of file TrackingRecHitLessFromGlobalPosition.h.

16  : geometry(geometry_), theDir(dir) {}

Member Function Documentation

◆ barrelForwardLess()

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

Definition at line 66 of file TrackingRecHitLessFromGlobalPosition.cc.

66  {
67  //
68  // for the moment sort again in z, but since the z in the barrel is wrong (it is in the centre of the module)
69  // add the semi length
70  //
71  DetId ida(a.geographicalId());
72  DetId idb(b.geographicalId());
73  return static_cast<unsigned int>(std::abs(geometry->idToDet(ida)->surface().toGlobal(a.localPosition()).z()) * 1E7) <
74  static_cast<unsigned int>(std::abs(geometry->idToDet(idb)->surface().toGlobal(b.localPosition()).z()) * 1E7);
75 }

References a, funct::abs(), b, and z.

Referenced by insideOutLess().

◆ insideOutLess()

bool TrackingRecHitLessFromGlobalPosition::insideOutLess ( const TrackingRecHit a,
const TrackingRecHit b 
) const
private

Definition at line 13 of file TrackingRecHitLessFromGlobalPosition.cc.

13  {
14  DetId ida(a.geographicalId());
15  DetId idb(b.geographicalId());
16 
17  unsigned int idetA = static_cast<unsigned int>(ida.subdetId());
18  unsigned int idetB = static_cast<unsigned int>(idb.subdetId());
19 
20  //check for mixed case...
21  bool same_det = ((idetA == StripSubdetector::TIB && idetB == StripSubdetector::TIB) ||
22  (idetA == StripSubdetector::TID && idetB == StripSubdetector::TID) ||
23  (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TID) ||
24  (idetA == StripSubdetector::TID && idetB == StripSubdetector::TIB) ||
25 
26  (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TOB) ||
27  (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TEC) ||
28  (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TEC) ||
29  (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TOB) ||
30 
35 
36  if (!same_det)
37  return (idetA < idetB);
38 
39  if ((idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
41  return static_cast<unsigned int>(geometry->idToDet(ida)->surface().toGlobal(a.localPosition()).perp() * 1E7) <
42  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()) *
48  1E7) <
49  static_cast<unsigned int>(std::abs(geometry->idToDet(idb)->surface().toGlobal(b.localPosition()).z()) * 1E7);
50  }
51 
52  //
53  // here I have 1 barrel against one forward
54  //
55 
56  if ((idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
58  return barrelForwardLess(a, b);
59  } else {
60  return !barrelForwardLess(b, a);
61  }
62 
63  throw cms::Exception("TrackingRecHitLessFromGlobalPosition", "Arguments are not Ok");
64 }

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

Referenced by operator()().

◆ operator()()

bool TrackingRecHitLessFromGlobalPosition::operator() ( const TrackingRecHit a,
const TrackingRecHit b 
) const
inline

Definition at line 18 of file TrackingRecHitLessFromGlobalPosition.h.

18  {
19  if (theDir == alongMomentum)
20  return insideOutLess(a, b);
21  else
22  return insideOutLess(b, a);
23  }

References a, alongMomentum, b, insideOutLess(), and theDir.

Member Data Documentation

◆ geometry

const TrackingGeometry* TrackingRecHitLessFromGlobalPosition::geometry
private

Definition at line 30 of file TrackingRecHitLessFromGlobalPosition.h.

◆ theDir

PropagationDirection TrackingRecHitLessFromGlobalPosition::theDir
private

Definition at line 31 of file TrackingRecHitLessFromGlobalPosition.h.

Referenced by operator()().

PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
geometry
Definition: geometry.py:1
perp
T perp() const
Magnitude of transverse component.
Definition: Basic3DVectorLD.h:133
DetId
Definition: DetId.h:17
DDAxes::z
TrackingRecHitLessFromGlobalPosition::insideOutLess
bool insideOutLess(const TrackingRecHit &a, const TrackingRecHit &b) const
Definition: TrackingRecHitLessFromGlobalPosition.cc:13
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
b
double b
Definition: hdecay.h:118
TrackingRecHitLessFromGlobalPosition::theDir
PropagationDirection theDir
Definition: TrackingRecHitLessFromGlobalPosition.h:31
a
double a
Definition: hdecay.h:119
TrackingRecHitLessFromGlobalPosition::barrelForwardLess
bool barrelForwardLess(const TrackingRecHit &a, const TrackingRecHit &b) const
Definition: TrackingRecHitLessFromGlobalPosition.cc:66
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
Exception
Definition: hltDiff.cc:246
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
alongMomentum
Definition: PropagationDirection.h:4
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
TrackingRecHitLessFromGlobalPosition::geometry
const TrackingGeometry * geometry
Definition: TrackingRecHitLessFromGlobalPosition.h:30
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23