ATLAS Offline Software
ConeBounds.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 namespace Trk {
6 inline bool ConeBounds::operator==(const ConeBounds& bo) const
7 {
8  return *this == static_cast<const SurfaceBounds& >(bo);
9 }
10 
11 inline ConeBounds*
12 ConeBounds::clone() const
13 {
14  return new ConeBounds(*this);
15 }
16 
17 inline bool
18 ConeBounds::inside(const Amg::Vector2D& locpo, double tol1, double tol2) const
19 {
20  double z = locpo[locZ];
21  bool insideZ = z > (m_boundValues[ConeBounds::bv_minZ] - tol2) &&
22  z < (m_boundValues[ConeBounds::bv_maxZ] + tol2);
23  if (!insideZ)
24  return false;
25  // TODO: Do we need some sort of "R" tolerance also here (take
26  // it off the z tol2 in that case?) or does the rphi tol1 cover
27  // this? (Could argue either way)
28  double coneR = z * m_tanAlpha;
29  double minRPhi = coneR * minPhi() - tol1;
30  double maxRPhi = coneR * maxPhi() + tol1;
31  return minRPhi < locpo[locRPhi] && locpo[locRPhi] < maxRPhi;
32 }
33 
34 inline bool
35 ConeBounds::inside(const Amg::Vector3D& glopo, double tol1, double tol2) const
36 {
37  // coords are (rphi,z)
38  return inside(
39  Amg::Vector2D(glopo.perp() * glopo.phi(), glopo.z()), tol1, tol2);
40 }
41 
42 inline bool
43 ConeBounds::inside(const Amg::Vector3D& glopo, const BoundaryCheck& bchk) const
44 {
45  // coords are (rphi,z)
46  return inside(Amg::Vector2D(glopo.perp() * glopo.phi(), glopo.z()),
47  bchk.toleranceLoc1,
48  bchk.toleranceLoc2);
49 }
50 
51 inline bool
52 ConeBounds::inside(const Amg::Vector2D& locpo, const BoundaryCheck& bchk) const
53 {
54  return ConeBounds::inside(locpo, bchk.toleranceLoc1, bchk.toleranceLoc2);
55 }
56 
57 inline bool
58 ConeBounds::insideLoc1(const Amg::Vector2D& locpo, double tol1) const
59 {
60  double z = locpo[locZ];
61  double coneR = z * m_tanAlpha;
62  double minRPhi = coneR * minPhi() - tol1;
63  double maxRPhi = coneR * maxPhi() + tol1;
64  return minRPhi < locpo[locRPhi] && locpo[locRPhi] < maxRPhi;
65 }
66 
67 inline bool
68 ConeBounds::insideLoc2(const Amg::Vector2D& locpo, double tol2) const
69 {
70  double z = locpo[locZ];
71  return (z > (m_boundValues[ConeBounds::bv_minZ] - tol2) &&
72  z < (m_boundValues[ConeBounds::bv_maxZ] + tol2));
73 }
74 
75 inline double
76 ConeBounds::r() const
77 {
78  double z = fabs(m_boundValues[ConeBounds::bv_maxZ]);
79  double mz = fabs(m_boundValues[ConeBounds::bv_minZ]);
80  if (mz > z)
81  z = mz;
82  return fabs(z * m_tanAlpha);
83 }
84 
85 inline double
86 ConeBounds::r(double z) const
87 {
88  return fabs(z * m_tanAlpha);
89 }
90 
91 inline double
92 ConeBounds::tanAlpha() const
93 {
94  return m_tanAlpha;
95 }
96 
97 inline double
98 ConeBounds::sinAlpha() const
99 {
100  return m_sinAlpha;
101 }
102 
103 inline double
104 ConeBounds::cosAlpha() const
105 {
106  return m_cosAlpha;
107 }
108 
109 inline double
110 ConeBounds::alpha() const
111 {
112  return m_boundValues[ConeBounds::bv_alpha];
113 }
114 
115 inline double
116 ConeBounds::minZ() const
117 {
118  return m_boundValues[ConeBounds::bv_minZ];
119 }
120 
121 inline double
122 ConeBounds::maxZ() const
123 {
124  return m_boundValues[ConeBounds::bv_maxZ];
125 }
126 
127 inline double
128 ConeBounds::averagePhi() const
129 {
130  return m_boundValues[ConeBounds::bv_averagePhi];
131 }
132 
133 inline double
134 ConeBounds::halfPhiSector() const
135 {
136  return m_boundValues[ConeBounds::bv_halfPhiSector];
137 }
138 
139 }
140