EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConeBounds.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ConeBounds.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 
11 #include <cmath>
12 #include <iomanip>
13 #include <iostream>
14 #include <limits>
15 
16 Acts::ConeBounds::ConeBounds(double alpha, bool symm, double halfphi,
17  double avphi) noexcept(false)
18  : m_values({alpha, symm ? -std::numeric_limits<double>::infinity() : 0,
19  std::numeric_limits<double>::infinity(), halfphi, avphi}),
20  m_tanAlpha(std::tan(alpha)) {
21  checkConsistency();
22 }
23 
25  double halfphi, double avphi) noexcept(false)
26  : m_values({alpha, minz, maxz, halfphi, avphi}),
27  m_tanAlpha(std::tan(alpha)) {
28  checkConsistency();
29 }
30 
31 Acts::ConeBounds::ConeBounds(const std::array<double, eSize>& values) noexcept(
32  false)
33  : m_values(values), m_tanAlpha(std::tan(values[eAlpha])) {
34  checkConsistency();
35 }
36 
38  return SurfaceBounds::eCone;
39 }
40 
43  const Acts::Vector2D& lposition) const {
45 
46  auto x = r(lposition[eBoundLoc1]); // cone radius at the local position
47  Vector2D shifted;
48  shifted[eBoundLoc1] = lposition[eBoundLoc1];
49  shifted[eBoundLoc0] =
50  std::isnormal(x)
51  ? (x * radian_sym((lposition[eBoundLoc0] / x) - get(eAveragePhi)))
52  : lposition[eBoundLoc0];
53  return shifted;
54 }
55 
57  const Acts::BoundaryCheck& bcheck) const {
58  auto rphiHalf = r(lposition[eBoundLoc1]) * get(eHalfPhiSector);
59  return bcheck.isInside(shifted(lposition), Vector2D(-rphiHalf, get(eMinZ)),
60  Vector2D(rphiHalf, get(eMaxZ)));
61 }
62 
63 std::ostream& Acts::ConeBounds::toStream(std::ostream& sl) const {
64  sl << std::setiosflags(std::ios::fixed);
65  sl << std::setprecision(7);
66  sl << "Acts::ConeBounds: (tanAlpha, minZ, maxZ, halfPhiSector, averagePhi) "
67  "= ";
68  sl << "(" << m_tanAlpha << ", " << get(eMinZ) << ", " << get(eMaxZ) << ", "
69  << get(eHalfPhiSector) << ", " << get(eAveragePhi) << ")";
70  sl << std::setprecision(-1);
71  return sl;
72 }