ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LineBounds.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file LineBounds.hpp
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 
9 #pragma once
10 
13 
14 #include <array>
15 #include <vector>
16 
17 namespace Acts {
18 
22 class LineBounds : public SurfaceBounds {
23  public:
24  enum BoundValues : int { eR = 0, eHalfLengthZ = 1, eSize = 2 };
25 
26  LineBounds() = delete;
27 
32  LineBounds(double r, double halfZ) noexcept(false) : m_values({r, halfZ}) {
34  }
35 
39  LineBounds(const std::array<double, eSize>& values) noexcept(false)
40  : m_values(values) {
42  }
43 
44  ~LineBounds() override = default;
45 
46  BoundsType type() const final;
47 
51  std::vector<double> values() const final;
52 
61  bool inside(const Vector2D& lposition,
62  const BoundaryCheck& bcheck) const final;
63 
69  double distanceToBoundary(const Vector2D& lposition) const final;
70 
74  std::ostream& toStream(std::ostream& sl) const final;
75 
78  double get(BoundValues bValue) const { return m_values[bValue]; }
79 
80  private:
81  std::array<double, eSize> m_values;
82 
85  void checkConsistency() noexcept(false);
86 };
87 
88 inline std::vector<double> LineBounds::values() const {
89  std::vector<double> valvector;
90  valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
91  return valvector;
92 }
93 
94 inline void LineBounds::checkConsistency() noexcept(false) {
95  if (get(eR) < 0.) {
96  throw std::invalid_argument("LineBounds: zero radius.");
97  }
98  if (get(eHalfLengthZ) <= 0.) {
99  throw std::invalid_argument("LineBounds: zero/negative length.");
100  }
101 }
102 
103 } // namespace Acts