EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EllipseBounds.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EllipseBounds.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
14 
15 #include <cmath>
16 #include <iomanip>
17 #include <iostream>
18 
21 
24 }
25 
26 static inline double square(double x) {
27  return x * x;
28 }
29 
31 bool Acts::EllipseBounds::inside(const Vector2D& lposition,
32  const BoundaryCheck& bcheck) const {
33  double tol0 = bcheck.m_tolerance[0];
34  double tol1 = bcheck.m_tolerance[1];
35  double phi =
36  detail::radian_sym(VectorHelpers::phi(lposition) - get(eAveragePhi));
37  double phiHalf = get(eHalfPhiSector) + tol1;
38 
39  bool insidePhi = (-phiHalf <= phi) && (phi < phiHalf);
40  bool insideInner =
41  (get(eInnerRx) <= tol0) || (get(eOuterRx) <= tol0) ||
42  (1 < (square(lposition[Acts::eBoundLoc0] / (get(eInnerRx) - tol0)) +
43  square(lposition[Acts::eBoundLoc1] / (get(eOuterRx) - tol0))));
44  bool insideOuter =
45  ((square(lposition[Acts::eBoundLoc0] / (get(eInnerRy) + tol0)) +
46  square(lposition[Acts::eBoundLoc1] / (get(eOuterRy) + tol0))) < 1);
47  return (insidePhi && insideInner && insideOuter);
48 }
49 
50 std::vector<Acts::Vector2D> Acts::EllipseBounds::vertices(
51  unsigned int lseg) const {
53  get(eInnerRx), get(eInnerRy), get(eOuterRx), get(eOuterRy),
54  get(eAveragePhi), get(eHalfPhiSector), lseg);
55 }
56 
58  return m_boundingBox;
59 }
60 
61 // ostream operator overload
62 std::ostream& Acts::EllipseBounds::toStream(std::ostream& sl) const {
63  sl << std::setiosflags(std::ios::fixed);
64  sl << std::setprecision(7);
65  sl << "Acts::EllipseBounds: (innerRadius0, outerRadius0, innerRadius1, "
66  "outerRadius1, hPhiSector, averagePhi) = ";
67  sl << "(" << get(eInnerRx) << ", " << get(eInnerRy) << ", " << get(eOuterRx)
68  << ", " << get(eOuterRy) << ", " << get(eAveragePhi) << ", "
69  << get(eHalfPhiSector) << ", " << get(eAveragePhi) << ")";
70  sl << std::setprecision(-1);
71  return sl;
72 }