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