EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConeVolumeBounds.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ConeVolumeBounds.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 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 
11 #include "Acts/Geometry/Volume.hpp"
15 
16 #include <cmath>
17 
18 namespace Acts {
19 
20 class Surface;
21 class CylinderBounds;
22 class ConeBounds;
23 class RadialBounds;
24 class PlanarBounds;
25 class Volume;
26 
33  public:
35  enum BoundValues : unsigned int {
44  };
45 
46  ConeVolumeBounds() = delete;
47 
57  ConeVolumeBounds(double innerAlpha, double innerTipZ, double outerAlpha,
58  double outerOffsetZ, double halflengthZ, double averagePhi,
59  double halfPhiSector) noexcept(false);
60 
72  ConeVolumeBounds(double cylinderR, double alpha, double offsetZ,
73  double halflengthZ, double averagePhi,
74  double halfPhiSector) noexcept(false);
75 
79  ConeVolumeBounds(const std::array<double, eSize>& values) noexcept(false)
80  : m_values(values) {
83  }
84 
85  ConeVolumeBounds(const ConeVolumeBounds& cobo) = default;
86  ~ConeVolumeBounds() override = default;
87  ConeVolumeBounds& operator=(const ConeVolumeBounds& cobo) = default;
88 
90 
94  std::vector<double> values() const final;
95 
101  bool inside(const Vector3D& pos, double tol = 0.) const final;
102 
114  const Transform3D& transform = Transform3D::Identity()) const final;
115 
121  Volume::BoundingBox boundingBox(const Transform3D* trf = nullptr,
122  const Vector3D& envelope = {0, 0, 0},
123  const Volume* entity = nullptr) const final;
124 
127  double get(BoundValues bValue) const { return m_values[bValue]; }
128 
129  // Return the derived innerRmin
130  double innerRmin() const;
131 
132  // Return the derived innerRmin
133  double innerRmax() const;
134 
135  // Return the derived inner tan(alpha)
136  double innerTanAlpha() const;
137 
138  // Return the derived outerRmin
139  double outerRmin() const;
140 
141  // Return the derived outerRmax
142  double outerRmax() const;
143 
144  // Return the derived outer tan(alpha)
145  double outerTanAlpha() const;
146 
150  std::ostream& toStream(std::ostream& sl) const final;
151 
152  private:
155  void checkConsistency() noexcept(false);
156 
158  void buildSurfaceBounds();
159 
163  template <class stream_t>
164  stream_t& dumpT(stream_t& dt) const;
165 
167  std::array<double, eSize> m_values;
169  std::shared_ptr<ConeBounds> m_innerConeBounds{nullptr};
170  std::shared_ptr<ConeBounds> m_outerConeBounds{nullptr};
171  std::shared_ptr<CylinderBounds> m_outerCylinderBounds{nullptr};
172  std::shared_ptr<RadialBounds> m_negativeDiscBounds{nullptr};
173  std::shared_ptr<RadialBounds> m_positiveDiscBounds{nullptr};
174  std::shared_ptr<PlanarBounds> m_sectorBounds{nullptr};
175 
177  double m_innerRmin = 0.;
178  double m_innerRmax = 0.;
179  double m_innerTanAlpha = 0.;
180  double m_outerRmin = 0.;
181  double m_outerRmax = 0.;
182  double m_outerTanAlpha = 0.;
183 };
184 
185 inline double ConeVolumeBounds::innerRmin() const {
186  return m_innerRmin;
187 }
188 
189 inline double ConeVolumeBounds::innerRmax() const {
190  return m_innerRmax;
191 }
192 
193 inline double ConeVolumeBounds::innerTanAlpha() const {
194  return m_innerTanAlpha;
195 }
196 
197 inline double ConeVolumeBounds::outerRmin() const {
198  return m_outerRmin;
199 }
200 
201 inline double ConeVolumeBounds::outerRmax() const {
202  return m_outerRmax;
203 }
204 
205 inline double ConeVolumeBounds::outerTanAlpha() const {
206  return m_outerTanAlpha;
207 }
208 
209 inline std::vector<double> ConeVolumeBounds::values() const {
210  std::vector<double> valvector;
211  valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
212  return valvector;
213 }
214 
215 template <class stream_t>
216 stream_t& ConeVolumeBounds::dumpT(stream_t& dt) const {
217  dt << std::setiosflags(std::ios::fixed);
218  dt << std::setprecision(5);
219  dt << "Acts::ConeVolumeBounds : (innerAlpha, innerOffsetZ, outerAlpha,";
220  dt << " outerOffsetZ, halflenghZ, averagePhi, halfPhiSector) = ";
221  dt << get(eInnerAlpha) << ", " << get(eInnerOffsetZ) << ", ";
222  dt << get(eOuterAlpha) << ", " << get(eOuterOffsetZ) << ", ";
223  dt << get(eHalfLengthZ) << ", " << get(eAveragePhi) << std::endl;
224  return dt;
225 }
226 
227 } // namespace Acts