2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
6 inline bool CylinderBounds::operator==(const CylinderBounds& bo) const
8 return *this == static_cast<const SurfaceBounds &>(bo);
11 inline CylinderBounds*
12 CylinderBounds::clone() const
14 return new CylinderBounds(*this);
18 CylinderBounds::inside(const Amg::Vector2D& locpo,
22 double z = locpo[locZ];
23 bool insideZ = insideLocZ(z, tol2);
26 // no check on Phi neccesary
29 // now check insidePhi
31 (locpo[locRPhi] / m_boundValues[CylinderBounds::bv_radius]) -
32 m_boundValues[CylinderBounds::bv_averagePhi];
33 localPhi -= (localPhi > M_PI) ? 2. * M_PI : 0.;
34 return (localPhi * localPhi <
35 (m_boundValues[CylinderBounds::bv_halfPhiSector] + tol1) *
36 (m_boundValues[CylinderBounds::bv_halfPhiSector] + tol1));
40 CylinderBounds::inside(const Amg::Vector2D& locpo,
41 const BoundaryCheck& bchk) const
43 if (bchk.bcType == 0 || bchk.nSigmas == 0 ||
44 m_boundValues[CylinderBounds::bv_halfPhiSector] != M_PI)
45 return CylinderBounds::inside(
46 locpo, bchk.toleranceLoc1, bchk.toleranceLoc2);
49 (bchk.lCovariance(1, 0) != 0 &&
50 (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)) != 0)
51 ? .5 * bchk.FastArcTan(2 * bchk.lCovariance(1, 0) /
52 (bchk.lCovariance(1, 1) - bchk.lCovariance(0, 0)))
54 sincosCache scResult = bchk.FastSinCos(theta);
55 double dphi = scResult.sinC * scResult.sinC * bchk.lCovariance(0, 0);
56 double dz = scResult.cosC * scResult.cosC * bchk.lCovariance(0, 1);
57 double max_ell = dphi > dz ? dphi : dz;
58 double limit = bchk.nSigmas * sqrt(max_ell);
59 return insideLocZ(locpo[locZ], limit);
63 CylinderBounds::inside3D(const Amg::Vector3D& glopo,
67 return inside(glopo.perp(), glopo.phi(), glopo.z(), tol1, tol2);
71 CylinderBounds::inside(double r, double phi, double z, double tol1, double tol2)
75 bool insideZ = insideLocZ(z, tol2);
78 double diffR = (m_boundValues[CylinderBounds::bv_radius] - r);
79 bool insideR = diffR * diffR < tol1 * tol1;
82 // now check insidePhi if needed
85 // phi needs to be checked
86 double localPhi = phi - m_boundValues[CylinderBounds::bv_averagePhi];
87 localPhi -= (localPhi > M_PI) ? 2. * M_PI : 0.;
88 return (localPhi * localPhi <
89 m_boundValues[CylinderBounds::bv_halfPhiSector] *
90 m_boundValues[CylinderBounds::bv_halfPhiSector]);
94 CylinderBounds::insideLocZ(double z, double tol2) const
96 return (m_boundValues[CylinderBounds::bv_halfZ] + tol2) - fabs(z) > 0.;
100 CylinderBounds::insideLoc1(const Amg::Vector2D& locpo, double tol1) const
102 bool insideRphi = false;
103 if (fabs(m_boundValues[CylinderBounds::bv_averagePhi]) < 10e-7)
105 (fabs(locpo[locRPhi] / m_boundValues[CylinderBounds::bv_radius]) <
106 (m_boundValues[CylinderBounds::bv_halfPhiSector] + tol1));
109 (locpo[locRPhi] / m_boundValues[CylinderBounds::bv_radius]) -
110 m_boundValues[CylinderBounds::bv_averagePhi];
111 localPhi -= (localPhi > M_PI) ? 2. * M_PI : 0.;
113 (localPhi < (m_boundValues[CylinderBounds::bv_halfPhiSector] + tol1));
119 CylinderBounds::insideLoc2(const Amg::Vector2D& locpo, double tol2) const
121 return insideLocZ(locpo[locZ], tol2);
125 CylinderBounds::insideRadius(const Amg::Vector2D& locpo, double tol) const
127 return (this->inside(locpo, tol, 0) &&
128 fabs(locpo[locR]) < m_boundValues[CylinderBounds::bv_radius] + tol);
132 CylinderBounds::r() const
134 return m_boundValues[CylinderBounds::bv_radius];
138 CylinderBounds::averagePhi() const
140 return m_boundValues[CylinderBounds::bv_averagePhi];
144 CylinderBounds::halfPhiSector() const
146 return m_boundValues[CylinderBounds::bv_halfPhiSector];
150 CylinderBounds::halflengthZ() const
152 return m_boundValues[CylinderBounds::bv_halfZ];