ATLAS Offline Software
StraightLineSurface.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 namespace Trk {
5 
6 inline bool StraightLineSurface::operator==(const StraightLineSurface& slsf) const
7 {
8  if(this == &slsf){
9  return true;
10  }
11  bool transfEqual(transform().isApprox(slsf.transform(), 10e-8));
12  bool centerEqual = (transfEqual) ? (center() == slsf.center()) : false;
13  bool boundsEqual = (centerEqual) ? (bounds() == slsf.bounds()) : false;
14  return boundsEqual;
15 }
16 
17 /** Return the surface type */
18 inline constexpr SurfaceType
19 StraightLineSurface::type() const
20 {
21  return StraightLineSurface::staticType;
22 }
23 
24 template<int DIM, class T>
25 std::unique_ptr<ParametersT<DIM, T, StraightLineSurface>>
26 StraightLineSurface::createUniqueParameters(
27  double l1,
28  double l2,
29  double phi,
30  double theta,
31  double qop,
32  std::optional<AmgSymMatrix(DIM)> cov) const
33 {
34  return std::make_unique<ParametersT<DIM, T, StraightLineSurface>>(
35  l1, l2, phi, theta, qop, *this, std::move(cov));
36 }
37 
38 /** Use the Surface as a ParametersBase constructor, from global parameters */
39 template<int DIM, class T>
40 std::unique_ptr<ParametersT<DIM, T, StraightLineSurface>>
41 StraightLineSurface::createUniqueParameters(
42  const Amg::Vector3D& position,
43  const Amg::Vector3D& momentum,
44  double charge,
45  std::optional<AmgSymMatrix(DIM)> cov) const
46 {
47  return std::make_unique<ParametersT<DIM, T, StraightLineSurface>>(
48  position, momentum, charge, *this, std::move(cov));
49 }
50 
51 inline StraightLineSurface*
52 StraightLineSurface::clone() const
53 {
54  return new StraightLineSurface(*this);
55 }
56 
57 inline const SurfaceBounds&
58 StraightLineSurface::bounds() const
59 {
60  if (m_bounds.get())
61  return *(m_bounds.get());
62  if (Surface::m_associatedDetElement &&
63  Surface::m_associatedDetElementId.is_valid()) {
64  return m_associatedDetElement->bounds(Surface::m_associatedDetElementId);
65  }
66  if (Surface::m_associatedDetElement)
67  return m_associatedDetElement->bounds();
68  return s_boundless;
69 }
70 
71 inline bool
72 StraightLineSurface::insideBounds(const Amg::Vector2D& locpos,
73  double tol1,
74  double tol2) const
75 {
76  if (!(m_bounds.get()) && !Surface::m_associatedDetElement)
77  return true;
78  return (std::abs(locpos[locR]) < bounds().r() + tol1 &&
79  bounds().insideLoc2(locpos, tol2));
80 }
81 
82 inline bool
83 StraightLineSurface::insideBoundsCheck(const Amg::Vector2D& locpos,
84  const BoundaryCheck& bchk) const
85 {
86  return StraightLineSurface::insideBounds(
87  locpos, bchk.toleranceLoc1, bchk.toleranceLoc2);
88 }
89 
90 inline const Amg::Vector3D&
91 StraightLineSurface::lineDirection() const
92 {
93  if (!m_lineDirection.isValid()) {
94  m_lineDirection.set(transform().rotation().col(2));
95  }
96  return *(m_lineDirection.ptr());
97 }
98 
99 /** the pathCorrection for derived classes with thickness */
100 inline double
101 StraightLineSurface::pathCorrection(const Amg::Vector3D&,
102  const Amg::Vector3D&) const
103 {
104  return 1.;
105 }
106 
107 /** Return properly formatted class name for screen output */
108 inline std::string
109 StraightLineSurface::name() const
110 {
111  return "Trk::StraightLineSurface";
112 }
113 
114 }