ATLAS Offline Software
Loading...
Searching...
No Matches
StraightLineSurface.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4namespace Trk {
5
6inline 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 */
18inline constexpr SurfaceType
19StraightLineSurface::type() const
20{
21 return StraightLineSurface::staticType;
22}
23
24template<int DIM, class T>
25std::unique_ptr<ParametersT<DIM, T, StraightLineSurface>>
26StraightLineSurface::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 */
39template<int DIM, class T>
40std::unique_ptr<ParametersT<DIM, T, StraightLineSurface>>
41StraightLineSurface::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
51inline StraightLineSurface*
52StraightLineSurface::clone() const
53{
54 return new StraightLineSurface(*this);
55}
56
57inline const SurfaceBounds&
58StraightLineSurface::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
71inline bool
72StraightLineSurface::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
82inline bool
83StraightLineSurface::insideBoundsCheck(const Amg::Vector2D& locpos,
84 const BoundaryCheck& bchk) const
85{
86 return StraightLineSurface::insideBounds(
87 locpos, bchk.toleranceLoc1, bchk.toleranceLoc2);
88}
89
90inline const Amg::Vector3D&
91StraightLineSurface::lineDirection() const
92{
93 if (!m_lineDirection.isValid()) {
94 m_lineDirection.set(transform().linear().col(2));
95 }
96 return *(m_lineDirection.ptr());
97}
98
99/** the pathCorrection for derived classes with thickness */
100inline double
101StraightLineSurface::pathCorrection(const Amg::Vector3D&,
102 const Amg::Vector3D&) const
103{
104 return 1.;
105}
106
107/** Return properly formatted class name for screen output */
108inline std::string
109StraightLineSurface::name() const
110{
111 return "Trk::StraightLineSurface";
112}
113
114}