Analysis Software
Documentation for sPHENIX simulation 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 <iomanip>
16 #include <iostream>
17 
20 
23 }
24 
25 static inline double square(double x) {
26  return x * x;
27 }
28 
30 bool Acts::EllipseBounds::inside(const Vector2& lposition,
31  const BoundaryCheck& bcheck) const {
32  double tol0 = bcheck.m_tolerance[0];
33  double tol1 = bcheck.m_tolerance[1];
34  double phi =
35  detail::radian_sym(VectorHelpers::phi(lposition) - get(eAveragePhi));
36  double phiHalf = get(eHalfPhiSector) + tol1;
37 
38  bool insidePhi = (-phiHalf <= phi) && (phi < phiHalf);
39  bool insideInner =
40  (get(eInnerRx) <= tol0) || (get(eOuterRx) <= tol0) ||
41  (1 < (square(lposition[Acts::eBoundLoc0] / (get(eInnerRx) - tol0)) +
42  square(lposition[Acts::eBoundLoc1] / (get(eOuterRx) - tol0))));
43  bool insideOuter =
44  ((square(lposition[Acts::eBoundLoc0] / (get(eInnerRy) + tol0)) +
45  square(lposition[Acts::eBoundLoc1] / (get(eOuterRy) + tol0))) < 1);
46  return (insidePhi && insideInner && insideOuter);
47 }
48 
49 std::vector<Acts::Vector2> Acts::EllipseBounds::vertices(
50  unsigned int lseg) const {
52  get(eInnerRx), get(eInnerRy), get(eOuterRx), get(eOuterRy),
53  get(eAveragePhi), get(eHalfPhiSector), lseg);
54 }
55 
57  return m_boundingBox;
58 }
59 
60 // ostream operator overload
61 std::ostream& Acts::EllipseBounds::toStream(std::ostream& sl) const {
62  sl << std::setiosflags(std::ios::fixed);
63  sl << std::setprecision(7);
64  sl << "Acts::EllipseBounds: (innerRadius0, outerRadius0, innerRadius1, "
65  "outerRadius1, hPhiSector, averagePhi) = ";
66  sl << "(" << get(eInnerRx) << ", " << get(eInnerRy) << ", " << get(eOuterRx)
67  << ", " << get(eOuterRy) << ", " << get(eAveragePhi) << ", "
68  << get(eHalfPhiSector) << ", " << get(eAveragePhi) << ")";
69  sl << std::setprecision(-1);
70  return sl;
71 }