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/LineBounds.hpp"
0010 
0011 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0012 #include "Acts/Surfaces/detail/BoundaryCheckHelper.hpp"
0013 
0014 #include <iomanip>
0015 #include <iostream>
0016 
0017 namespace Acts {
0018 
0019 std::vector<double> LineBounds::values() const {
0020   return {m_values.begin(), m_values.end()};
0021 }
0022 
0023 void LineBounds::checkConsistency() noexcept(false) {
0024   if (get(eR) < 0.) {
0025     throw std::invalid_argument("LineBounds: zero radius.");
0026   }
0027   if (get(eHalfLengthZ) <= 0.) {
0028     throw std::invalid_argument("LineBounds: zero/negative length.");
0029   }
0030 }
0031 
0032 bool LineBounds::inside(const Vector2& lposition,
0033                         const BoundaryTolerance& boundaryTolerance) const {
0034   double r = get(LineBounds::eR);
0035   double halfLengthZ = get(LineBounds::eHalfLengthZ);
0036   return detail::insideAlignedBox(Vector2(-r, -halfLengthZ),
0037                                   Vector2(r, halfLengthZ), boundaryTolerance,
0038                                   lposition, std::nullopt);
0039 }
0040 
0041 std::ostream& LineBounds::toStream(std::ostream& sl) const {
0042   sl << std::setiosflags(std::ios::fixed);
0043   sl << std::setprecision(7);
0044   sl << "Acts::LineBounds: (radius, halflengthInZ) = ";
0045   sl << "(" << get(LineBounds::eR) << ", " << get(LineBounds::eHalfLengthZ)
0046      << ")";
0047   sl << std::setprecision(-1);
0048   return sl;
0049 }
0050 
0051 }  // namespace Acts