Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:30

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Surfaces/RadialBounds.hpp"
0010 
0011 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0012 #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp"
0013 #include "Acts/Surfaces/detail/VerticesHelper.hpp"
0014 #include "Acts/Utilities/detail/periodic.hpp"
0015 
0016 #include <iomanip>
0017 #include <iostream>
0018 #include <stdexcept>
0019 
0020 namespace Acts {
0021 
0022 std::vector<double> RadialBounds::values() const {
0023   return {m_values.begin(), m_values.end()};
0024 }
0025 
0026 void RadialBounds::checkConsistency() noexcept(false) {
0027   if (get(eMinR) < 0. || get(eMaxR) <= 0. || get(eMinR) > get(eMaxR)) {
0028     throw std::invalid_argument("RadialBounds: invalid radial setup");
0029   }
0030   if (get(eHalfPhiSector) < 0. || get(eHalfPhiSector) > std::numbers::pi) {
0031     throw std::invalid_argument("RadialBounds: invalid phi sector setup.");
0032   }
0033   if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) {
0034     throw std::invalid_argument("RadialBounds: invalid phi positioning.");
0035   }
0036 }
0037 
0038 Vector2 RadialBounds::shifted(const Vector2& lposition) const {
0039   Vector2 tmp;
0040   tmp[0] = lposition[0];
0041   tmp[1] = detail::radian_sym(lposition[1] - get(eAveragePhi));
0042   return tmp;
0043 }
0044 
0045 bool RadialBounds::inside(const Vector2& lposition,
0046                           const BoundaryTolerance& boundaryTolerance) const {
0047   return detail::insideAlignedBox(Vector2(get(eMinR), -get(eHalfPhiSector)),
0048                                   Vector2(get(eMaxR), get(eHalfPhiSector)),
0049                                   boundaryTolerance, shifted(lposition),
0050                                   std::nullopt);
0051 }
0052 
0053 std::vector<Vector2> RadialBounds::vertices(unsigned int lseg) const {
0054   return detail::VerticesHelper::circularVertices(
0055       get(eMinR), get(eMaxR), get(eAveragePhi), get(eHalfPhiSector), lseg);
0056 }
0057 
0058 std::ostream& RadialBounds::toStream(std::ostream& sl) const {
0059   sl << std::setiosflags(std::ios::fixed);
0060   sl << std::setprecision(7);
0061   sl << "Acts::RadialBounds:  (innerRadius, outerRadius, hPhiSector, "
0062         "averagePhi) = ";
0063   sl << "(" << get(eMinR) << ", " << get(eMaxR) << ", " << get(eHalfPhiSector)
0064      << ", " << get(eAveragePhi) << ")";
0065   sl << std::setprecision(-1);
0066   return sl;
0067 }
0068 
0069 }  // namespace Acts