ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CutoutCylinderVolumeBounds.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CutoutCylinderVolumeBounds.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 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 
18 
19 #include <array>
20 #include <exception>
21 #include <vector>
22 
23 namespace Acts {
24 
25 class IVisualization;
26 
39  public:
41  enum BoundValues : int {
42  eMinR = 0,
43  eMedR = 1,
44  eMaxR = 2,
47  eSize = 5
48  };
49 
50  CutoutCylinderVolumeBounds() = delete;
51 
59  CutoutCylinderVolumeBounds(double rmin, double rmed, double rmax, double hlZ,
60  double hlZc) noexcept(false)
61  : m_values({rmin, rmed, rmax, hlZ, hlZc}) {
63  }
64 
68  CutoutCylinderVolumeBounds(const std::array<double, eSize>& values) noexcept(
69  false)
70  : m_values(values) {
72  }
73 
74  ~CutoutCylinderVolumeBounds() override = default;
75 
78  }
79 
83  std::vector<double> values() const final;
84 
90  bool inside(const Vector3D& gpos, double tol = 0) const override;
91 
98  std::vector<std::shared_ptr<const Surface>> decomposeToSurfaces(
99  const Transform3D* transform = nullptr) const override;
100 
107  Volume::BoundingBox boundingBox(const Transform3D* trf = nullptr,
108  const Vector3D& envelope = {0, 0, 0},
109  const Volume* entity = nullptr) const final;
110 
115  std::ostream& toStream(std::ostream& sl) const override;
116 
119  double get(BoundValues bValue) const { return m_values[bValue]; }
120 
121  private:
122  std::array<double, eSize> m_values;
123 
126  void checkConsistency() noexcept(false);
127 };
128 
129 inline std::vector<double> CutoutCylinderVolumeBounds::values() const {
130  std::vector<double> valvector;
131  valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
132  return valvector;
133 }
134 
136  if (get(eMinR) < 0. or get(eMedR) <= 0. or get(eMaxR) <= 0. or
137  get(eMinR) >= get(eMedR) or get(eMinR) >= get(eMaxR) or
138  get(eMedR) >= get(eMaxR)) {
139  throw std::invalid_argument(
140  "CutoutCylinderVolumeBounds: invalid radial input.");
141  }
142  if (get(eHalfLengthZ) <= 0 or get(eHalfLengthZcutout) <= 0. or
143  get(eHalfLengthZcutout) > get(eHalfLengthZ)) {
144  throw std::invalid_argument(
145  "CutoutCylinderVolumeBounds: invalid longitudinal input.");
146  }
147 }
148 
149 } // namespace Acts