2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
7 inline bool ConeSurface::operator==(const ConeSurface& csf) const
13 bool transfEqual(transform().isApprox(csf.transform(), 10e-8));
14 bool centerEqual = (transfEqual) ? (center() == csf.center()) : false;
15 bool boundsEqual = (centerEqual) ? (bounds() == csf.bounds()) : false;
19 /** Return the surface type */
20 inline constexpr SurfaceType
21 ConeSurface::type() const
23 return ConeSurface::staticType;
26 template<int DIM, class T>
27 std::unique_ptr<ParametersT<DIM, T, ConeSurface>>
28 ConeSurface::createUniqueParameters(double l1,
33 std::optional<AmgSymMatrix(DIM)> cov) const
35 return std::make_unique<ParametersT<DIM, T, ConeSurface>>(
36 l1, l2, phi, theta, qop, *this, std::move(cov));
39 /** Use the Surface as a ParametersBase constructor, from global parameters */
40 template<int DIM, class T>
41 std::unique_ptr<ParametersT<DIM, T, ConeSurface>>
42 ConeSurface::createUniqueParameters(const Amg::Vector3D& position,
43 const Amg::Vector3D& momentum,
45 std::optional<AmgSymMatrix(DIM)> cov) const
47 return std::make_unique<ParametersT<DIM, T, ConeSurface>>(
48 position, momentum, charge, *this, std::move(cov));
52 ConeSurface::clone() const
54 return new ConeSurface(*this);
58 ConeSurface::normal(const Amg::Vector2D& lp) const
60 // (cos phi cos alpha, sin phi cos alpha, sgn z sin alpha)
61 double phi = lp[Trk::locRPhi] / (bounds().r(lp[Trk::locZ]));
62 double sgn = lp[Trk::locZ] > 0 ? -1. : +1.;
63 Amg::Vector3D localNormal(cos(phi) * bounds().cosAlpha(),
64 sin(phi) * bounds().cosAlpha(),
65 sgn * bounds().sinAlpha());
66 return Amg::Vector3D(transform().rotation() * localNormal);
69 inline const ConeBounds&
70 ConeSurface::bounds() const
72 return *(m_bounds.get());
76 ConeSurface::insideBounds(const Amg::Vector2D& locpos,
80 return bounds().inside(locpos, tol1, tol2);
84 ConeSurface::insideBoundsCheck(const Amg::Vector2D& locpos,
85 const BoundaryCheck& bchk) const
87 return bounds().inside(locpos, bchk.toleranceLoc1, bchk.toleranceLoc2);
91 ConeSurface::localParametersToPosition(const LocalParameters& locpars) const
93 if (locpars.contains(Trk::locRPhi) && locpars.contains(Trk::locZ))
94 return Amg::Vector2D(locpars[Trk::locRPhi], locpars[Trk::locZ]);
95 if (locpars.contains(Trk::locRPhi)) {
96 // not obvious what one should do here with the "r" bit, so by definintion
97 // take that r=1 if no z is given to fix down the r component
98 double phi = locpars[Trk::locRPhi];
99 return Amg::Vector2D(phi, locpars[Trk::locZ]);
100 } else if (locpars.contains(Trk::locZ)) {
101 double r = locpars[Trk::locZ] * bounds().tanAlpha();
102 // by definition set it to M_PI/2
103 return Amg::Vector2D(r * M_PI * 0.5, locpars[Trk::locZ]);
105 return Amg::Vector2D(0., 0.);
108 /** Return properly formatted class name for screen output */
110 ConeSurface::name() const
112 return "Trk::ConeSurface";