Analysis Software
Documentation for sPHENIX simulation 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 
12 #include "Acts/Geometry/Volume.hpp"
15 
16 #include <array>
17 #include <iomanip>
18 #include <memory>
19 #include <ostream>
20 #include <vector>
21 
22 namespace Acts {
23 
24 class CylinderBounds;
25 class ConeBounds;
26 class RadialBounds;
27 class PlanarBounds;
28 
35  public:
37  enum BoundValues : unsigned int {
46  };
47 
48  ConeVolumeBounds() = delete;
49 
59  ConeVolumeBounds(double innerAlpha, double innerOffsetZ, double outerAlpha,
60  double outerOffsetZ, double halflengthZ, double averagePhi,
61  double halfPhiSector) noexcept(false);
62 
74  ConeVolumeBounds(double cylinderR, double alpha, double offsetZ,
75  double halflengthZ, double averagePhi,
76  double halfPhiSector) noexcept(false);
77 
81  ConeVolumeBounds(const std::array<double, eSize>& values) noexcept(false)
82  : m_values(values) {
85  }
86 
87  ConeVolumeBounds(const ConeVolumeBounds& cobo) = default;
88  ~ConeVolumeBounds() override = default;
89  ConeVolumeBounds& operator=(const ConeVolumeBounds& cobo) = default;
90 
92 
96  std::vector<double> values() const final;
97 
103  bool inside(const Vector3& pos, double tol = 0.) const final;
104 
116  const Transform3& transform = Transform3::Identity()) const final;
117 
123  Volume::BoundingBox boundingBox(const Transform3* trf = nullptr,
124  const Vector3& envelope = {0, 0, 0},
125  const Volume* entity = nullptr) const final;
126 
129  double get(BoundValues bValue) const { return m_values[bValue]; }
130 
131  // Return the derived innerRmin
132  double innerRmin() const;
133 
134  // Return the derived innerRmin
135  double innerRmax() const;
136 
137  // Return the derived inner tan(alpha)
138  double innerTanAlpha() const;
139 
140  // Return the derived outerRmin
141  double outerRmin() const;
142 
143  // Return the derived outerRmax
144  double outerRmax() const;
145 
146  // Return the derived outer tan(alpha)
147  double outerTanAlpha() const;
148 
152  std::ostream& toStream(std::ostream& sl) const final;
153 
154  private:
157  void checkConsistency() noexcept(false);
158 
160  void buildSurfaceBounds();
161 
165  template <class stream_t>
166  stream_t& dumpT(stream_t& dt) const;
167 
169  std::array<double, eSize> m_values;
171  std::shared_ptr<ConeBounds> m_innerConeBounds{nullptr};
172  std::shared_ptr<ConeBounds> m_outerConeBounds{nullptr};
173  std::shared_ptr<CylinderBounds> m_outerCylinderBounds{nullptr};
174  std::shared_ptr<RadialBounds> m_negativeDiscBounds{nullptr};
175  std::shared_ptr<RadialBounds> m_positiveDiscBounds{nullptr};
176  std::shared_ptr<PlanarBounds> m_sectorBounds{nullptr};
177 
179  double m_innerRmin = 0.;
180  double m_innerRmax = 0.;
181  double m_innerTanAlpha = 0.;
182  double m_outerRmin = 0.;
183  double m_outerRmax = 0.;
184  double m_outerTanAlpha = 0.;
185 };
186 
187 inline double ConeVolumeBounds::innerRmin() const {
188  return m_innerRmin;
189 }
190 
191 inline double ConeVolumeBounds::innerRmax() const {
192  return m_innerRmax;
193 }
194 
195 inline double ConeVolumeBounds::innerTanAlpha() const {
196  return m_innerTanAlpha;
197 }
198 
199 inline double ConeVolumeBounds::outerRmin() const {
200  return m_outerRmin;
201 }
202 
203 inline double ConeVolumeBounds::outerRmax() const {
204  return m_outerRmax;
205 }
206 
207 inline double ConeVolumeBounds::outerTanAlpha() const {
208  return m_outerTanAlpha;
209 }
210 
211 inline std::vector<double> ConeVolumeBounds::values() const {
212  std::vector<double> valvector;
213  valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
214  return valvector;
215 }
216 
217 template <class stream_t>
218 stream_t& ConeVolumeBounds::dumpT(stream_t& dt) const {
219  dt << std::setiosflags(std::ios::fixed);
220  dt << std::setprecision(5);
221  dt << "Acts::ConeVolumeBounds : (innerAlpha, innerOffsetZ, outerAlpha,";
222  dt << " outerOffsetZ, halflenghZ, averagePhi, halfPhiSector) = ";
223  dt << get(eInnerAlpha) << ", " << get(eInnerOffsetZ) << ", ";
224  dt << get(eOuterAlpha) << ", " << get(eOuterOffsetZ) << ", ";
225  dt << get(eHalfLengthZ) << ", " << get(eAveragePhi) << std::endl;
226  return dt;
227 }
228 
229 } // namespace Acts