File indexing completed on 2025-01-19 09:23:21
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/Volume.hpp"
0013 #include "Acts/Geometry/VolumeBounds.hpp"
0014
0015 #include <array>
0016 #include <iosfwd>
0017 #include <memory>
0018 #include <stdexcept>
0019 #include <vector>
0020
0021 namespace Acts {
0022
0023 class CylinderBounds;
0024 class DiscBounds;
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 class CutoutCylinderVolumeBounds : public VolumeBounds {
0039 public:
0040
0041 enum BoundValues : int {
0042 eMinR = 0,
0043 eMedR = 1,
0044 eMaxR = 2,
0045 eHalfLengthZ = 3,
0046 eHalfLengthZcutout = 4,
0047 eSize
0048 };
0049
0050 CutoutCylinderVolumeBounds() = delete;
0051
0052
0053
0054
0055
0056
0057
0058
0059 CutoutCylinderVolumeBounds(double rmin, double rmed, double rmax, double hlZ,
0060 double hlZc) noexcept(false)
0061 : m_values({rmin, rmed, rmax, hlZ, hlZc}) {
0062 checkConsistency();
0063 buildSurfaceBounds();
0064 }
0065
0066
0067
0068
0069 CutoutCylinderVolumeBounds(const std::array<double, eSize>& values) noexcept(
0070 false)
0071 : m_values(values) {
0072 checkConsistency();
0073 buildSurfaceBounds();
0074 }
0075
0076 ~CutoutCylinderVolumeBounds() override = default;
0077
0078 VolumeBounds::BoundsType type() const final {
0079 return VolumeBounds::eCutoutCylinder;
0080 }
0081
0082
0083
0084
0085 std::vector<double> values() const final;
0086
0087
0088
0089
0090
0091
0092 bool inside(const Vector3& gpos, double tol = 0) const override;
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104 std::vector<OrientedSurface> orientedSurfaces(
0105 const Transform3& transform = Transform3::Identity()) const override;
0106
0107
0108
0109
0110
0111
0112
0113 Volume::BoundingBox boundingBox(const Transform3* trf = nullptr,
0114 const Vector3& envelope = {0, 0, 0},
0115 const Volume* entity = nullptr) const final;
0116
0117
0118
0119
0120
0121 std::vector<Acts::BinningValue> canonicalBinning() const override {
0122 return {Acts::binR, Acts::binPhi, Acts::binZ};
0123 };
0124
0125
0126
0127
0128
0129 std::ostream& toStream(std::ostream& sl) const override;
0130
0131
0132
0133 double get(BoundValues bValue) const { return m_values[bValue]; }
0134
0135 private:
0136 std::array<double, eSize> m_values;
0137
0138
0139 std::shared_ptr<const CylinderBounds> m_innerCylinderBounds{nullptr};
0140 std::shared_ptr<const CylinderBounds> m_cutoutCylinderBounds{nullptr};
0141 std::shared_ptr<const CylinderBounds> m_outerCylinderBounds{nullptr};
0142 std::shared_ptr<const DiscBounds> m_outerDiscBounds{nullptr};
0143 std::shared_ptr<const DiscBounds> m_innerDiscBounds{nullptr};
0144
0145
0146 void buildSurfaceBounds();
0147
0148
0149
0150 void checkConsistency() noexcept(false);
0151 };
0152
0153 inline std::vector<double> CutoutCylinderVolumeBounds::values() const {
0154 std::vector<double> valvector;
0155 valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
0156 return valvector;
0157 }
0158
0159 inline void CutoutCylinderVolumeBounds::checkConsistency() noexcept(false) {
0160 if (get(eMinR) < 0. || get(eMedR) <= 0. || get(eMaxR) <= 0. ||
0161 get(eMinR) >= get(eMedR) || get(eMinR) >= get(eMaxR) ||
0162 get(eMedR) >= get(eMaxR)) {
0163 throw std::invalid_argument(
0164 "CutoutCylinderVolumeBounds: invalid radial input.");
0165 }
0166 if (get(eHalfLengthZ) <= 0 || get(eHalfLengthZcutout) <= 0. ||
0167 get(eHalfLengthZcutout) > get(eHalfLengthZ)) {
0168 throw std::invalid_argument(
0169 "CutoutCylinderVolumeBounds: invalid longitudinal input.");
0170 }
0171 }
0172
0173 }