ATLAS Offline Software
Public Types | Public Member Functions | List of all members
GXF::LayerSort Class Reference

#include <LayerSort.h>

Collaboration diagram for GXF::LayerSort:

Public Types

typedef std::pair< const Trk::Layer *, const Trk::Layer * > LayerPtrPair
 

Public Member Functions

bool operator() (const LayerPtrPair &one, const LayerPtrPair &two) const
 

Detailed Description

Definition at line 11 of file LayerSort.h.

Member Typedef Documentation

◆ LayerPtrPair

Definition at line 13 of file LayerSort.h.

Member Function Documentation

◆ operator()()

bool GXF::LayerSort::operator() ( const LayerPtrPair one,
const LayerPtrPair two 
) const

Definition at line 23 of file LayerSort.cxx.

23  {
24  auto castToCylinder = [](const LayerPtrPair & pair)->const Trk::CylinderSurface* {
25  if (pair.first) return (const CylinderSurface *) &pair.first->surfaceRepresentation();
26  else return nullptr;
27  };
28  auto castToDisc = [](const LayerPtrPair & pair)->const Trk::DiscSurface* {
29  if (pair.second) return (const DiscSurface *) &pair.second->surfaceRepresentation();
30  else return nullptr;
31  };
32  const CylinderSurface *cyl1 = castToCylinder(one);
33  const DiscSurface *disc1 = castToDisc(one);
34  const CylinderSurface *cyl2 = castToCylinder(two);
35  const DiscSurface *disc2 = castToDisc(two);
36 
37  if (cyl1 and cyl2) {
38  if (std::abs(cyl1->center().z() - cyl2->center().z()) > 1.) {
39  return (std::abs(cyl1->center().z()) < std::abs(cyl2->center().z()));
40  }
41  return (cyl1->bounds().r() < cyl2->bounds().r());
42  }
43  if (disc1 and disc2) {
44  const DiscBounds *discbounds1 = (const DiscBounds *) &disc1->bounds();
45  const DiscBounds *discbounds2 = (const DiscBounds *) &disc2->bounds();
46  if (discbounds1->rMax() < discbounds2->rMin() + 1) {
47  return true;
48  }
49  if (discbounds1->rMin() > discbounds2->rMax() - 1) {
50  return false;
51  }
52  return (std::abs(disc1->center().z()) < std::abs(disc2->center().z()));
53  }
54 
55  if ((cyl1 != nullptr) && (disc2 != nullptr)) {
56  const DiscBounds *discbounds = (const DiscBounds *) &disc2->bounds();
57  if (cyl1->bounds().r() > discbounds->rMax() - 1) {
58  return false;
59  }
60  if (cyl1->bounds().r() < discbounds->rMin() + 1) {
61  return true;
62  }
63  return (std::abs(cyl1->center().z()) < std::abs(disc2->center().z()));
64  }
65 
66  if ((disc1 == nullptr) || (cyl2 == nullptr)) {
67  throw std::logic_error("Unhandled surface combination.");
68  }
69 
70  const DiscBounds *discbounds = (const DiscBounds *) &disc1->bounds();
71 
72  if (cyl2->bounds().r() > discbounds->rMax() - 1) {
73  return true;
74  }
75 
76  if (cyl2->bounds().r() < discbounds->rMin() + 1) {
77  return false;
78  }
79 
80  return (std::abs(cyl2->center().z()) > std::abs(disc1->center().z()));
81  }

The documentation for this class was generated from the following files:
Trk::one
@ one
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:22
Trk::DiscSurface
Definition: DiscSurface.h:54
Trk::two
@ two
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:23
Trk::CylinderSurface
Definition: CylinderSurface.h:55
GXF::LayerSort::LayerPtrPair
std::pair< const Trk::Layer *, const Trk::Layer * > LayerPtrPair
Definition: LayerSort.h:13